I am using STM32f4 discovery board connected with xbee to receive temperature data from remote temperature sensor. Code used is CMIS UART example code. I will receive packet data, 1 byte at a time. In other words UART receive interrupt will be called whenever each byte receives. Once I gets the complete packet I will copy the temperature data. My UART callback function works without any issue. But after several hours, UART receive interrupt stops working and UART cannot receive anything. However UART transmission still works. I am using UART1 with baud rate 115200. I have set UART interrupt priority as 0 and no other interrupt shares this priority. All other interrupt priority are lower than UART. Can any one please tell me why UART interrupt stops triggering?
#define PACKET_DELIMETER 0x7E
uint8_t g_frame_ok=0; //flag to indicate complete packet received
uint8_t g_index_of_aoBuf=0; //Index of receive buffer
uint8_t g_aoBuf_of_xbee[100]={0};//Receive Buffer
uint8_t r_byte=0; //Receiving byte
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *allUartHandle)
{
__HAL_UART_FLUSH_DRREGISTER(allUartHandle);
if(HAL_UART_Receive_IT(allUartHandle, (uint8_t *)&r_byte, 1) == HAL_OK) //Interrupt occurs when each byte arrives
{
if(r_byte==PACKET_DELIMETER)
{
//start receiving packet
}
if( g_index_of_aoBuf>=g_aoBuf_of_xbee[2]+4)
{
g_frame_ok=1;
BSP_LED_On(LED4);
}
}
}