Forum Discussion

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

Programming NIOS II code to EPCQ in Quartus 13.1

Hello

I'm having trouble with NIOS II code executing from an EPCQ x4 flash chip (p/n Micron N25Q256A) after a power cycle. I've followed the following guideleins to boot from EPCQ or EPCS (from Altera rd11192013_118):

http://www.altera.com.cn/support/kdb/solutions/rd11192013_118.html

I have taken the following steps (in order). According to Altera, steps 6-15 would be required *each* time I make a change to either hardware OR software and I want to program to non-volatile memory (i.e. when I do not want a JTAG cable connected to hardware). This is very time consuming. Am I missing something fundamental?

1. Added lines STRATIXV_CONFIGURATION_SCHEME "ACTIVE SERIAL X1" and ENABLE_INIT_DONE_OUTPUT ON to project qsf

2. Deleted db and incremental db in project directory

3. Pointed the reset vector of NIOS to an EPCS/EPCQ controller (connected in Qsys, with a locked base address of 0x00)

4. Pointed the exception vector to on-chip-memory

5. Generated Qsys design

6. Compiled in Quartus II

7. Converted programming file from sof to jic, specified active serial x4, added the correct p/n for the flash loader, and turned on compression (as requested by solution document)

8. Generated a jic

9. Successfully programmed and verified EPCQ

10. Power cycled - I have an LED turn on when the FPGA configures, and this LED turned on

11. Generated flash files for hardware with sof2flash --input=hw.sof --output=hw.flash -epcq --verbose

12. Generated flash file for software with elf2flash --input=sw.elf --output=sw.flash --epcs --after=hw.flash --verbose (this is supposed to be "epcs" even though the chip is "epcq")

13. Used nios2-configure-sof (command line programmer) to configure FPGA with hw.sof

14. programmed the device using the Nios II flash programmer using nios2-flash-programmer --epcs --base=0x00 hw.flash (the epcq needs to be programmed with the .flash file even if it had been programmed with quartus programmer earlier in .jic format)

15. nios2-flash-programmer --epcs --base=0x00 sw.flash

I have another blinking LED running in main() in my Nios C code. After running nios2-flash-programmer, the processor enters reset and the LEDs blink.

However, after a power cycle, all pins are in tri-state and neither the FPGA nor the Nios processor will configure.

Am I missing something?

19 Replies

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

    Hi Jens,

    Thank you for your description. What the C code in your example? Where and when this is executed?

    My issue - if I using JIC file and configure EPCQ through the Quartus programmer, fpga is started successfully, but if I use Flash Programmer fpga fabric (not nios) has not started. I'm following the solution http://www.altera.com/support/kdb/solutions/rd11192013_118.html but not succsefull
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jens,

    Thank you for your description. What the C code in your example? Where and when this is executed?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jens,

    thanks for your answer.

    As I understand this solution http://www.altera.com/support/kdb/solutions/rd11192013_118.html is using JIC flash programming only for enabling 4 bytes addressing mode. So is it possible to enable 4 bytes addressing mode by the call alt_epcs_flash_init() in my nios project? I want to get configuration data via uart and write configuration flash from Nios via epsc_controller. I can not using JIC programming every time I want to update configuration.

    And one more question. I have some misunderstanding of nios boot in case of reset vector points on epcs controller start address. In this case some boot code must placed in flash start address, but SOF file(converted to *.flash) with configuration data placed in here. So how it is work?

    Best Regards,

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

    Bootloading process is clear now)

    Enabling 4 bytes addressing mode of EPCQ256 is still in the research process
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have a similar setup, but I am just trying to use the NIOS to program the PROM for future RTL updates so my application is very small and fits in block RAM so no separate application image is needed. Here is what I learned:

    • The JIC must be set to Active Serial X1 mode. If set to X4 mode any future FPGA images converted with sof2flash will not work. The JIC will set the addressing mode and the dummy clocks which varies between X1 and X4 and breaks configuration if not set correctly.

    • If you are using a Stratix V AB device, or possibly any V series, and the Altera flash software library you must go into the code and disable the reverting to 3-byte addressing mode. I found this in the epcs_commands.c file, which appears to have been written before V series devices came out and never updated. If you don't do this you need to power cycle the system to reset the PROM's addressing mode to whatever the JIC configured.

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

    --- Quote Start ---

    My issue - if I using JIC file and configure EPCQ through the Quartus programmer, fpga is started successfully, but if I use Flash Programmer fpga fabric (not nios) has not started.

    I want to get configuration data via uart and write configuration flash from Nios via epsc_controller. I can not using JIC programming every time I want to update configuration.

    --- Quote End ---

    Hi Sergey.

    May I invite you to the Russian-speaking forum for discussion of this issue? I have resolved some part of problem with remote system update, but I have some more questions. Main question what is wrong with RBF-file generation? If I use RBF-file system don't start after power on. If I remove header from JIC-file and load it into EPCQ by Nios everything is OK. I use Quartus II version 14, p/n 5CEFA9.

    Best Regards,

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

    Hi Andrei!

    Yes of course we can discuss it in Russian-speaking forum. I general I solved the problem for me. As you mentioned, I use JIC without header and tail. It works.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi Andrei!

    Yes of course we can discuss it in Russian-speaking forum. I general I solved the problem for me. As you mentioned, I use JIC without header and tail. It works.

    --- Quote End ---

    Hi Sergey.

    Please, read your private messages.