cancel
Showing results for 
Search instead for 
Did you mean: 

LPUART can't display a large message

Fannyrsy
Associate II

Hi everyone!

I'm using a NucleoWB55 and the LPUART protocole to communicate with a SIMCOM module. I'm able to send via the LPUART the AT commands that I want and to receive it's answers. I'm now trying to print on my terminal the content of my web page. I connected a USB to TTL (CP2102 module) to observe the UART RX of the SIMCOM module. The module transmits the entire content of the web page but I can't get it on my STM32 via LPUART. To make it easy to understand here are some screenshots : 

Here is the terminal where I transmit via UART the received data:

terminal ST.png

Here is the terminal where the transmit data of the SIMCOM module is connected:

WhatsApp Image 2024-03-05 at 10.40.52.jpeg

 We can see the entire content of the web page.

Finally the interesting parts of my code : 

Commands and reception buffers:

variables commandes.png

fonctions AT.pngfonctions AT 2.pngcallback.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I presume there's a problem in receiving and displaying the data received. I know my "received" buffer doesn't contain many characters at the moment, but I should still be able to receive the start of the page, shouldn't I?
Does anyone know what the problem might be?

Thanks a lot!

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Don't use blocking functions (HAL_UART_Transmit) inside of an interrupt callback. Any characters caught during this time will lead to an overflow error condition. Perhaps set a flag and handle the transmission back in the main thread.

Monitor for errors by implementing HAL_UART_ErrorCallback or examining the software state machine (hlpuart1).

Don't mess with writing recu in the main thread--it may be being written in the interrupt. If you want to zero-initialize it, do so right before HAL_UARTEx_ReceiveToIdle_IT.

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

Don't use blocking functions (HAL_UART_Transmit) inside of an interrupt callback. Any characters caught during this time will lead to an overflow error condition. Perhaps set a flag and handle the transmission back in the main thread.

Monitor for errors by implementing HAL_UART_ErrorCallback or examining the software state machine (hlpuart1).

Don't mess with writing recu in the main thread--it may be being written in the interrupt. If you want to zero-initialize it, do so right before HAL_UARTEx_ReceiveToIdle_IT.

 

If you feel a post has answered your question, please click "Accept as Solution".

Don't use sizeof() for strings, you'll send the NUL over the wire. Make a function for strings that uses strlen(), or use sizeof()-1 each time.

The terminal and website may have different ideas about CR/LF, remember UNIX/LINUX typically doesn't use them as a pair.

With AT commands it's generally better to process the responses in a stateful manner, looking for OK, ERROR, NO CARRIER, etc rather than blind / arbitrary delays.

 

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

I used HAL_UART_Transmit_IT and it's working fine!

Thank you!