cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt doesn't work when UART received on STM32F469I DISCO.

SNEM.1
Associate II

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?

  • ESP IO voltage is 3v3 and the STM's Arduino compatible pins are 5V and that could be the reason?? (but if I use the SPI communication it works well..)
  • Or the problem is the priority of UART interrupt?
  • Or something else?

Can anybody help me?

Thanks a lot!

7 REPLIES 7
Guenael Cadier
ST Employee

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.

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):

  • DR's value is always 0x17
  • In CR1 the RXNEIE is 0 (but it should be 1 to enable interrupt, am I right?)
  • After I sent the message and I stop the running at the very next instruction the registers value are the next: CTS 0, LBD 1, TXE 1, TC 1, RXNE 1, IDLE 1, ORE 1, and the others are 0 (and DR = 0x17)

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!


_legacyfs_online_stmicro_images_0693W00000bkIrrQAE.png

Karl Yamashita
Lead II

upload your IOC file

I hope it's not so wrong :\ The base is generated by Touchgfx and I added USART6 and (if I remember well) the SPI2.

SNEM.1
Associate II

Now I received some values somehow... but I had to restart the system and after that the problem comes again... Maybe some synchronization problem?

Clear the overrun error *ORE"

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SNEM.1
Associate II

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? 🙂