Forum Discussion

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

Configuring Cyclone IV E over serial interface - INIT_DONE don't go high

Hello everyone,

I'm configuring a Cyclone IV E over serial interface with a rbf file that I have stored in my MCU's flash memory. It was working fine till I replaced the rbf for a new version (larger). Now the INIT_DONE pin of the fpga won't go high. I have no idea why. It there some sort of a example code how to configure these devices over serial interface? Here's the code that I'm using. It seems to comply with the documentation. Or what could be wrong with it? Thanks for any suggestions.

void fpgaConfig(void){
    int i;
    int length;
    uint16_t temp;
    spiDAT1_t dataConfig;
    uint32 PC0Backup;
    gioSetBit(spiPORT1, SPI_PIN_SOMI, 0);    // nConfig low
    delay(0xffff);    // wait
    gioSetBit(spiPORT1, SPI_PIN_SOMI, 1);    // nConfig high
    while(gioGetBit(spiPORT1, SPI_PIN_ENA) == 0);    // wait until nStatus is high
    PC0Backup = spiREG1->PC0;
    spiSetFunctional(spiREG1, PC0Backup | (1U << SPI_PIN_SOMI));    // set nCONFIG as SPI pin
    dataConfig.CSNR = 0;
    dataConfig.CS_HOLD = 0;
    dataConfig.DFSEL = SPI_FMT_0;
    dataConfig.WDEL = 0;
    length = sizeof(designData);
    for(i = 0; i < length; i++)
    {
        temp = designData;
        spiTransmitData(spiREG1, &dataConfig, 1, &temp);
    }
    delay(0xfffff);    // wait
    while(gioGetBit(spiPORT2, SPI_PIN_CLK) == 0);    // wait until CONF_DONE is high
    while(gioGetBit(gioPORTB, 7) == 0);    // wait until INIT_DONE is high
    spiSetFunctional(spiREG1, PC0Backup);    // put back the original value. This is important to make reconfiguration possible
}

2 Replies

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

    Do you give a number of extra clocks after all configuration data has been clocked in? I usually add 64 (or so) dummy configuration clocks with 'dummy' data

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

    So it's turned out to be an error in the Device settings. The original project had different settings than the new one. It's working now again. Thanks