I troubleshot a very frustrating problem last night regarding queues. Here’s what I’m using: Olimex SAM7P256S CPU, ARM SDT 2.51 compiler, and some custom tweaks to FreeRTOS for the SAM7S32P Olimex board. CPU Is running at about 50Mhz (slightly lower because of UART divisor alignment).
I have a UART driver that handles both UARTs. For transmission, I have a 2048 byte queue for each UART. Foreground code queues things up with xQueueSend, and inside the ISR, it calls xQueueReceiveISR to grab the data.
I have a very simple test - take data received from one UART and send it out the other. UART 0 Is the UART doing the transmitting, and UART 1 is the UART doing the receiving.
Anywhere between about 3 seconds and 5 minutes of operation from reset, the whole system locks up. I don’t have a JTAG debugger so I can’t see what’s going on, but everything halts (that’s what the data abort/prefetch abort, etc… handlers do).
So… I modified the UART transmit routines to use a ring buffer. It has now been running for almost 24 hours solid without any issue. Not conclusive, but if I don’t use queue transmitting/receiving in my ISR, I never see any problems.
There’s not a lot going on here, but I’m wondering if there’s anyone who might have any ideas as to what to look for. I can see a lot of possibilities - everything from bugs in FreeRTOS (unlikely) to buggered interrupt disabling (still unlikely, but more likely than FreeRTOS bugs). Thoughts?