AnsweredAssumed Answered

DMA Transfer Complete and USART Transfer Complete

Question asked by diez.r on Aug 14, 2017
Latest reply on Aug 27, 2017 by Jack Peacock

Hi all:

 

I have been using DMA with USARTs for years on STM32F4xx and STM32F0xx microcontrollers, but mainly with full-duplex connections like RS-232. Now I need to handle RS-485, which is only half-duplex. My code needs to manually switch the RS-485 transceiver from rx to tx, and viceversa.

 

The main problem I am facing is that the "DMA Transfer Complete" interrupt will trigger before the "USART Transfer Complete", right? After the DMA transfer is complete, I need to wait until the USART has sent all bits before switching RS-485 back to reception mode. I haven't found yet any examples about the best way to do this, and I know interrupt handling can be tricky.

 

Can anybody help?

 

Thanks in advance,

  R. Diez

Outcomes