cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 LPUART Baudrate

Sjain
Associate II

Hi,
I configured LPUART with 57600 baudrate. With this baudrate configuration Rx interrupt stop working if I send more than 11 bytes of Data on UART. With the same configuration there is no issue in transmit. Also in receive if I send less than 10 bytes then it's working without an issue but if number of bytes increase RX interrupt stopped.

Then I configured LPUART baudrate 9600 and in this case everything working as expected.

So, Can you please let me know that LPUART can be work on 57600 baudrate or not?
Also please share the configuration to make it work on 57600 baudrate. 

Thanks.

6 REPLIES 6
Karl Yamashita
Lead II

Show your code, especially the callback. I can only guess that you didn't check the HAL status.

hi @Karl Yamashita ,

Thanks for the reply, here attached the lpuart config and callback

Sjain_1-1698785591263.png

 

Sjain_0-1698785477906.png

Meanwhile I also tried to debug more to fix this issue and found that after 11th byte it continuously receive Overrun error and because of that Rx interrupt not working. To fix this issue I have added following callback .

Sjain_2-1698785729381.png

After adding the error callback, disable Rx interrupt issue was fixed but I received the data loss on uart.
Can you please guide me a right way to fix this overrun error and data loss issue?

Thanks



You're not checking HAL status. So when your call HAL_UART_Receive_IT and it returns HAL_BUSY, then interrupts is never enabled for that huart, ever. Test for the return status and set a flag if busy. Then in main while loop check the flag and then call HAL_UART_Receive_IT again. 

 

if(HAL_UART_Receive_IT(&hlpuart1, pData, Size) != HAL_OK)
		{
			// set error flag. Check error flag in main while loop and try calling HAL_UART_Receive_IT again.
		}

 

 

You're also in luck. I have a example project where I am using 3 UARTS with a ring buffer and have a data structure for each one. It shows how to test for HAL status, parse each uart, and send each uart. I haven't posted any documentation yet but you can still view the code https://github.com/karlyamas hita/Nucleo-G431RB_Three_UART

The website is bleeping out my last name, lol. So you'll have to remove the space between 's' and 'h' in the link

 

STTwo-32
ST Employee

Hello @Sjain and welcome to ST community 😊.

Can you add your project configurations and take a look at the section 2.15 of the ES0394

Best regards.

STTwo-32

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sjain
Associate II

Hi @STTwo-32 ,
Attached the source files here for reference.

Sjain_0-1698945768678.png

As per section 2.15 of the ES0394 I tried to Increase the LPUART kernel clock frequency, still facing an same issue on 57600 baudrate. I already tested with lower baudrate configured as 9600 and everything working.
The module which I'm going to use with stm32wb communicate on uart with 57600 baudrate. Can you please help me to solve this?

Thanks

At higher rates it depends on the peripheral source clock (APB ?) and the error in the desired vs achieved rates.

Check for sticky noise or framing errors reported by the LPUART with regard to reception. These will need to be cleared.

When posting code fragments please use the code formatting tool </> rather than paste in bit maps. Thanks.

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