cancel
Showing results for 
Search instead for 
Did you mean: 

Print data from Lidar sensor

Divesh Dutt
Associate II

Hello guys

i want to print lidar sensor data (digital) to virtual port.what is the way to do it.do i need to change the received data to string?

TIA

6 REPLIES 6

The NUCLEO-64 should provide a UART (USART2 PA2/PA3 as I recall) which connects to the VCP created by the ST-LINK/V2. You can transfer data to that serial connection in any form you choose, human readable ASCII if that's what you want, or a binary format your own application can process/digest.

On one of the systems I worked on we used 3x TFMini Plus devices, and output a NMEA style sentence with all three measurements in ASCII, separated by commas.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Divesh Dutt
Associate II

0693W000008zLKpQAM.pngHi thanks for replying,

I am getting data in uint8_t type buffer.but when i single step.i see some garbage value in the buffer array.

After getting the data should i typecast it?

Shouldn't you have 0x59 0x59 packet sync bytes?

The distance value is then two bytes which you combine into a 16-bit value.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Divesh Dutt
Associate II

Hi Tesla,

You're right it should be like 0x59 0x59 and two bytes of distance and signal strength but i'm getting this way.Here is the interrupt handler of the code it's a stupid code but believe me i'm still learning.Any suggestion would be welcome.0693W000008zQy1QAE.png

You should probably be restarting the HAL_UART_Receiver_IT in the call back, not at every IRQ. The USART interrupts for each byte.

Only use the 10 byte version if you have achieved synchronization and the checksum is correct. You'll probably want to fall back into a 1 byte mode when you don't have sync.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Divesh Dutt
Associate II

Hello Tesla DeLorean

i figured out the data i am receving is the decimal format as shown in the variable below in the image is eqivalent to 0x59(89 in Decimal) which is the start of the frame.However i am trying to store it into the frame so that i can convert it into hexadecimal number and add together the low and high bits to calculate the bits but the input buffer is reading the same value every time in turn the frame.