HAL_I2C_Mem_Read disables interrupts
Hello all,
I am working on a project which is based on stm32f103cbt7 mcu.
In my project i have two freeRTOS task and 2 timer interrupts and 1 uart interrupt routine.
Task 1: handles wireless communication (it reads a buffer and if buffer has some valid data then it takes action accordingly). Buffer for which this task checks is filled by uart interrupt, data received on uart is filled to this buffer.
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HandleRxByte(rdata); // fills task1 buffer by checking received data.
HAL_UART_Receive_IT(&huart1, &rdata, 1);
}
Task 2: this task reads some data from External RTC over I2C and write some data to SD card over SPI and read analog channels.
Here i am facing a problem that after few minutes (random time) from device power on , buffer of task 1 does not change it's content, i.e. it freezed. For few minutes it works fine , multiple packets are handled by task1 correctly but after random time buffer content stops changing.
after debugging i found that at this moment when problem rise USART1 _> CR1 -> RXNEIE bit becomes 0 , timer and systick interrupts working fine and task 2 also working fine.
only uart interrupt disables.and i think reason is that HAL_I2C_Mem_Read disables and enable interrupts. because of this it disables uart interrupt anddoesn't enable again.
Am i right or please suggest me a solution for this.
thanks in advance .
