zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.48k stars 6.41k forks source link

STM32 b_u585i_iot02a, reading vrefint problem #61368

Closed JiiZR closed 1 year ago

JiiZR commented 1 year ago

* Describe the bug I tried sample, samples\sensor\soc_voltage.

To Reproduce Steps to reproduce the behavior:

  1. west build -p auto -b b_u585i_iot02a samples\sensor\soc_voltage
  2. west flash
  3. see error

Expected behavior Should vref_1 be around 1,2 V ? ADC1 channel 0.

Impact Minor

Logs and console output

Booting Zephyr OS build zephyr-v3.4.0-2226-g4cbb9d8f5f46 Sensor voltage[vref_1]: 13.20 V Sensor voltage[vbat_4]: 3.32 V

Environment (please complete the following information):

Additional context

FRASTM commented 1 year ago

The error comes form the VREF int calibration value which is 14bit and has to be converted to 12bit value when the ADC channel is measured on 12 bits.

vref _stm32U5