Forum Discussion

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

Custom boards and Firmware_ROM

Hello can anybody help me ?

I have modified the NIOS II CFI-drivers so they now support an 8-bit CFI-AMD-flash device.

Afterwards I have tested it using the "flash_tests"-program (through the NIOS II IDE "new project"-wizard) and it says passed to all the tests.

Finally I have tried stepping my way through the code by using the debugger and have verified that the CFI-query-routine gets the correct answer from the flash - such as device size/block size/"QRY"-string.

... in other words ......the modified flash-driver should work.

Now back to the real problem...

After compiling the project generated by mk_target_board and creating a new project based upon it I get the follwing error when trying to use the flash-programmer in the NIOS II IDE:

----------------------------------------------------------

Send (64) failed.

Unable to synchronize with target.

.....

make: *** [ext_flash_programflash] Error 6

----------------------------------------------------------

The design i'm trying to burn to the flash is a simple hello world app that works when I use the run-command. The software-project is based on a hardware image that (once again) is based on a custom board that was made using mk_target_board as described in the NIOS II Flash Programmer - User guide chapter 2, edited with the SOPC builder and finally compiled with Quartus II.

I cannot find the source-code for the firmware_ROM.hex that is "build" when compiling the project generated by mk_target_board. Is it possible to se the source code for that file? Or is it possible to somehow activate a debug-mode thats writes a couple of lines on the JTAG console just to see if the image is actually working?

The flash i'm using is a Spansion MBM29LV160BE (AMD) which supports both 8 and 16 bit operations, but it has been hardwired to operate in 8-bit mode only.

About the modified CFI-driver:

All I've really done was adding an option for a 8-bit CFI-AMD-flash device by changing the addresses in the command sequences so the flash device knows we are operating in 8-bit mode.

Can you help me solve this problem?

Regards

10 Replies

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

    I've got the same problem only with a simple epcs 4 device. I can't get my custom board to load through the flash programmer or to talk to the cpu. I can program the epcs or the JTAG, but that is it. If I find a solution I'll let you know. Altera is being their typical helpful self!

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

    from one of the engineers:

    A couple of issues here:

    If the CFI drivers required modification to work with his setup, then the flash programmer probably won't work either.

    The error he's getting isn't a "firmware can't talk to the flash" error. It's what happens when the flash programmer host can't communicate with the target.

    My guess is that this person has a couple of technical issues to solve before they can attempt to program flash. This should go to an applications engineer.

    You should point them at whatever App note talks about Quartus "optimizing" out your EPCS programmer when it's the only thing connected to your design.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello Kerri.

    You wrote:

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    The error he&#39;s getting isn&#39;t a "firmware can&#39;t talk to the flash" error. It&#39;s what happens when the flash programmer host can&#39;t communicate with the target.[/b]

    --- Quote End ---

    Do you mean that I have a JTAG-problem instead of a flash-problem?

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    My guess is that this person has a couple of technical issues to solve before they can attempt to program flash.[/b]

    --- Quote End ---

    The custom board seems to work fine. I just can&#39;t program it through the flash programmer. I have tried building a simple "hello world". It works fine. I&#39;ve added a SDRAM-driver-module. It works fine to. I&#39;ve modified the flash-drivers and successfully compiled the hello_flash-program. And it reports that all flash-tests completed successfully.

    So the custom board "seems" to be working....

    The firmware_ROM-file. Is it precompiled? That is - do my modified flash-drivers get used at all or does the flash programmer use Altera&#39;s own flash-drivers?

    ... and if the firmware_ROM is precompiled is it possible to get the source code for it so I could recompile it with my new flash-driver?

    ... or is it possible to activate some sort of debug-mode so I can se exactly HOW far the flash-programmer gets before it dies?

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

    Finally I found a way to make the flash programmer work with my custom board.

    For some reason the "flash programmer"-programmer (<- the project generated with mk_target_board) didn&#39;t work with the 25Mhz that my system runs off. Looks like Kerry was right after all ;-)

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    The error he&#39;s getting isn&#39;t a "firmware can&#39;t talk to the flash" error. It&#39;s what happens when the flash programmer host can&#39;t communicate with the target.[/b]

    --- Quote End ---

    So I added a PLL to get the standard 50Mhz. Finally I added a reset delay block before the Nios reset pin to keep the Nios processor in reset for a bit longer ... and installed NIOS II IDE 1.0.1.

    Thanks for the help everybody :-)

    So now I move on to the next problem ... ;-)

    Regards

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

    Hello,

    I seem to have the same problem but I cannot fix it the same way....

    I made a driver for the flash memory of my custom board, that seems to be OK since it passes all the tests of the flash_test program (I actually just hardcoded parameters of the CFI-flash driver because my flash is an AMD but non CFI-compliant).

    The flash programmer did not work at all (unable to synchronise with hardware), so I used a PLL (and a delay reset to allow PLL to stabilize) to increase my design frequency. My oscillator runs at 20Mhz and I tried different multiply factor. I actually don&#39;t have a perfect knowledge in PLL so I am not sure that I can multiply my input clock frequency as much as I want, but I tried 40 Mhz (2 x), 50Mhz (5/2 x), and 60Mhz(3 x).

    With 60 Mhz I dont get anything, I mean I cannot synchronize with hardware. Maybe a 3x factor for the PLL is too much and get unprecise ?

    With 50 Mhz the flash programmer "randomly" gives different messages, sometimes I get nothing, sometimes I get a message like "wrong start bit", sometimes I have a dump of a JTAG unexpected frame, so there i apparently a problem of communication.

    With 40 Mhz I always get the same message : unable to open flash device after successfully communicating with device. Does it mean that my flash driver is not as good as I thought (however it passes all tests) ? Does it mean that the JTAG communication works well (I mean has the comunication been tested and the crash happens when the NiosII tries to open the flash device) ?

    Can someone help me solve this ?

    Thanks

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

    Hello cetic.

    Some of the drivers for the Nios processor does only work at 50Mhz (or so I&#39;ve read) - I believe that could be your problem when running at 40Mhz and 60Mhz:

    http://www.altera.com/support/kdb/rd05272003_1596.html (http://www.altera.com/support/kdb/rd05272003_1596.html)

    ...but I guess the Altera guys can tell you more about that http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif

    May I ask what components you have on your custom board: Stratix or Cyclone and what kind of flash? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif

    Hope you find a way to solve your problem

    Regards

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

    Thanks for your reply,

    I use a cyclone EP1C6, and the flash I use is a 512k AMD29LV040b.

    Yours,

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

    Just another question, Goon :

    when you said you modified the driver, I suppose you were talking about the HAL driver, not the SDK driver. Have you any idea on how the firmware_ROM.hex file is compiled ? I guess it contains a part of the flash drivers, but it is pre-compiled and simply copied to the design directory when you execute the mk_target_board, so I don&#39;t understand how the modifications you made to the driver were taken into account to have the flash programmer work, unless the driver is sent to the Nios through the JTAG....

    I am obviously missing something.....

    Thanks,

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

    Hello cetic, no you&#39;re quite right. My modified HAL-driver wasn&#39;t the problem. In fact the compiler didn&#39;t take my modifications into account at all. The problems I had was caused be the PLL alone. I also installed some modified flash-drivers, but these didn&#39;t update the firmware_ROM. Sorry I can&#39;t be of more help there http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif

    A little thing to try:

    You say your flash-drivers work. Can you build an old fashioned Nios I application with a fully working GERMS-monitor? Because - I believe anyway - that would be a work around to writing to the flash since the NIOS II IDE seems to be generating flash-files too. When using the old Nios I we could burn the flash by using the command nios-run followed by the flash-file we wanted burned to flash.

    I do not know if the above solution will work ....remember I&#39;m pretty new at this http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif but hopefully some of the experts can verify this idea.

    Hope you can make it work!

    Regards

    Goon