cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to receive unknown length uart/usart messages with mat/target uart receive block?

MMine.1
Associate

In mat/target uart receive block, the message length must be definite and the block waits until the input data length becomes equal to the defined length. if one or more bytes may loss in communication or the message length may be variable, so the block is not useful. is there any solution for these toolbox?

3 REPLIES 3

You'd probably want to code something more robustly.

For most STM32 targets the IRQ is fired for every byte, and then the HAL accumulates these and subsequently calls back to the user supplied handlers.

If the MATLIB stuff isn't on GitHub you should probably push for that so more optimal solutions can be developed but those looking to use/fund them.

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

Recent HAL versions have a HAL_UARTEx_ReceiveToIdle function which will return at idle or when the specified number of characters is received.

I'm not familiar with STM32-MAT/TARGET, but I do know it's NRND status. If it's not already in there, it probably isn't going to be added in the future.

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

They made these HAL_UARTEx_ReceiveToIdle...() functions, but HAL still cannot do a basic continuous reception without enabling/disabling peripheral all the time and therefore missing some bytes under completely normal conditions.