Skip to content

Isense and Vbus ADC measurement inaccuracies #8

@Erlkoenig90

Description

@Erlkoenig90

Describe the set-up

  • NUCLEO-G474RE + X-NUCLEO-SRC1M1
  • STM32CubeIDE Version: 1.14.1

Describe the bug
The measured Isense current and Vbus voltages are somewhat inaccurate (significantly too low) when compared to multimeter measurements.

How To Reproduce

  1. Compile & Run the project Projects\NUCLEO-G474RE\Applications\USB_PD\SNK1M1_Sink.

  2. Provide a power supply to CN3 and measure the current.

  3. Run STM32CubeMonitor-UCPD.

  4. Compare the displayed Ibus with the manual measurement.

Additional context
The ADC calibration is disabled for the STM32G474. This results in a significant offset of the ADC values. In a simple test project, using the ADC without calibration yields similar offsets. Performing the calibration as shown eliminates this issue:

LL_ADC_StartCalibration(VISENSE_ADC_INSTANCE, LL_ADC_SINGLE_ENDED);

Additionally, the two conversion formulas (voltage, current) use VDD_VALUE to calculate the actual voltage:

vadc = (ADCData * VDD_VALUE) / ADC_FULL_SCALE;

However, when jumper JP8 on the NUCLEO board is set to position 1-2, the external reference voltage with value 3.25V is used. This is the default. The two solutions would be:

  • Replace VDD_VALUE by 3250
  • The documentation for the X-NUCLEO-SRC1M1 or for x-cube-tcpp should indicate that JP8 needs to be set to 2-3

Since the measurements are not ratiometric, and the absolute values of both voltages are of interest, it would be desirable to keep using the fixed reference of 3.25V, and adjust the code accordingly.

Metadata

Metadata

Assignees

Labels

internal bug trackerIssue confirmed and reported into a ticket in the internal bug tracking system

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions