pbeamtn wrote on Thursday, June 17, 2010:
I have introduced some weird bug into previously working code, and I can’t for the life of me find it.
In an ISR, I have the following code:
if (xQueueSendFromISR(scan_q, &scandata, &TaskWoken) != pdTRUE) {
which basically just passes a pointer to a task. scan_q is created with a max length of 2 and an item size of 4 - this is an ARM7.
In a task, I have the following:
if (xQueueReceive(scan_q, &msg, 1000) == pdTRUE) { // get data
// msg now points to a struct scan_data
It used to be the case that I could then use msg as a pointer into my structure, i,e, msg->count, but now I get data aborts because msg has the value 0x06060606 instead of the value put in the queue (i.e. 0x208590)
I have verified the value from the ISR, and queried the memory indicated by the Queues window in IAR, and all that seems fine. The problem is on the receive end.
If I alter the xQueueReceive statement and give it a timeout of 0, and then vTaskDelay(1000) when it fails, then the proper data is transferred, but I take a performance hit.
For the record, this is FreeRTOS 5.4.2 use EWARM on an Atmel AT91SAM7X512. I use this exact same logic in other places, and it appears to work, so I have apparently overflowed a stack somewhere or something else weird. Does 0x06060606 ring a bell?