Hello,
thank you for your questions.
Here are the my answers:
- This is a custom pcb with a NXP Kinetis KL82
- Project stack usage is about 93 % (is this what you asked for?)
- When the error occurs, the queue is still there and gets loaded with data, I can observer that in the debugger.
- I am using McuXpresso. It does not specify what event object “unknown object” means. If it works, the name of the blocking queue is in that field
The error not only occurs if an isr is posting data to the queue, but also if another task is posting the data.
Here is some code:
1. Definition of queue in header:
public:
static QueueHandle_t interruptQueueHandle;
private:
static StaticQueue_t interruptQueue;
static uint8_t interruptQueueStorageArea[INTERFACE_VEHICLE_INTERRUPT_QUEUE_LEN];
2. Definition of queue in class:
StaticQueue_t InterfaceVehicle::interruptQueue;
uint8_t InterfaceVehicle::interruptQueueStorageArea[INTERFACE_VEHICLE_INTERRUPT_QUEUE_LEN];
QueueHandle_t InterfaceVehicle::interruptQueueHandle;
2.1 Initialisation of Queue
interruptQueueHandle=xQueueCreateStatic(INTERFACE_VEHICLE_INTERRUPT_QUEUE_LEN,1,interruptQueueStorageArea,&interruptQueue);
vQueueAddToRegistry(interruptQueueHandle, "IV Q Interrupts" );
3. ISR, which is posting data to queue (I can see this is working, as I can see the items in the queue are getting more, but they are not read from the queue)
// Gets GPIO interrupts and sends them to queue
void InterfaceVehicle::onInterrupt(GPIO_Type *gpio, uint32_t mask)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
uint8_t interruptID;
if ((gpio==PIN_INTERFACEVEHICLE_KL15_STAT_GPIO)&&(mask&(1<<PIN_INTERFACEVEHICLE_KL15_STAT_PIN)))
{
interruptID=INT_ID_KL15;
xQueueSendToBackFromISR(interruptQueueHandle, &interruptID, &xHigherPriorityTaskWoken);
}
[...]
if( xHigherPriorityTaskWoken )
{
taskYIELD();
}
} // end of function onInterrupt
4. Definition of Task reading the queue in header
private:
static void interruptHandler(void* nothing);
static StackType_t taskInterruptHandlerStack[STACK_SIZE_VEHICLE_INTERRUPT_BUFFER];
static StaticTask_t taskInterruptHandlerBuffer;
5. Definition of Task in class
StackType_t InterfaceVehicle::taskInterruptHandlerStack[STACK_SIZE_VEHICLE_INTERRUPT_BUFFER];
StaticTask_t InterfaceVehicle::taskInterruptHandlerBuffer;
TaskHandle_t InterfaceVehicle::taskHandle_interruptHandler;
6. Task Creation
taskHandle_interruptHandler=
xTaskCreateStatic(interruptHandler,"IV Interrupts", STACK_SIZE_VEHICLE_INTERRUPT_BUFFER,
NULL, TASK_PRIORITY_INTERFACE_VEHICLE, taskInterruptHandlerStack, &taskInterruptHandlerBuffer);
7. Task implementation
void InterfaceVehicle::interruptHandler(void* nothing)
{
uint8_t interruptId;
#ifdef STACK_SIZE_PROFILING_ENABLED
UBaseType_t uxHighWaterMarkCurrent;
#endif
while(1)
{
if (xQueueReceive(interruptQueueHandle,&interruptId,portMAX_DELAY) == pdPASS)
{
switch(interruptId)
{
case INT_ID_KL15:
Debug::log(LOGLEVEL_DEBUG,__class__,__func__,"KL15");
[..]
break;
[..]
}
#ifdef STACK_SIZE_PROFILING_ENABLED
uxHighWaterMarkCurrent= uxTaskGetStackHighWaterMark(NULL);
if (uxHighWaterMarkCurrent!=uxHighWaterMarkInterrupt)
{
Debug::log(LOGLEVEL_DEBUG,__class__,__func__,"HighWaterMark %d words",uxHighWaterMarkCurrent);
uxHighWaterMarkInterrupt = uxHighWaterMarkCurrent;
}
#endif
}
vTaskSuspend(NULL);
}