UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor begleysm
Visitor
6,190 Views
Registered: ‎08-12-2008

Problem with apparent skipping of instructions when using the UARTlite

Jump to solution

First off, I'll say that I don't know exactly what is causing this problem so I am throwing it out there to see if anyone has had a similar experience.

 

I am using a Memec Design V4FX12LC dev board (has a Virtex-4 XCv4FX12 with a built in PowerPC processor) .  I am using the BRAM for my instruction and data storage.  The system is designed to send and receive UDP packets through the built in Ethernet port and communicates with a PC.  I have, successfully, demonstrated that the board can send and receive UDP packets.  I am using the uartlite & emaclite cores with some custom code on top of it.  User I/O (w/ the FPGA board) is done through RS232 and a terminal emulator.  I have used both the built-in RS-232 to USB solution and the straight RS232 Serial Port with similar results.  I have also tried using the PPC at 100 Mhz & 300 MHz (100 MHz is my base system).

 

The problem that I am having is that the system appears to "skip" entire lines of code.  I will often not receive the output of print statements at all.  For instance, I have "while loop started" and "while loop ended" print statments at the beginning and end of the main loop (which checks for user input, sends a packet if the correct input found and then goes on to check for new received UDP packets and handles them).  Often times the "while loop started" will print over and over without the "while loop ended" or visa-versa.  In addition, sometimes the payload of the UDP packet will be printed fine (say, 000004) but sometimes garbage will be appended onto the end (say, 000004%$@^), where "%$@^" represent non-ascii characters.

 

I tried switching my print statements to xil_printf which, actually, seemed to help, but not come anywhere close to fixing the problem.  I also tried putting in a sleep(1) at the top of the while loop, this did not help either.

 

As you can see, I am pulling at straws as I try to find the problem so any help would be greatly appreciated.

 

Thanks,

Sean

0 Kudos
1 Solution

Accepted Solutions
Visitor begleysm
Visitor
7,076 Views
Registered: ‎08-12-2008

Re: Problem with apparent skipping of instructions when using the UARTlite

Jump to solution

Ok I finally figured it out.  The problem was a large array designed to receive the incoming UDP packet that was declared in main().  It was, therefore, put on the stack and this was causing, something, (either something else on the stack or something on the heap) to bleed over into enemy territory.  I fixed it initially by placing the array outside of main and declaring in static to put it in instruction memory instead of data memory and now plan and going about increasing the stack size.

 

Sean
0 Kudos
3 Replies
Observer ifen_gmbh
Observer
6,173 Views
Registered: ‎07-11-2008

Re: Problem with apparent skipping of instructions when using the UARTlite

Jump to solution

Hi,

 

just an idea. Which optimization level (compiler) do you use?

Does it work without optimization? Do you use "volatile" statements for hw register access (or do you use only the xilinx drivers)? If not, this could cause problems by compiler optimization?

0 Kudos
Highlighted
Visitor begleysm
Visitor
6,170 Views
Registered: ‎08-12-2008

Re: Problem with apparent skipping of instructions when using the UARTlite

Jump to solution

I'm building my app from within XPS, I browsed around and didn't find anything about optimization.  Do you know where that option is located?

 

I havnt used any "volatile" statements, just standard c declarations of variables.  I havnt accessed any registers directly either.  The code that im using runs on the PowerPC.

 

Sean

0 Kudos
Visitor begleysm
Visitor
7,077 Views
Registered: ‎08-12-2008

Re: Problem with apparent skipping of instructions when using the UARTlite

Jump to solution

Ok I finally figured it out.  The problem was a large array designed to receive the incoming UDP packet that was declared in main().  It was, therefore, put on the stack and this was causing, something, (either something else on the stack or something on the heap) to bleed over into enemy territory.  I fixed it initially by placing the array outside of main and declaring in static to put it in instruction memory instead of data memory and now plan and going about increasing the stack size.

 

Sean
0 Kudos