Dtynin
DIIDevHeads IoT Integration Server
•Created by Dtynin on 9/13/2024 in #firmware-and-baremetal
Why is my BMP280 sensor value calculation incorrect on AtMega32?
I’m working with the BMP280 sensor on an AtMega32 microcontroller, aiming to convert sensor data from raw readings to a human-readable format. Specifically, I need to read calibration values from the sensor’s registers and combine them to get meaningful numbers. I’m able to read most of the calibration values correctly, but one particular value is being miscalculated. The process involves reading the LSB (Least Significant Byte) and MSB (Most Significant Byte) from the sensor, then combining these bytes into a single value. Below is my implementation:
The value in
lsb1
and msb1
are confirmed to be read correctly (verified with a different microcontroller), and the expected combined value should be 38406. However, my MCU is showing -27130. All other values are computed accurately. What could be causing this discrepancy?1 replies