xQueueReceive Assert Failed
Posted: Mon Jul 17, 2023 8:57 am
I'm having an issue with the code below (just extracted the relevant bits). It compiles and flashes fine, but then goes into a boot loop with the error of assert failed: xQueueReceive IDF\components\freertos\queue.c:1382 (( pxQueue )). Any help would be appreciated!
Code: Select all
QueueHandle_t red_line_queue;
void IRAM_ATTR isr_function( void *arg)
{
const int64_t time = esp_timer_get_time(); // store the "data" we want to enqueue into a local variable
BaseType_t shouldYield = pdFALSE; // declare and initialize another local variable for the pxHigherPriorityTaskWoken argument
xQueueSendFromISR(
red_line_queue,
&time, // pass a *pointer* to our data (local variable) to the function; the data pointed-to will be *copied* into the queue
&shouldYield); // pass a *pointer* to the shouldYield local variable (= shouldYield is used as an output parameter)
// If some task was waiting on our queue and should now be switched to,
// xQueueSendFromISR will have set our shouldYield variable to pdTRUE
if(shouldYield != pdFALSE) {
// let FreeRTOS know that we want it to switch tasks now
portYIELD_FROM_ISR();
}
}
int queue_time_1; //also tried long instead of int
void app_main()
{
while (1)
{
printf("\n");
if(xQueueReceive(red_line_queue, &(queue_time_1), (TickType_t)0))
{
printf("Data received from queue");
}
printf(queue_time_1);
}
}