FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2013 Threads]
Hello
Controller: Atmel UC3A0512
Enviroment: ARV32 Studio
I have a USART interrupt which is like this:
__attribute__((__interrupt__)) static void usart_int_handler( void )
{
static int status, temp;
static uint8_t data;
static portBASE_TYPE xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;
// Read USART buffer
status = usart_read_char( USART_CHANNEL, &temp );
if( USART_RX_ERROR == status)
{
// Resetting the USART
usart_reset( USART_CHANNEL );
// Enable the USART as RS485
InitCOM();
}
else if( USART_SUCCESS == status )
{
data = (uint8_t)temp;
// Because FreeRTOS is not supposed to run with nested interrupts, put all OS calls in a critical section
portENTER_CRITICAL();
xQueueSendToBackFromISR( xRXQueue, &data, &xHigherPriorityTaskWoken );
portEXIT_CRITICAL();
}
if( xHigherPriorityTaskWoken == pdTRUE )
{
// Force unblocked (higher priority) tasks to run
vTaskSwitchContext();
}
}
I'm running in multidrop mode and I have 2 slave modules connected to this RS485 bus.
My problem is that when my task, which is looking at this xRXQueue, is seeing data in the queue and starts to read the queue, the system breaks down and restarts do to my watchdog. The task starts like this:
if( pdPASS == xQueueReceive(xRXQueue, rx_buf, portMAX_DELAY) )
{
// code here
}
How can I, in a more secure way, handle this queue and interrupt handling so it will not stall the controller?
Best regards
Casper
There does not look to be anything fundamentally wrong with your implementation. Are you using the ARV32 port that is distributed by Atmel, which is the version for the latest AV32 chips?
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.