I have been struggling trying to read anything to successfully read a sector on an SD memory chip. I have tried my own code that I pieced together with code I found scattered on the internet.
It initializes and appears to read the sectors successfully, I am getting my 0XFE start of data token but when I compare it to what I see in a HexEditor on my PC on the same card the bytes don't jive. For example in sector one on this SD chip all bytes are supposed to be 0xFF but when I looked at it with my code on the PIC, all bytes are 0xFF with the exception that every 8th byte is a 0x04.
Also I seem to need to read 1 extra byte reading one sector to get the next sector to read successfully. The extra byte is in addition to the 2 CRC bytes which I am reading and the 8 clock cycles needed at the end of a read.
Which brings up another question. What type of CRC is this? I think it is supposed to be CRC16 but when I calculate CRC16 for the bytes from my PIC code or what is displayed on the HexEditor, nothing seems to match up.
Can anyone provide any assistance?
It initializes and appears to read the sectors successfully, I am getting my 0XFE start of data token but when I compare it to what I see in a HexEditor on my PC on the same card the bytes don't jive. For example in sector one on this SD chip all bytes are supposed to be 0xFF but when I looked at it with my code on the PIC, all bytes are 0xFF with the exception that every 8th byte is a 0x04.
Also I seem to need to read 1 extra byte reading one sector to get the next sector to read successfully. The extra byte is in addition to the 2 CRC bytes which I am reading and the 8 clock cycles needed at the end of a read.
Which brings up another question. What type of CRC is this? I think it is supposed to be CRC16 but when I calculate CRC16 for the bytes from my PIC code or what is displayed on the HexEditor, nothing seems to match up.
Can anyone provide any assistance?