Skip to main content
TomC
Senior
July 14, 2022
Question

UART DMA does not receive any bytes if started before peripheral is outputting

  • July 14, 2022
  • 6 replies
  • 1270 views

I have a distance laser outputting at 10KB/s (BAUD 921500).

I cannot miss any of the information output by the laser so want to turn it on after the UART DMA is turned on and listening.

Hence the steps are

  1. Start UART DMA
  2. Start laser

However, doing things in this order prevents any bytes from being received by the UART DMA.

I was wondering if anyone might have some insights into this problem, many thanks.

This topic has been closed for replies.

6 replies

KnarfB
Super User
July 14, 2022

There is no intrinsic timeout with your approach. UART receive using cyclic DMA waits forever for the next byte. Possibly "start laser" causes some garbage output on the serial line which puts the USART in an error state? Use a scope/LA to check and also the error bits.

If there are no such errors, show your code.

hth

KnarfB

TomC
TomCAuthor
Senior
July 14, 2022

Hi KnarfB thanks for your response,

It does appear that the laser is outputting some garbage that causes the DMA to lock up. If the DMA listens to the laser <20ms after it has begun outputting the DMA will lock up. I'm in the process of looking at the initial laser output (0-20ms) right now

If the behaviour is caused by garbage output do you have any suggestions to ensure the DMA is able to capture the first non-garbage byte that the laser outputs?

waclawek.jan
Super User
July 14, 2022

Which STM32?​

> prevents any bytes from being received by the UART DMA.

How do you observe this, exactly?

Both ​UART and DMA do have status bits/bytes, check them (keeping in mind that debugging may be intrusive).

JW​