Forum Discussion
SD Card read fails on NIOS2 DE2 Board
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 ?
16 Replies
- iplayball27
New Contributor
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
New Contributor
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.
- Altera_Forum
Honored Contributor
What is
1. Size of SD card 2. Speed / class of SD card 3. Format of the SD card ??? - Altera_Forum
Honored Contributor
SD Card size - 4Gb
Class - Class 4 Formatted with Fat 16, Fat 32 , both failed. - Altera_Forum
Honored Contributor
Try a SD Card 2 GB (maximum) formatted into FAT16 system
- Altera_Forum
Honored Contributor
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
Honored Contributor
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
Honored Contributor
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
Honored Contributor
Thanks guys! I will try it out.
- Altera_Forum
Honored Contributor
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.