Results 1 to 8 of 8

Thread: "Hello World!" keeps looping. Anyone know why?

  1. #1
    Join Date
    Feb 2014
    Posts
    76
    Rep Power
    1

    Default "Hello World!" keeps looping. Anyone know why?

    Hi,

    I have a system created in Qsys with a Nios , on-chip RAM, DDR3 controller, JTAG UART etc.

    I have specified the Reset vector and exception vector memory for the NIOS to be in the on-chip RAM only.

    The DDR3 controller Avalon mm base address is 0x0000_0000 and the end address is 0x3FFF_FFF, and I want to only use this memory for data so I would expect to be able to use it all.

    The strange this is , when I run my program below which tries to write and read to the DDR3 RAM, "Hello World!" just keeps printing out on the terminal forever and the program doesn't do anything else. If however, I change the ddr_base address in the code to 0xFFF, it runs fine. So what is being used in in the DDR3 memory from 0x0 ? Why should this happen if my code (.text etc) is being loaded only into the on-chip RAM. I appreciate if anyone knows the reason as to why or point out where i'm going wrong? Thanks

    Code:
    #include <stdio.h>
    
    
    int main()
    {
    	printf("Hello World!\n");
    	long* ddr_base = 0x0;
    
    
    	int i;
    
    
    	for (i = 0; i <50; i++)
    	{
    	  *ddr_base++ = i;
    	}
    
    
    	ddr_base = 0x0; // pointing back to base of DDR3
    
    
    	for (i = 0; i <50; i++)
    	{
    	  printf("word %u = %lu\n", i, *ddr_base);
    	  ddr_base++;
    
    
    	}
    
    
    	printf("done\n");
    
    
      return 0;
    }

  2. #2
    Join Date
    Jan 2014
    Posts
    33
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    mulligan22,
    you might want to include your system.h library ( in your main) which shows the proper addresses to your system. Make sure that your indeed writing to the correct address. The code to me looks like it shouldn't loop over..

    -Trukng

  3. #3
    Join Date
    Feb 2014
    Posts
    76
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    Quote Originally Posted by Trukng View Post
    mulligan22,
    you might want to include your system.h library ( in your main) which shows the proper addresses to your system. Make sure that your indeed writing to the correct address. The code to me looks like it shouldn't loop over..

    -Trukng

    Yes normally I would include the system.h , but in this case I am just creating a pointer and pointing it directly to the memory address 0x0 which is the base address of the DDR3 specified in Qsys. "Hello World!" just keeps looping forever on the terminal and doesn't go any further in the program.. strange. If like I said, change the ddr_base to 0xFFF and start writing from there , the program works ok. It seems from 0x0 to 0xFFF in DDR3 is being used for something, but why would it cause this looping?

    Could it be that part of my program is being loaded to the DDR3 aswell as the on-chip RAM? I wouldn't expect this tho. The on-chip RAM is only where I want the program stored and it is at base address 0x4000_0000. The Nios only has the instruction master connected to the on-chip RAM. Any ideas?

  4. #4
    Join Date
    Jan 2014
    Posts
    33
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    Mulligan22,
    I think to start troubleshooting, you might want to remove the DDR3 and make sure nios is working properly. I usually would check the reset vector and the memory vector and make sure they are indeed pointing to the on chip memory. I usually have the data master and instruction master connected to the on chip memory that i want the nios to use. If nios starts properly and you dont see the looping, you can rule out that its a nios problem. After that you can add the DDR3 ip core and see if you get the same issue. Ive seen something similar before with this but i dont recall the solution, i think their was a setting in the BSP editor that wasnt pointing to the correct memory. Let me know how that goes.

    -Trukng

  5. #5
    Join Date
    Oct 2015
    Posts
    18
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    Hi, I seems that the system is keep resetting by it self, can you remove most of the other component and make this simple as possible first, so to ensure the nios is running smoothly.

  6. #6
    Join Date
    Oct 2015
    Posts
    229
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    Agree... looks like auto reset here!

  7. #7
    Join Date
    Nov 2015
    Posts
    11
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    Quote Originally Posted by pororo View Post
    Agree... looks like auto reset here!
    Hi,

    I am facing the same issue.. Can you please let me know what did you do to solve this problem??

  8. #8
    Join Date
    Feb 2015
    Location
    Portugal
    Posts
    95
    Rep Power
    1

    Default Re: "Hello World!" keeps looping. Anyone know why?

    I don't know if this could be the reason, but if your code seems like the above, I would expect an infinite loop somewhere ( e.g "while(1)" ) within the main() function.

Similar Threads

  1. is "for loop" in counter looping according clock cycle?
    By jhwong in forum Verilog and System Verilog
    Replies: 4
    Last Post: March 8th, 2015, 09:33 PM
  2. Using Cyclone V qsys eclipse "hello world" error
    By strutter in forum Quartus II and EDA Tools Discussion
    Replies: 0
    Last Post: October 2nd, 2014, 06:14 AM
  3. Replies: 1
    Last Post: April 11th, 2014, 01:34 AM
  4. Replies: 4
    Last Post: March 13th, 2014, 12:20 AM
  5. error:Port "enable" does not exist in primitive "latch" of instance "u0"
    By MR_Naidu in forum Quartus II and EDA Tools Discussion
    Replies: 5
    Last Post: February 25th, 2012, 10:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •