cancel
Showing results for 
Search instead for 
Did you mean: 

LPUART DMA on STM32L0

MLam
Associate III

Hello everyone,

I'm working on a project where i use 2 STM32 MCU which communicate with each other with LPUART and DMA.

My STM32 references : STM32L072CBT6 and STM32L010C6T6

I have a problem with this communication with LPUART and DMA. I see that error from DMA and LPUART interrupt often occur.

When i try wake up the STM32 from low power sleep, i see that interrupt from DMA and LPUART are completly out and i often neeed to restart DMA and LPUART communication.

Could you tell me if you have meet this type of problem when you are using LPUART and DMA ?

Maybe i made a mistake in the configuration of LPUART and DMA to get RX data, could you tell me if you have use case that i can compare ?

I'm searching to have experience return if it's possible 😉 .

Thanks for your help,

Best regards,

MLam

 

2 REPLIES 2
Issamos
Lead II

Hello @MLam 

Can you share your code so our community members can help you finding a solution.

Best regards.

II

MLam
Associate III

Hello,

I'm using DMA channel 5 for USART1_RX and DMA channel 3  for LPUART1_RX on my STM32L072CBT6.

I made others tests and i see that false data are receive on my LPUART1 buffer sometime. This false data are not due to bad communication because data that i recover come from USART1_RX bus. The things that i don't understand is the following. I'm using different channel with my DMA for each peripherals (LPUART and USART) when i receive data from my DMA they are stocked respectively in a different buffer for each. SO i don't really understand how data can not be in the right buffer.

This is a story of timing ? DMA can process only data on 1 channel at a same time ? Could you lighting me about this ?

I'm adding some informations to show you my project. i can't share all my code but i can provide all informations about DMA, LPUART and USART configuration.

Attached documents:

- STM32L072CBT6 Cube MX configuration screen  

- Code function which use DMA / LPUART / USART.

To explain how i'm use it :

In my main, 

1) Intialisation of peripherals

2) Enable interrupt for LPUART DMA and USART DMA

In my HAL_UARTEx_RxEventCallback function,

1) i'm checking where the interruption come from (LPUART or USART)

2) After checking that i'm copy the data from the buffer where DMA push informations (lpuart1_Rx_data or usart1_Rx_data) into a new buffer ( context.readKeyboardRFIDdata or context.readLPWANdata)

3) Up a flag to rpocess data after interruption

4) clear DMA buffer

5) I'm restarting the DMA interrupt

6) At the end of the function, if we don't found any LPUART or UART event, all DMA interrupt re-enable

At the end with context.flag_readKeyboardRFIDdata and context.flag_readLPWANdata, i can process my differents data.

Do you have advice about this differents informations ?

Thanks for your helps,

Best regards,

MLam