Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1235 ディスカッション

SD Card read fails on NIOS2 DE2 Board

Altera_Forum
名誉コントリビューター II
3,609件の閲覧回数

Hi guys, 

 

I am a university student trying to get the demonstration project working. The project that I am trying to get it to work is, DE2_SD_Card_Audio. I am able to synthesize and transfer the SOF file to the FPGA. However, when I run the NIOS 2 project on the FPGA, I get the following error,  

 

[AUDIO] set audio reg[15] = 0000h 

[AUDIO] set audio reg[09] = 0000h 

[AUDIO] set audio reg[00] = 0017h 

[AUDIO] set audio reg[01] = 0017h 

[AUDIO] set audio reg[02] = 005Bh 

[AUDIO] set audio reg[03] = 005Bh 

[AUDIO] set audio reg[04] = 003Dh 

[AUDIO] set audio reg[05] = 0000h 

[AUDIO] set audio reg[06] = 0000h 

[AUDIO] set audio reg[07] = 0042h 

[AUDIO] set audio reg[08] = 0002h 

[AUDIO] set audio reg[09] = 0001h 

[AUDIO] AUDIO_Init success 

[AUDIO] set audio reg[02] = 0078h 

[AUDIO] set audio reg[03] = 0078h 

[AUDIO] set Line-Out vol(120,120) success 

Please insert SD card. 

find sd card 

[fat]read section 0 error. 

[fat]fat_mount fail 

sd card mount fail. 

 

How do I fix this ?
0 件の賞賛
16 返答(返信)
Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

What is 

 

1. Size of SD card 

2. Speed / class of SD card 

3. Format of the SD card 

 

???
Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

SD Card size - 4Gb 

Class - Class 4 

Formatted with Fat 16, Fat 32 , both failed.
Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Try a SD Card 2 GB (maximum) formatted into FAT16 system

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Thanks for the quick response . I will tty that. In many places on the internet I read that 4 GB is max for fat16Also can I use a 4 GB SD card format it to 2 GB partition and try .

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

No I think you really need a 2Gb SD card. SD cards with capacities higher than 2Gb use the SDHC standard instead of the "regular" SD and may not be compatible with the FPGA project.

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

You must use a 2 GB SD card. 2 GB maximum. I have been through this already. The 4 GB card formatted into FAT16 does not work.

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Thanks guys! I will try it out.

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Hi, 

I am having a similar problem when trying the example software provided in the University program PDF i.e. 

printf("Insert the SD Card \n"); 

 

device_reference = alt_up_sd_card_open_dev(SDCARD_INTERFACE_NAME); 

if (device_reference != NULL) 

while(1) 

if((connected ==0) && (alt_up_sd_card_is_Present())) 

printf("SD Card Connected. \n"); 

if(alt_up_sd_card_is_FAT16()) 

printf("FAT16 file system detected!!! \n"); 

 

.... 

Each time I debug the program, the function alt_up_sd_card_is_Present() always return 0. In Altera_UP_SD_Card_Avalon_Interface.c the pointer *aux_status_register value is 0x01 which leads to 0 in the operation *aux_status_register & 0x02. 

What I don't understand is why this pointer has that particular value? 

I know the SD Card is well formatted because I can run the DE1_SD_Card_Audio example.
Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

There could be a speed problem. I had two SD cards, one is rated class 4, the other one is unrated. The unrated one could not work. They both are FAT16. I have tested both of them on DE2 + DE2-70 platforms. Some problem.

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

I have a SanDisk Ultra 2GB but as I said it works with the Audio project. Is there a way to flash a LED on the DE1 board when the SD is detected?

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Guys, I tried it with a brand new 2GB SD Card, Formatted as FAT16 system, unfortunately I still get the same error, 

 

Find SD card 

[FAT]Read section 0 error. 

[FAT]Fat_Mount fail 

SD card mount fail.
Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

I have a similar problem as wangrin. My board is also DE2 and SD card is 1GB which is formatted to FAT 16. Has anyone already solved this? Thanks in advance.

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

Same problem with 1G sd card no matter in FAT16 or FAT32, anyone could help??or where can i found reference about this problem?

Altera_Forum
名誉コントリビューター II
2,080件の閲覧回数

I have same problem. I am unable to read the SDHC micro-SD card which has been formatted to create a 512MB FAT16 partition.  

I get the SD card mount fail error like a slap on my face. 

All these reference designs I have tried on this FPGA DE2-115 board have issues with them.
iplayball27
ビギナー
2,080件の閲覧回数

I also had this problem and I was able to get it fixed by using the SD Card Association's formatting tool. For some reason, the windows formatting DOES NOT WORK. Just put your SD card into your computer, open the program, and it will format it as a FAT16 that the DE2-115 board can recognize. Don't know why the windows formatting tool doesn't work, but it doesn't. As others have mentioned, make sure you're using a plain SD card (not SDHC or SDXC), 2GB maximum.

 

Link to the tool (Windows): https://www.sdcard.org/downloads/formatter/eula_windows/index.html

iplayball27
ビギナー
2,080件の閲覧回数

ALSO: to anyone reading this, I got this to work using a 2GB SDSC Class 4 card. The Class 4 became super important after we tried using a class 2 card and got constant read failures because of the slower read speeds.

返信