Another Crash in vListInsert() Topic

jmsmith86 wrote on Wednesday, November 25, 2015:

MCU: PIC32MX695F512L
FreeRTOS Version: 8.2.1

Like it says in the subject, I am getting into an infinite loop within vListInsert(). Here is what I know:

  1. configASSERT is defined
  2. ISR priorities are correct
  3. All interrupts are defined with SOFT
  4. Assembly interrupt wrappers are used with all interrupts where portSAVE_CONTEXT and portRESTORE_CONTEXT are executed
  5. Stack overflow checking is enabled
  6. Call to uxTaskGetStackHighWaterMark() on all tasks after crash return value greater than 100
  7. I’m fairly certain that the only places where enter/exit critical is used is when multiple values need to be set/retrieved atomically (no API functions executed)
  8. All queues and semaphores are properly initilized

The issue occurrs when I remove and insert a hot-swappable device several times. I traced the issue to a function which calls xQueueSendToBackFromISR(). I have verified that this is indeed always being called from an ISR. Everything works fine once I remove that function call. There are other calls within the same ISR which access the same queue with no issues. I can do without that line of code, so removing it would not be a problem to me. However, it concerns me that I don’t understand the reason why this would be causing a crash. Is there anything else that I can do to figure out what is happening?

rtel wrote on Wednesday, November 25, 2015:

All interrupts are defined with SOFT

What is SOFT?

jmsmith86 wrote on Wednesday, November 25, 2015:

I always seem to figure things out right after posting… The thing that was processing that queue item was doing something invalid. Of course it was number 7. There is potential for calling an API function while in a critical secion, which is what was happening. Oops! Sorry for the post.

jmsmith86 wrote on Wednesday, November 25, 2015:

That’s Microchip’s new ISR calling convention. The ISR can be declared “ISR1AUTO”, “ISR1SRS”, or “ISR1SOFT”. I assume SOFT is more compatible with FreeRTOS, but I haven’t read enough into it to understand what’s what. It may have been superfluous information.