Forum Discussion
NiosII booting from on-chip memory SPI issue
Hi all,
I am using quartus prime 19.1 lite, and I am trying to load a simple SPI program that sends SPI commands using NIOS II processor. The board that I am using is DECA Max10 Development Board. I am able to send "$HELLOABC*" continuously when I load the program in NIOS II SDK debug mode.
The problem comes when I try to generate the .hex file using "mem_init_generate" and compile the project in quartus to generate the .pof file. The .pof file that I loaded inside my FPGA is unable to send the "$HELLOABC*" continously. It only sends 2 "$HELLOABC*" and stops abruptly (as attached in spi_output.PNG )
I have tried to load a simple led and switch program that basically turns on and off an LED, and I am able to burn it into the FPGA. So I am assuming that my steps to load the .pof file containing the NIOS II application code is correct.
Hence, if anyone can enlighten me about why is this happening to my SPI program?
Below attached is the hardware of my SPI program, Nios II Application Code and spi_output image from a external logic analyzer.
I am using the test code given by Altera SPI Core in the link below.
https://www.intel.com/content/www/us/en/docs/programmable/683130/23-4/example-test-code.html
While editing it to include a while loop to send the data continuously. I have excluded the ISR to avoid any other issues.
Thanks in Advance,
Reuben Goh
Hi all,
Just an update to this issue.
The problem has been resolved by disabling the alt_printf statement in my C code. My .pof works now, and it can send the spi commands after power cycling the board.
My guess is that as there is no communication between the board and the nios2 terminal, the alt_printf pointer got lost when executing the function. Hence when loading .pof, all alt_printf must be disabled.
Regards,
Reuben Goh
45 Replies
- wwanalim_intel
Contributor
Hi,
Thank you for the reply. Please allow me some more time to investigate.
- wwanalim_intel
Contributor
Hi,
I just regenerated and recompiled the project. I tested on our side and it working. Below I will attach the folder.
- wwanalim_intel
Contributor
We recompile the design using 20.1 lite. There will be ready to test folder inside which contain pof and sof file.
- wwanalim_intel
Contributor
Hope it will be working on your side.
- reubengoh
Occasional Contributor
Hi Fathulnaim,
Thank you for your help.
I have tried loading your .pof file using 20.1 lite. After power cycling the board, I am able to get more signals now instead of 2 "$HELLOABC*", now I am getting 53 "$HELLOABC*LF", however it still stops and is not running in a continuous while loop as I expect.
I will try to compile the file again in 20.1 lite and see whether it will work.
Regards,
Reuben Goh
- wwanalim_intel
Contributor
Hi,
Thank you Reuben. Kindly updated to us after another compilation.
- reubengoh
Occasional Contributor
Hi Fathulnaim,
After compilation with 20.1 lite, I got the same result(20_1_Spi_After_Compilation) that I have been getting, 2 "$HELLOABC" and stops there.
I have notice some difference between the .hex file I have generated(proj_qsys_onchip_memory2_0_After_Compilation) and the one in your software folder.
May I know more about your working scenario? After you power cycle the board, you are able to continuously send out "$HELLOABC"? The Tx and Rx LEDs should be blinking continuously right
Regards,
Reuben Goh
- wwanalim_intel
Contributor
Hi,
Will send the work scenario later. In the mean time, can I know if you have additional board to test the file with?
Can you also test with sof + elf file manually and see the niosII terminal console if it run continuosly?
Regards,
Fathulnaim
- reubengoh
Occasional Contributor
Hi Fathulnaim,
Yes I have a max10 development kit as well. I have duplicated the issue before on another board using 19.1 lite.
Yes it works as shown in(20_1_spi_160124_nios_console). However I have to check ignore mismatched system ID and ignore mismatched system timestamp in the debug configuration as shown. If not there would be an error.
Regards,
Reuben Goh
- wwanalim_intel
Contributor
Hi,
Thank you for the feedback.
The Tx and Rx led on our board is continuosly blinking.
Would like to ask you to check on few things.
- If running .pof file, does it always stop at 53rd line?
- Does NiosII output prints using .pof continuos or stopped after 53 lines as well?
- If above is true, can you try to perform test with the simple normal hello world prints and see if that can continue.
Below is changes we made -
for max 10 ocram using xip design, you need to use the on-chip flash ram IP and the on-chip memory(RAM or ROM) IP,
enable the mem init in the on-chip memory, and disable mem init in on chip flash, and use single uncompressed
then generate and compile in quartus.
for .hex generation, we need to use the mem_ini_gen in eclipse:
https://www.intel.com/content/www/us/en/docs/programmable/683689/current/application-12184.html
- Build mem_init_generate on eclipse follow the link above. (successful built will created mem_init folder under project folder)
- Go to platform designer and on the ram editor parameter , check box for "initialize memory content" and "enable non-default initialization file".
- Generate hdl and close platform designer.
- Go to Quartus and recompile.
- wwanalim_intel
Contributor
Hi,
Do you have any updates to share about this issue?
- reubengoh
Occasional Contributor
Hi Fathulnaim,
Noted on the changes. Let me update you on the checks again.
Regards,
Reuben Goh