UART DMA does not receive any bytes if started before peripheral is outputting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 9:32 PM
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
- Start UART DMA
- 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.
- Labels:
-
DMA
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 10:03 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 10:13 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 10:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 10:34 PM
awesome thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 10:47 PM
Actually it does not appear that's there's any garbage data being output. This is confirmed empirically by doing the following
- Turn on lidar
- Wait 25ms
- Turn on DMA
- Observe data being recorded to DMA
- Turn off lidar
- Turn on lidar
- Observe data being recorded to DMA
- Repeat steps 5,6,7 n times
If garbage data were the problem I would expect turning the laser on and off to produce more garbage that causes the UART to error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-07-13 11:01 PM
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​
