Skip to content

ST LIS2DUX12 driver: temperature is not converted to Celsius and raw values are returned #75686

@ragrus-nbl

Description

@ragrus-nbl

Describe the bug
ST LIS2DUX12 accelerometer driver doesn't convert the raw value of temperature to Celsius.
When I read the SENSOR_CHAN_DIE_TEMP channel, I get values like these (of type struct sensor_value): .val1 = 1360, .val2 = 0.

According to the docs, they must be in Celsius.

To Reproduce
Steps to reproduce the behavior:

  1. Get a board with a LIS2DUX12 accelerometer
  2. Enable the LIS2DUX12 driver (by adding the accelerometer into the device tree)
  3. Add CONFIG_LIS2DUX12_ENABLE_TEMP=y to prj.conf
  4. Run some code which reads the SENSOR_CHAN_DIE_TEMP channel. Like the following:
const struct device *dev = DEVICE_DT_GET(LIS2DUX12);
struct sensor_value val = { .val1 = 0, .val2 = 0 };
sensor_channel_get(dev, SENSOR_CHAN_DIE_TEMP, &val);
LOG_DBG("Temperature: %d.%06d", val.val1, val.val2);

Logs and console output

[00:22:32.297,729] <dbg> test_accelerometer: Temperature: 1520.000000

Environment

  • Zephyr 3.7.0-rc2

Metadata

Metadata

Labels

area: SensorsSensorsbugThe issue is a bug, or the PR is fixing a bugplatform: STM32ST Micro STM32priority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions