Forum Discussion

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

Need help on Remote system upgrade of CYCLONE III..urgent

Hi all,

I have a cyclone III device and a serial configuration device(EPCS flash).

I have a factory image (SOF1) programmed at the EPCS flash address 0x00000000.

I have an application image(SOF2) programmed at the EPCS flash address 0x000A0000.

Whenever i boot up, the factory image (SOF1) loads in the FPGA. The software application of the SOF1 triggers reconfiguration at the EPCS flash address 0x000A0000 to configure the FPGA with SOF2.

Assume that SOF2 is now configured and its corresponding software application is running.

Now at this point i need to reset back to factory image without power cycle.

How is this possible?

which registers should i access to hit a reset to the factory image?

As per the altera document once SOF2 is loaded we wont be in the factory mode and hence i guess i cannot trigger reconfiguration for the SOF1 at 0x00000000. If this is the case how can i reset back to SOF1 without powercycle.

Please help.

Thanks a lot in advance

8 Replies

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

    I did it by including the remote-update component in my main design and using it in my reset function to trigger the reconfiguration from the beginning of the EPCS where my factory image lies.

    
    g_EncoderBox.CycloneIII_Reconfig(REMOTE_UPDATE_CYCLONEIII_0_BASE, // Remote Update Controller Base
    EPCS0_BASE, // Flash Base
    0x00000000, // offset in Flash where the factory image is 
    0, // Watchdog Timout
    8); 
     
    CycloneIII_Reconfig(int remote_update_base, int flash_base, int reconfig_offset, int watchdog_timeout, int width_of_flash )
    {
    //close and umount sdcard 
    printf("closing log\r\n");
    g_SDCard.closeLog();
    int offset_shift;
    // Obtain upper 12 bits of 29-bit watchdog timeout value
    watchdog_timeout = watchdog_timeout >> 17;
    // Only enable the watchdog timer if its timeout value is greater than 0.
    if( watchdog_timeout > 0 )
    {
    // Set the watchdog timeout value
    IOWR( remote_update_base, 0x2, watchdog_timeout );
    }
    else
    {
    // Disable the watchdog timer
    IOWR( remote_update_base, 0x3, 0 );
    }
    // Calculate how much to shift the reconfig offset location:
    // width_of_flash == 8->offset_shift = 2.
    // width_of_flash == 16->offset_shift = 3
    offset_shift = (( width_of_flash / 8 ) + 1 );
    // Write the offset of the desired reconfiguration image in flash
    IOWR( remote_update_base, 0x4, reconfig_offset >> offset_shift );
    // Perform the reconfiguration by setting bit 0 in the
    // control/status register
    printf("Get ready for some cool magic!\r\n");
    printf("Wait for it...........\r\n");
    usleep(100000);
    printf("3\r\n");
    usleep(100000);
    printf("2\r\n");
    usleep(100000);
    printf("1\r\n");
    IOWR( remote_update_base, 0x20, 0x1 );
    return( 0 );
    

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

    Hi mitch,

    thanks a ton for the reply.

    Here you have triggered a reconfiguration from the factory mode to configure the FPGA image present at the flash location reconfig_offset. Assume Once this FPGA image present at reconfig_offset is configured its software application is running. At this point i want a logic to configure back the Factory FPGA image present at the location 0x00000000 into the FPGA.

    When the reconfig_offset image is configured we know we will not be in factory mode and as per the altera document we cannot trigger a configuration of a FPGA image in this mode. Hence we cannot trigger a configuration at the offset 0x00000000. Is there any way i can configure back the factory image.

    Thanks a lot in advance.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm not sure I understand what you want!?

    But What I have done is to use the remote_update in both the factory image as well as the user image. In my case the factory is at 0x00000 and the user image at 0x00200000.

    When I power up my system the factory image automaticaly load the user image by using the above call with address 0x00200000. In this case my user image is loaded.

    When my user image is runing and receives an reset command for example through the can interface I call the same function but in this case with address 0x000000. This results in my factory image being in loaded followed by the user image.

    As I understand your problem, this is more or less what you want to do. So you just have to add the remote update to your SOF2 and call the reconfiguration function whenever you want to get back to SOF1.

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

    Thanks a lot mitchp. Thank you so much. This is exactly what i wanted. I will try with the method you have mentioned and will get back to you....:)

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

    Mitch, I think he's reading the data sheet as I did last year. If you are in the user image, the data sheet indicates that most of the Remote Update registers are not accessible in this user image configuration. Did we both miss something?

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

    maheshv_1203, please do not cross-post questions to every sub-forum

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

    @Billa....if they are not accessible then how to go configure factory image from user image?

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

    Do you refer to AN548?

    All the register are accessible from both designs if they include the remote update and are configured for remote configuration.