- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have noticed that when reading with the SD card core, bit 5 in the ASR (which indicates a data error) would be set on some sectors even though the data was read properly. At first I thought it was random, but upon further observation I noticed that it was repeatable. Some sectors would always indicate a read error and other sectors would indicate that there was no error.
After some exploration with Signaltap, I found that when the CRC is generated, the core is not including the last data bit of the sector in the CRC calculation. So if the last bit in the sector is a 0, the CRC would be calculated properly and no error was indicated. This is because when calculating the CRC, a 0 only shifts the result so it will match the CRC from the SD card. When the last bit is a 1, that bit should get XORed into the CRC which would create a new value. Since that last bit was not included in the CRC calculation, the CRC from the SD card does not match the calculated value and the error is indicated even though the data was read properly. So to fix the core, edit the file Altera_UP_SD_Card_Buffer.vhd and look around line# 253 for this line: to_crc_generator <= shift_register(16) when (current_state = s_RECEIVING_DATA) else from_mem_1_bit when (current_state = s_SEND_DATA) else '0'; and change it to: to_crc_generator <= shift_register(16) when (current_state = s_RECEIVING_DATA) or (current_state = s_RECEIVING_STOP_BIT) else from_mem_1_bit when (current_state = s_SEND_DATA) else '0'; That will fix the problem.Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page