2023-10-31 06:47 AM
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.
2023-10-31 01:39 PM
Show your code, especially the callback. I can only guess that you didn't check the HAL status.
2023-10-31 02:05 PM
hi @Karl Yamashita ,
Thanks for the reply, here attached the lpuart config and callback
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 .
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
2023-10-31 02:42 PM - edited 2023-10-31 02:48 PM
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
2023-11-01 08:06 AM
Hello @Sjain and welcome to ST community :smiling_face_with_smiling_eyes:.
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.
2023-11-02 10:26 AM
Hi @STTwo-32 ,
Attached the source files here for reference.
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
2023-11-02 10:44 AM
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.