Skip to content

EFM32: Scaling of analogin_read incorrect #5115

@seppestas

Description

@seppestas

Description

  • Type: Bug
  • Priority: Minor

Bug

Target
EFM32

Expected behavior
AnalogIn::read should return a value from 0.0 to 1.0

Actual behavior
AnalogIn::read returns a value from 0.0 to 0xFFF0/0XFFFF = 0,99977111467155.

Cause
analogin_read_u16 returns a value in the range 0x0000 - 0xFFF0 since the resolution of the ADC is 12 bits. However, in analogin_read this value gets divided by 0xFFFF assuming the range is 0x0000-0xFFFF. This causes a small error in the value returned by AnalogIn::read for the EFM32 target.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions