Skip to main content
PKand.2
Associate II
May 5, 2021
Question

I am interfacing TFmini S LIDAR with nucleo STM32F103, I am using 2 UARTS, uart1 and uart3 to receive LIDAR data. I am using DMA for that. LIDAR frequency is 1000Hz and data length is 9 bytes. uart 1 and 3 baudrate is set to 256000.

  • May 5, 2021
  • 3 replies
  • 1856 views

I am using HAL_UART_ErrorCallback() function to capture any error.

When I reset the the board by cutting the power off everything works fine. But if I reset it with reset button or software reset one of the uart freezes and I don't see any error. I have checked the error flags nothing in that too.

I tried interrupt based reception without DMA and it doesn't freeze. So its the issue with the DMA but I am not getting any error.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
May 5, 2021

With 9-byte packets you might need to resync the data stream

You'll want to look at how you're restarting each DMA transaction.

Dump the related DMA and UART status registers to see if you can determine a failure mode.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
PKand.2
PKand.2Author
Associate II
May 10, 2021

I am using DMA in circular mode and I just check the headers if the data is in correct order and then I process it. IS there something wrong in this approach?

Tesla DeLorean
Guru
May 10, 2021

Sounds fine as long as you don't lose or gain a byte, or otherwise lose sync if the sensor resets or has some issue.

Robustness of any given approach is judged by how it manages failure, not optimum conditions.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
PKand.2
PKand.2Author
Associate II
May 12, 2021

@Community member​ Thanks. That makes sense. I am trying now with idle line detection to start and stop DMA.

waclawek.jan
Super User
May 10, 2021

> I have checked the error flags

What error flags? UART error flags?

JW

PKand.2
PKand.2Author
Associate II
May 12, 2021

Yes. UART error flags.