cancel
Showing results for 
Search instead for 
Did you mean: 

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.

PKand.2
Associate II

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.

6 REPLIES 6

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
PKand.2
Associate II

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?

> I have checked the error flags

What error flags? UART error flags?

JW

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes. UART error flags.

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