Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

printf broken after restart

Altera_Forum
Honored Contributor II
1,735 Views

Hey, 

 

I built a very simple project with only nios II/f on-chip memory and jtag uart. I created a basic hello world template. 

My hardware is the MAX 10 development kit. 

Everything works including printf. 

The problem is that when I power off the board and then back on everything works but the printf does not print to console. 

If I pause in debug I can see that it is stuck on the line while ( (sp->tx_out != sp->tx_in) && (sp->host_inactive < sp->timeout) at file altera_avalon_jtag_uart_init.c 

I have to program the FPGA again for the printf to work again. 

Same thing happens with UART - after programming everything works, after shutdown and power on again - not working (Though Nios does work). 

Status register stays 0, trdy bit is therefore 0. can I reset it somehow? 

 

I tried to reset through the jtag and also from a button, doesn't solve it. 

 

What am I missing? 

 

Thanks, Eyar
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
809 Views

 

 

Hello, 

I do not have a Max10, but from my experience with DE0/DE2 the following ideas: 

 

There are 2 ways to program your fpga: 

- USB blaster (Quartus) directly in "RAM". 

- SPI flash ("ROM"), during boot program loads into FPGA and then execution starts. 

 

My experience is that sometimes SDRAM is not always empty after power down, this can be confusing, the FPGA can be empty but not the RAM. 

 

From what i understand, your program ends up directly in FPGA, this is a volatile solution. 

If you want it to work after boot you need to put it in flash. 

 

Second: Nios II license is not free, Nios will not work if you use the free version of Quartus and the board does not "see" a "live" Quartus on your PC over JTAG. 

 

Best Regards, 

Johi. 

 

0 Kudos
Reply