Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

How do I make the SD card IP core work?

Hi,

I'm trying to use the new Altera UP SD card IP core on my DE2 board, but having some problems.

Has anyone got it working yet?

I've installed the University Program package (altera_upds_setup.exe) along with Quartus and Nios 9.0 on my PC.

Then I created a SoPC with the new SD card IP core in it and wired them up. (Nios CPU, On-chip mem, SDRAM, PLL, JTAG UART, LED RED, Altera_UP_SD)

Then in Nios, I run something similar to the code in the documentation. I can see the correct 390KHz clock output using an oscilloscope, but it never reports that my card is inserted. Can anyone help me?

int main()
{
    unsigned int *aux_status_register = ((unsigned int *)(ALTERA_UP_SD_BASE + 564));
    unsigned int status;
    printf("Hello from Nios II!\n");
    printf("Address of aux_status_register: 0x%08x\n", (unsigned int) aux_status_register);
    do {  // wait for SD card to be inserted
        status = *aux_status_register;
        printf("%d %d\n", status, *aux_status_register);
        *LED_RED = status;  // display status on the board
    } while ((status & 0x02) == 0);
    printf("SD card inserted.\n");
    return 0;
}

18 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    i used the university sd card ip core, its working fine but have problem when writing data, i tried to write text file greater than 32kb but its getting corrupted, if i go less than that size, ip core is working fine. how to solve this..
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi! I'm using De1-Soc development board. It has micro SD card which connected to the HPS. Can I use Altera University Program SD Card IP cores for that board. Can any one tell me is there have any way to access Micro SD card from FPGA.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Kwuaker,

    Can i use sdcard file for detecting micro sdhc card?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Under university program Altera provides IP and Altera _up_sd is one of them.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    What SD card IP core do you mean? I've not seen any such university IP core.

    The SD card example for DE1 and DE2 boards are just a couple PIO's for the SD's DAT, DAT3, CMD and CLK lines.

    I've made my own SD card core which is more efficient. It will wait for the CPU to send a command, and then wait for the SD's response and data if needed in hardware.

    It's a pretty simple module, I've attached all the needed files to this thread if you need it.

    Hope you like it.

    --- Quote End ---

    Thanks for providing the IP for SD card. can I use this IP to store data also.

    I have VEEK-MT one of the Altera board. It has camera module attached with the board. I just want to store the images captured. It will be helpful if you guide or provide some documents.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    HAL does not work on a NIOSII with Cache, because it access the Memory with Pointers instead of direct IOWR and IORD.