Altera_Forum
Honored Contributor
8 years agosd-card interface on de1-soc board
hello
I want to interface with sd card on de1-soc board, but I want to interface with nios2 on qys. After the generator, I made the pin assignment of the sd card in the qsf file to the gpio port pin (since the original sd card was supposed to be used in the hps area), I tried to run it using eclipse after compiling and it does not work. Can not connect sd card interface to gpio in the area of ​​hps? The program shown below is a program in eclipse but can not be operated. Please, please solve it. I have connected the SD card module to the gpio port pin. Additionally, the contents of the qsf file are uploaded. gpio port pin. qsf file set_location_assignment PIN_AC23 -to SD_CMD set_location_assignment PIN_AD24 -to SD_DAT[0] set_location_assignment PIN_AE23 -to SD_DAT[1] set_location_assignment PIN_AE24 -to SD_DAT[2] set_location_assignment PIN_AF25 -to SD_DAT[3] set_location_assignment PIN_AB21 -to SD_CLOCK set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_CMD set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[0] set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[1] set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[2] set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_DAT[3] set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_CLOCK eclipse# include <stdio.h># include <system.h># include <Altera_UP_SD_Card_Avalon_Interface.h> short int sd_fileh, sd_fileh2, att; char buffer[512] = "WELCOME TO THE INTERFACE!!\r\n\0"; char data[512]; int i,pixel,att3; int main() { printf("SD Card Access Test\n"); alt_up_sd_card_dev *sd_card_dev = alt_up_sd_card_open_dev(ALTERA_UP_SD_CARD_AVALON_INTERFACE_0_NAME); if(sd_card_dev != 0) { if(alt_up_sd_card_is_Present()) { if(alt_up_sd_card_is_FAT16()) printf("Card is FAT16\n"); else printf("Card is not FAT16\n"); sd_fileh = alt_up_sd_card_fopen("test1.txt", true); if(sd_fileh < 0) printf("Problem creating file. Error %i", sd_fileh); else { printf("SD Accessed Successfully, writing data...\n"); int index = 0; while (buffer[index] != '\0') { alt_up_sd_card_write(sd_fileh, buffer[index]); } printf("Writing Done!\n"); printf("Closing File 1...\n"); alt_up_sd_card_fclose(sd_fileh); } sd_fileh2 = alt_up_sd_card_fopen("test2.txt", false); if(sd_fileh2 < 0) printf("Problem creating file. Error %i", sd_fileh2); else { printf("SD Accessed Successfully, reading data...\n"); printf("Data read from the Text file = \n"); for(i=0;i<12;i++) { data = alt_up_sd_card_read(sd_fileh);printf("%c",data); } printf("\nClosing file..."); alt_up_sd_card_fclose(sd_fileh2); printf("Done!\n"); } } } return 0; }