Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
774 Views

Strange behavior of NIOS II IDE

Hello, I can't get my c code working on NIOS II processor, implemented on DE1. I'm using 9.1 sp2 ver. of NIOSII IDE. The same code with the same hardware sometimes works, sometimes not and the terminal writes: nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) and nothing more happens. I'm using SRAM. I tried using a PLL to have a clean clock signal, I don't know what to do to get things working... Do you have any suggestion? Thank you PS: the code i'm talking about is this  

<code># include "sys/alt_stdio.h"# include "system.h"# include "altera_up_avalon_rs232.h"# include "altera_avalon_pio_regs.h" 

# define CLOCK_MHz 27 

 

static void delay_us(int us); 

static void delay_clk(int clk); 

 

int i; 

int times; 

 

static void delay_us(int us) 

times=CLOCK_MHz*us; 

for(i=0;i<times;i++){;}  

static void delay_clk(int clk) 

times=clk; 

for(i=0;i<times;i++){;} 

static void initial_message() 

alt_putstr("*****************************\n"); 

alt_putstr("**** Hello from Nios II! ****\n"); 

alt_putstr("*** AWGN channel emulator ***\n"); 

alt_putstr("*****************************\n"); 

 

int main() 

{  

initial_message(); 

delay_us(50); 

alt_putstr("Hello from Nios II!\n"); 

alt_up_rs232_dev *serialPort = alt_up_rs232_open_dev(RS232_NAME);  

if(serialPort == NULL )alt_putstr ("Error: could not open rs232 \n"); 

 

 

<\code>
0 Kudos
6 Replies
Altera_Forum
Honored Contributor I
40 Views

Hi, 

 

does this kind of behaviour also happen if you try to debug helloworld or something like that? 

 

Does this happen after the first download after power up or only if you downloaded your code several times?
Altera_Forum
Honored Contributor I
40 Views

 

--- Quote Start ---  

Hi, 

 

does this kind of behaviour also happen if you try to debug helloworld or something like that? 

 

Does this happen after the first download after power up or only if you downloaded your code several times? 

--- Quote End ---  

 

 

Thank you,  

it happens also with very simple codes: I reduced many times my code to the bare minimal to understand if it was my fault. Usually I a simple hello world works but when I add simple things as a a variable that copies the switch value to the corresponding led it doesn't work anymore (it compiles and loads without errors but it doesn't print "Hello world" and doesn't reads the switches...even the reset KEY on the board doesn't work and I must stop from the IDE). I found a similar problem on alteraforum but the guy said he solved the problem changing the clock from 50MHz to 100MHz...I tried 24,50,27,108 MHz with a PLL and I'm shure it is not a clock issue.
Altera_Forum
Honored Contributor I
40 Views

 

--- Quote Start ---  

Hi, 

 

does this kind of behaviour also happen if you try to debug helloworld or something like that? 

 

Does this happen after the first download after power up or only if you downloaded your code several times? 

--- Quote End ---  

 

 

Thank you,  

it happens also with very simple codes: I reduced many times my code to the bare minimal to understand if it was my fault. Usually I a simple hello world works but when I add simple things as delay routine it doesn't work anymore (it compiles and loads without errors but it doesn't print "Hello world" and even the reset KEY on the board doesn't work so I must stop from the IDE). Generally the problem comes when downloading many times, if I use a working code. 

I found a similar problem on alteraforum but the guy said he solved the problem changing the clock from 50MHz to 100MHz...I tried 24,50,27,108 MHz with a PLL and I'm shure it is not a clock issue. 

I must say that my NIOSII IDE is inherently instable, in fact many times it crashes...I tried reinstalling but nothing.
Altera_Forum
Honored Contributor I
40 Views

Hi, 

ok so if i got you right, the problem only occurs if you're trying to access any perophal register, like a pio. So there might be a problem with your hardware design and therefore with your BSP. 

Do you have any example designs for your HW? Try using one of these, with accessing registers. e.g. fire up a led or something. 

 

Have you updated your BSP everytime you generated a new HW design?
Altera_Forum
Honored Contributor I
40 Views

 

--- Quote Start ---  

Hi, 

ok so if i got you right, the problem only occurs if you're trying to access any perophal register, like a pio. So there might be a problem with your hardware design and therefore with your BSP. 

Do you have any example designs for your HW? Try using one of these, with accessing registers. e.g. fire up a led or something. 

 

Have you updated your BSP everytime you generated a new HW design? 

--- Quote End ---  

 

 

Hi man 

I tried an example but the cyclonII I have is a bit different and I can't download the .sof 

Every time I modify my hardware it recreates all system description files automatically, I think I should get a timestamp error on console if the hardware isn't the right one. What do you mean with "updating the BSP"? 

 

 

Thank you
Altera_Forum
Honored Contributor I
40 Views

Hi, 

 

when you generate your Nios, either with the sopc builder or qsys, you'll get a so called sopc.info file which you initially used to build your BSP. So if you now change anything in your Nios, you have to overwrite this initial sopsinfo file, if it isn't done automatically, and then right click on the BSP in the eclipse's project explorer and under the menu "Nios II" there should be something like Generate BSP ... 

 

Maybe try this.  

 

But you said sometimes you can access periphal, so you should be fine there. Are your problems dependant from the system up time => FPGA gets warm?  

Or do you get these problems also right after power up?
Reply