Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ragrus-nbl opened this issue Jul 9, 2024 · 1 comment · Fixed by #76279
Closed
Assignees
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@ragrus-nbl
Copy link

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
@ragrus-nbl ragrus-nbl added the bug The issue is a bug, or the PR is fixing a bug label Jul 9, 2024
Copy link

github-actions bot commented Jul 9, 2024

Hi @ragrus-nbl! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@nashif nashif added the priority: low Low impact/importance bug label Jul 11, 2024
@teburd teburd assigned avisconti and unassigned teburd Jul 16, 2024
@teburd teburd added the platform: STM32 ST Micro STM32 label Jul 16, 2024
avisconti added a commit to avisconti/zephyr that referenced this issue Jul 24, 2024
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.

Fixes zephyrproject-rtos#75686

Signed-off-by: Armando Visconti <[email protected]>
@nashif nashif closed this as completed in a1f9793 Jul 27, 2024
zephyrbot pushed a commit that referenced this issue Jul 27, 2024
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.

Fixes #75686

Signed-off-by: Armando Visconti <[email protected]>
(cherry picked from commit a1f9793)
avisconti added a commit to avisconti/zephyr that referenced this issue Jul 29, 2024
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.

Fixes zephyrproject-rtos#75686

Signed-off-by: Armando Visconti <[email protected]>
(cherry picked from commit a1f9793)
nashif pushed a commit that referenced this issue Aug 6, 2024
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.

Fixes #75686

Signed-off-by: Armando Visconti <[email protected]>
(cherry picked from commit a1f9793)
Chenhongren pushed a commit to Chenhongren/zephyr that referenced this issue Aug 26, 2024
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.

Fixes zephyrproject-rtos#75686

(cherry picked from commit a1f9793)

Original-Signed-off-by: Armando Visconti <[email protected]>
GitOrigin-RevId: a1f9793
Change-Id: Ic4592a023d021d46a3b7e36e795f61cee4082068
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5745016
Commit-Queue: Fabio Baltieri <[email protected]>
Reviewed-by: Fabio Baltieri <[email protected]>
Tested-by: ChromeOS Prod (Robot) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants