Forum Discussion

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

NIOS II IDE overwrites SDRAM

Hi, I need some data on SDRAM, data is in a .hex file created with matlab and using Altera Control Panel I writed this file on SDRAM, here all is OK, but using NIOS IDE software in debug mode I see the sdram content this is 00000 (before I run the program) , why ??? How can I do to avoid this ??? :confused:

Help me please .....

6 Replies

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

    Which SDRAM are you using?

    Some SDRAMs work in page burst mode. So, you cant read or write into them taking length of whole memory. You will have to write in each page separately. If you write taking whole memory, then there are chances of overwriting
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    normaly between the sdram and the nios is the sdram controller ip

    this ip controls the read and write access from and to the external memory

    all these accesses could be random or sequential type

    why shouldn't it be possible to write the complete memory if the sdram controler ip takes care about the external sdram interface (refresh, access ... ) ???

    i have done lots of designs where a couple of masters read and or write to a sdram slave memory.

    if the memory content is correctly written with the control pannel (how do you check that ?) but is changed (overwritten?) when debugged with the ide, then it could be that the ide, or the startupcode of the application initials the complete memory. (in that case with 0)

    did you try to read the memory back after writing the hex file ?

    next thing, after you have written your hex data into sdram, is the fpga reconfigured ? do you load a new fpga image ? if yes then the sdram conroller ip is not present during configuration and so no refresh cycle is performed during that time.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm using DE1 on board SDRAM, first I store the .hex file with control panel (after programing fpga with control panel .sof file), in control panel I can write and read SDRAM; after, I program the fpga with my own design .sof file (NIOS with timer,pio,sram, sdram, etc, etc) and load my c program with nios II IDE, but now, like you say me, I think the problem is the data refresh ........ but now the question is: How I can store data (in this case from a external file created in matlab) and use this data last time????. :confused:

    There is a way to write data to sdram from Nios IDE directly ???

    (sorry for my bad english)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    well my english ist not better ;-)

    so okay then we might have the reason. you download a new sof after the hex file and during that time the external sdram device is not refreshed and the sdram clock is not provided during that time. so the external sdram can loose its contend, and does in your case. imagine the refresh is round about every ~7uSec

    so as you already wrote you must find a way to store your hex file contend after downloading the sof file.

    as i do not use the ide (well not soooo much) i can't say if there is a possability to download a hex file directly into external memory. but maybe you can include this data into your application an initialised memory content.

    hopefully somebody else knows how to update external memory locations with the ide.

    at least you know now why the data is lost.

    regards.