cancel
Showing results for 
Search instead for 
Did you mean: 

HAL UART DMA circular buffer TX/RX

davide
Associate II
Posted on June 08, 2017 at 10:58

The original post was too long to process during our migration. Please click on the attachment to read the original post.
4 REPLIES 4
davide
Associate II
Posted on June 11, 2017 at 10:53

Hi there,

further investigation pointed towards a strange behaviour:

the aforementioned code is working great if it's compiled with -O0, 1, 2, 3, g, s but HAL_UART_RECEIVE_DMA fails to set the uart peripheral in UART_STATE_BUSY_RX when the gcc optimisation is settled to -Of, hence the issue i have enlightened in the previous post.

It that a known behaivour of Hal_Uart, there's a solution the this issue?

ty! 

Davide

Posted on June 11, 2017 at 11:24

Issues related to variables modified in interrupts and having different behaviour upon aggressive optimization tend to be related to insufficient use of the volatile qualifier.

I don't Cube.

JW

Posted on June 11, 2017 at 20:11

Thanks waclawek.jan,

unfortunately also i have always used SPL, but this project requires HAL: a good opportunity to know better these drivers but also an effort to adapt to a very different point of view. 

It's a pity that this simple thing isn't working out of the box with any optimisation, after all i've written the code in a very naive way: only hal irq handlers are used inside the isr services, as also done by mx cube.

Davide

ps: any further info is well accepted, also if there is a way to point out this issue to the hal drivers team i'll be happy to contribute!

Jari Nippula
Associate
Posted on October 19, 2017 at 08:18

Your Rx DMA seems to use Channel3 without interrupt enable call and int handler.

Jari