cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UARTEx_ReceiveToIdle_IT fails to initialize

KAgga.1
Associate III

Hello There,

I'm using STM32H7A3 and facing a weird issue with HAL_UARTEx_ReceiveToIdle_IT() API.
STM is connected to Cellular Modem via UART. When I turn on the modem via some GPIOs, initially it throws some init data. But when I call HAL_UARTEx_ReceiveToIdle_IT() after modem is turned ON, It fails to do so.
When I tried disconnecting STM32 Uart's Rx line and Modem's Tx line, then initialization was successful.

Any help will be appreciated.

Regards,

Keshav Aggarwal

3 REPLIES 3
Karl Yamashita
Lead III

Without showing code we have no way to help trouble shoot.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
GreenGuy
Lead

Your description of the failure is a little vague so with out code to look at we can do little else but guess.  Even with the code I am not sure we can help since it is not clear what "fails to do so" means.  No disrespect intended, but in your mind "fails to do so" is clear to you, but we, on the outside, are lacking context to understand. 

So questions:

Does "fail to do so" mean:

1) the modem init string does not appear:

2) the HAL call returns !success,

3) the interrupt that would respond does not happen?

Last of all when you say "initialization was successful", again we are lacking context.  The modem, the moden init string, or something else?  The HAL call you mentioned is supposed to occur after UART init, and the HAL initialization code for the UART IT handling, and does not really do any init functions other than prime the peripheral to look for idle and receive data up to that point, or receive data up to the count limit.  Also need to know, are you using a circular buffer or normal.

I hope this does come across as being critical; I am just trying to understand the context.

KAgga.1
Associate III

Thanks for replying!
I meant HAL_UARTEx_ReceiveToIdle_IT() didn't return HAL_OK after powering on the Modem.
Upon checking the handle, I found huart.ErrorCode was 10. i.e., DMA transfer error
Well, I'm not utilizing DMA with the UART. It might be using internally.

I also found this API returns HAL_OK when I call it before turning ON the Modem.