Hi everyone!
I’ve been working on integrating the ping protocol and my Ping1D to my embedded system recently and I’ve ran into some issues. I’m able to request the protocol version and get a return message that makes sense using the following :
uint8_t pData[] = {
0x42, 0x52, 0x02, 0x00,
0x06, 0x00, 0x00, 0x00,
0x05, 0x00, 0xa1, 0x00
};
return HAL_UART_Transmit(huart, pData, sizeof(pData), 100);
But when it comes to requesting the processor temperature (1213 message ID), the return message is… not what it’s supposed to be. Am I calculating something wrong or missunderstanding how to properly communicate with the Ping1D?
Requesting the data like this :
uint8_t pData[] = {
0x42, 0x52, 0x02, 0x00,
0x06, 0x00, 0x00, 0x00,
0xBD, 0x04, 0x59, 0x05
};
And reading the return :
uint8_t rData[12];
HAL_UART_Receive(huart, rData, sizeof(rData), 100);
But after this rData is mostly garbage from what I can see (Definitely not seeing the BR start). Just looking for a lead on what I’m doing wrong here… Thank you!
PS : I know I should be automating the checksum calculation but I wanted to simply follow the quickstart example and get started on retrieving some data for practical purposes
Edit : Seems like the HAL is giving me a HAL_TIMEOUT for some reasons on the reading… Maybe 100ms is too short to retrieve the distance_simple…