Skip to main content
MMine.1
Visitor II
July 6, 2021
Question

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

  • July 6, 2021
  • 2 replies
  • 1083 views

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?

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
July 6, 2021

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 VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
Super User
July 6, 2021

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""."
Piranha
Principal III
July 17, 2021

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.