I'm trying to read data from a BMP388 using Bosch drivers and SPI 4-wire mode. I have used a logic analyzer to determine that the sensor is responding to my burst read request with the expected first transmission of a dummy byte, then the transmission of 6 bytes - the first 3 being pressure data and the last three being temperature data. I am transmitting dummy bytes to the device to keep the clock rolling.
The data is captured in an array and some processing done to the values by the Bosch driver.
The issue I'm running into now is that I am unable to print this data in a form that "makes sense", leading me to believe that my understanding of how to get these floating point values printed needs another set of eyes.
I have tried the following methods to print the data:
printf - I have followed tutorials to get printf to print via UART and display on my desktop. I have also followed tutorials to make printf print floating point values.
printf("%0.2f\t\t %0.2f\t\t\n",data.temperature, data.pressure);
Using the above the following prints:
If I change the printf statements to use the integer format specifier %d I receive the following:
These results are especially odd to me since I get to following if I try an itoa() conversion, my understanding is that this would simply truncate a floating point number:
string_transmit(itoa(data.temperature, buffer, 10));
string_transmit(itoa(data.pressure, buffer, 10));
Can someone offer advice on a better way to determine what I've actually got stored in data.temperature and data.pressure? Or offer advice on how I could further go about debugging this situation?
I've attached the logic analyzer picture, but the raw data isn't helpful since the bosch driver makes numerous compensation calculations after the transmission.