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: 
Observer zdicklin
Observer
384 Views
Registered: ‎05-13-2018

Microblaze UART ISR hangs on even-numbered characters

Reposting, as this was marked as spam for some reason...

I've been setting up an application that reads data from the UART with ISR. I wrote a simple echo application, but it behaved a little weird and inconsistent. Like, sometimes it would work great, others just kind of hang. To dumb it down further for troubleshooting and make sure it's not an issue of the ISR handing, I removed the echo and just have a bank of LEDs counting up each time the ISR is called.

With a bit of research, I found it hangs consistently on keys with even-numbered ASCII values. For example, if I hold down the 'A' key, the ISR is called repeatedly as expected. If I jam on the 'B' key, it might get called a few times but then eventually hang. Sometimes it won't receive at all.

I found all these letters with even-numbered ASCII values all jam eventually:

b 62
d 64
f 66
h 68
j 6a
l 6c
n 6e
p 70
r 72
t 74
v 76
x 78
z 7a

All of their odd-numbered counterparts work great.

This is only an issue when using the interrupt. I have no issue receiving data if I do it in my main loop.

Any thoughts? I've tried messing with connection settings (flow control, etc), the UART AXI clock, etc, but no luck.

 

Board is an Arty A7

0 Kudos
3 Replies
Observer zdicklin
Observer
353 Views
Registered: ‎05-13-2018

Re: Microblaze UART ISR hangs on even-numbered characters

Another clue- I can only press an even-numbered character (b, d, f, etc) 15 times before they're unavailable. It can be any combination of these keys: 8 B's, 4 D's, 4 X's, and it stops. Then I have to press odd keys to accept them again.

Here's a video of this in action:

https://www.icloud.com/photos/#08ktjuSEiNl-dwoter92CzVew

 

Also, I attached my code.

0 Kudos
Scholar dgisselq
Scholar
305 Views
Registered: ‎05-21-2015

Re: Microblaze UART ISR hangs on even-numbered characters

@zdicklin,

Is there any way you can get a trace from your design?  Something showing what is going on, and that won't hang when the microblaze hangs?

Dan

0 Kudos
Observer zdicklin
Observer
218 Views
Registered: ‎05-13-2018

Re: Microblaze UART ISR hangs on even-numbered characters

Alright, I figured it out. My argument to the UART interrupt handler was a UINTPTR type.

void uart_int_handler(UINTPTR *baseaddr_p) {

   ... do stuff

}

All the addition is done with macros. The status register offset is 8 - which when added to a UINTPTR is 32 bytes- which memory maps back to the RX FIFO register. So, an odd-numbered character in the FIFO meant "Valid RX FIFO Data", and an even-numbered one meant "No RX FIFO Data" ;)

 

By changing the type to something else (void*), the addition of 8 is just 8 bytes, correctly mapping to the status register.

0 Kudos