STM32F4xx Uart

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
Alan_37
Posts: 186
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 54 times
Been thanked: 26 times

Flowcode v10 STM32F4xx Uart

Post by Alan_37 »

Hi,

This is an old bug, but it's still present. I'm using the STM32F407VET, though this issue affects all STM32 devices I have tested.

To test, I simply trigger the UART1 RX interrupt and receive a string or a byte array with a timeout, then send it back to verify functionality. This works reliably on AVR microcontrollers like the ATmega128A.

Using ReciveByteArray or ReceiveString ( Timeout=10, NumBytes=30 ) I send Hello and I Get Hellooooooooooooooooooooooooo Back with 30 Chars .
for some unknown reason if I send Testing it replies Testing .

I understand that a common workaround is to receive characters byte by byte into a circular buffer and manage the timeout manually.
However, why hasn't this bug been fixed?

Additionally, I looked into configuring UART with DMA so data could be written to memory without CPU involvement, but it seems the HAL library used in flowcode lacks the necessary support for this ( or maybe it's too advanced for me :lol: :lol: )

The C Code provided by ChatGPT was Compiled but was not able to receive any Data .

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32F4xx Uart

Post by LeighM »

I think the issue here is that you shouldn't mix interrupt driven comms with a polled timed loop.

Alan_37
Posts: 186
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 54 times
Been thanked: 26 times

Re: STM32F4xx Uart

Post by Alan_37 »

Good Morning LeighM,

Thanks for the reply. I understand that mixing interrupt-driven communication with polled timeouts can cause issues, but this is actually part of the confusion.

If Flowcode's ReceiveByteArray and ReceiveString functions aren't designed to work with interrupts (or if they assume a blocking/polled flow), then it would be helpful if this was documented more clearly.

In my case, the UART interrupt is firing correctly — I can see data arriving — but the Flowcode function still seems to pad the buffer with junk data up to the full requested length, regardless of actual received length. This doesn't seem like expected behavior for a function that claims to handle timeouts.

If the recommended approach is to avoid these functions entirely and manually implement a circular buffer using just the interrupt, that's fine — but again, this should really be documented if it's the official stance.

Also, is there any official guidance on using DMA with Flowcode UART? If not, that would be useful to know too, since manual handling of every byte can get inefficient at higher speeds.

Thanks again for your input — just trying to figure out the "right" way to handle this within the framework Flowcode provides.

Post Reply