2023-05-16 08:14 AM
I configured the UART: huart6. I set the global interrupt and I use touchgfx designer (so RTOS as well), maybe that is the reason I can't set the preemption priority lower than 5 for the UART interrupt. The problem is that I can send messages to ESP8266, but I can't receive the messages from the ESP... Here is the code form the interrupt uart receiving and the callback function:
/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT(&huart6, buff_Rx, 13);
/* USER CODE END 2 */
.
.
.
/* USER CODE BEGIN 4 */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
CpltDone = 1;
HAL_UART_Receive_IT(&huart6, buff_Rx, 13);
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_11, GPIO_PIN_RESET);
}
/* USER CODE END 4 */
If I put a breakpoint into the callback function the code never stops and if I use breakpoint at another place I can't see values in "buff_Rx" buffer. I examined the line with logic analyzer and the values are correct on the line... but I never get them...
What can be the problem?
Can anybody help me?
Thanks a lot!
2023-05-16 08:25 AM
Hi @SNEM.1
Just some ideas.
When you set your breakpoint at "another place", could you check the content of the SR register of your UART/USART instance ? Just to check if the Overrun flag (ORE) is not raised, as this could prevent reception.
You could also check if ErrorCallback is executed.
2023-05-17 10:13 AM - edited 2023-11-20 05:20 AM
Thanks for the advice!
How my code actually works: when I send a message via UART/USART the other MCU makes its job and send back a message (sensor values) to the STM.
Based on your words I tried to see what happens in the registers but unfortunately I can't stop the running when I should receive the values.
So I set a breakpoint to the beginning of a "send message function" and when I call this 2nd time it's sure that I had to receive some values already.
Some interesting things (for me,because I don't really understand why it works this way):
It means that the message arrive in the shift register and try to transmit to the DR but there is some error? Or it means anything else? And I set the global interrupt for the USART but RXNEIE is 0...Why? :\ I'm not really experienced in this area. Thanks again for your advices!
2023-05-17 12:50 PM
upload your IOC file
2023-05-18 12:57 AM
2023-05-18 05:06 AM
Now I received some values somehow... but I had to restart the system and after that the problem comes again... Maybe some synchronization problem?
2023-05-18 05:28 AM
Clear the overrun error *ORE"
2023-05-18 05:51 AM
Now it seems to be good. What I had to do:
I didn't disconnect the UART lines while I restarted the STM board :D It looks like some synchronization problem... Can anybody explain this? :)