Difference between revisions of "SD cards on ARM/LPC"

From HeepyWiki
Jump to navigation Jump to search
(Created page with "the original code was completely failing to wait for the card to complete writes by polling for BUSY state before sending another packet. most cards don't need it but some do, a…")
 
 
Line 1: Line 1:
the original code was completely failing to wait for the card to complete  
+
the original SPI mode code in sd_spi.c was completely failing to wait for the card to complete  
 
writes by polling for BUSY state before sending another packet. most cards
 
writes by polling for BUSY state before sending another packet. most cards
 
don't need it but some do, and it's certainly required.  
 
don't need it but some do, and it's certainly required.  
  
ocz 8g: still doesn't probe on the first try, does on the second.  
+
My OCZ 8g SD card still doesn't probe on the first try, but does on the second.  
 
when writing it shows a fair number of pauses. some cards don't show any.
 
when writing it shows a fair number of pauses. some cards don't show any.
 
they're all very different.  
 
they're all very different.  
Line 12: Line 12:
  
 
rev 381 of alternate_sd_spi.c seems to work with every card perfectly, except
 
rev 381 of alternate_sd_spi.c seems to work with every card perfectly, except
the 8g OCZ still needs to be initialized twice.  
+
for the 8g OCZ, which still needs to be initialized twice.  
  
 
4/5/2010 - added the hd44780 lcd driver too. the LCD needs six gpio pins:
 
4/5/2010 - added the hd44780 lcd driver too. the LCD needs six gpio pins:

Latest revision as of 08:34, 17 January 2012

the original SPI mode code in sd_spi.c was completely failing to wait for the card to complete writes by polling for BUSY state before sending another packet. most cards don't need it but some do, and it's certainly required.

My OCZ 8g SD card still doesn't probe on the first try, but does on the second. when writing it shows a fair number of pauses. some cards don't show any. they're all very different.

also I had to increase the timeout in wait_busy() from 50 to 255 clock units which eliminated a lot of failures, so apparently you sometimes have to wait quite a while.

rev 381 of alternate_sd_spi.c seems to work with every card perfectly, except for the 8g OCZ, which still needs to be initialized twice.

4/5/2010 - added the hd44780 lcd driver too. the LCD needs six gpio pins: four for the data bus, one enable line, and "RS" data4-7 are on P0.10,11,12,13. E is on P0.9, RS is on P0.14, which is the BSL selector input, but that doesn't matter. this code is using the dedicated SPI bus, and it's CS line is on P0.8. None of this would be difficult except that if you have the chip in debug mode, for example to use a JTAG debugger, it disables almost all the rest of the gpios, eg P0.22-31.