Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21602 Discussions

SD-CARD reads first few files correctly, then the remaining wrong!

Altera_Forum
Honored Contributor II
1,328 Views

Hi, 

 

I have used the SD-CARD music player example from the DE2-70 CD to read files from the SD-card, it reads the first few files correctly, when I attempt to read the 4th or 5th files the data loaded into memory is wrong.  

 

I have tried to read the same file multiple times, the first couple of times it is read correctly, the third and on are wrong !! Sometimes the first 3 or 4 reads are correct then it goes nuts!! 

 

What could be the problem? 

 

P.S. opening files, reading files always return success as TRUE 

The SD-CARD is formatted as FAT16 with default allocation size in Windows 7 64-bit! 

 

Thanks
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
505 Views

Have you verified that all of the SD-CARD files are able to be read successfully all of the time when using a PC with a proven card reader to access the data? 

 

Have you tried a different SD-CARD to see if another unit works differently than the first? 

 

Have you tried running the SD-CARD I/O at a different clock rate? 

 

I wouldn't trust the SD-CARD itself completely until it is well verified to behave properly in different readers. 

 

If you find that the SD-CARD itself is likely OK then you could check to see if design or implementation errors may be responsible for the problems -- check the configuration parameters regarding the design, check that there are no service packs for your synthesis tools that are missing and which may be responsible for causing the design to be incorrectly implemented. 

 

Also verify that the board is getting properly stable / regulated voltages and that none of the components seem to have been damaged by ESD or other situation.
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Really sorry for late reply, got busy with another design .. :( 

 

1. Yes, the data is read correctly using my laptop built in card reader! 

2. Yes, I have used a different card .. works the same as the other ones 

3. It is running at the default of 50 MHz same as my other system components, and same as all the projects which used the same driver as I. 

4. It did behave correctly in different readers 

5. All checked .. 

 

I wonder if it is related to the maximum capacity that the DE2-70 reader can handle ?? I am using 512MB and 1GB cards ..
0 Kudos
Reply