}
my task call some code like above. data buffer is set in bbb function, but data[0] change afer bbb function return. the issue happens afer running many hours. I try to extend task stack size and system stack size, but still happen. at that time, no task switch but probaly interrupt coming in. CORTEX M3 save contex by HW. anyone meet the same issue ?
I always use FreeRTOS v7.5.2 and enable configASSERT(), when the issue happen, there is no any ASSERT happens. the interrupt priority follows above link completely . Is there any idea ?
Do your debug tools allow you to set watchpoints on data being written to? If so, place a break point the byte that is getting overwritten so the debugger stops when the value changes and you can see what was written to it. The problem will either be a misconfiguration (but if the recommendations on the above links are being followed that is less likely) or an simple application error.
I post my interrupt configure as following #define configKERNEL_INTERRUPT_PRIORITY 255 #define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 #define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
and initialize interrupt NVIC as following
static void RS485_NVIC_Config(void)
{
NVIC_SetPriority( USART1_IRQn, configLIBRARY_KERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( USART1_IRQn );
}
containly, there are other many interrupt in system.
compared to old code, I only add a 485 receive semaphore in receiving 485 packet.
rs485_rx_semaphore = xSemaphoreCreateCounting(8, 0);
only it receive correct packet by interrupt, it will call xSemaphoreGiveFromISR( rs485_rx_semaphore, &xHigherPriorityTaskWoken );
Yes - you mentioned that already. Dave’s question is related to the fact that different Cortex-M3 implementations have a different number of priority bits, and that effects the setting of configLIBRARY_KERNEL_INTERRUPT_PRI (I think this was explained on the web page you are already been referenced to).
So which Cortex-M3 device family are you using? For example, is it an STM32F, LPC17xx, LM3Snnn, etc.
I trace the issue and find some strange case which may be related with interrupt mixxing.
in my SLIP protocol, DB and DD BYTES are used to represent DB (DB data byte will appear as DBDD), but the a changeed data including DD BYTE. it seems that SLIP response data is not synchronize with current SLIP commands.
static uint8_t rs485_rx_routine(void)
{
uint8_t ret = SLIP_OK;
if (xSemaphoreTake( rs485_rx_semaphore, 50) != pdTRUE)
{
ret = SLIP_TIMEOUT;
}
rs485_rx_count = 0;
return ret;
}
my 485 rx handle wait 50ms to take the samephore . and the samephore is counting and initialized as rs485_rx_semaphore = xSemaphoreCreateCounting(8, 0);
which release in 485 interrupt handle
meanwhile, I also use the 485 channel to get other sensor’s data. and I use rs485_sem_wait(); and rs485_sem_signal(); to protect the 485 channle in used.
Is there a possible that system get the last SLIP command response data after issue new SLIP command?
Rechard:
I find the root cause now , once the issue happen, device accept 2 ACK data in slip reponse data, this also meet SLIP protocol in format. I don’t verify the second ACK. now, only check the data integerity and filter this time. the issue disappear !