Go Down

Topic: SD card - fixed zeros on 4th and 8th bit?? (Read 242 times) previous topic - next topic

George_Cs

I built a data logger with an ATmega644 and an SPI based SD card. The device works but there is one "tiny" problem.. when MCU writes any data onto SD card, every 4th and 8th bit of the data bytes will be "cleared". For example, if I write 0x8E to the card the stored data will be 0x06. If I write 0x81 I get 0x01. If I write 0xFF I get 0x77, and so on... and I have no idea, what the heck is happening with the data..
I tried three different SD library but the result is always the same, so I think this is not a software issue.
Any ideas??..

George_Cs

It seems the problem is around the SD controller (USB2244) chip. I'm using this controller to connect device to USB. I realized if I remove SD initialization line (SD.begin) from the code the downloaded data (via USB) will be intact. So data on SD card is correct, the problem is occurring when SD controller reads data from the card and transfers it to USB. Maybe there is some crc or sync problem behind this.

el_supremo

Seems to me that it can be explained if bits 3 and 7 aren't wired properly to the USB2244. The fact that they always read as zero suggests they that are grounded somewhere. If there were only a 4-bit path to/from the USB2244 it would be even easier to explain because it would then only require one bad connection.
Exactly how is this device wired to the SD card?

Pete
Don't send me technical questions via Private Message.

George_Cs

This is a simple serial (SPI) connection; MOSI, MISO, CLK, CS - that's all. I think this bit-problem comes from somewhere in the Chip Select (CS). Actually one digital output line of MCU and SD controller connected directly to the same pin (CS pin). Maybe the two controller sometimes produce undesired logic level on the CS pin.. I don't know.. I'm still investigating..

Go Up