[riot-notifications] [RIOT-OS/RIOT] cpu/qn908x: ADC support (#15847)

iosabi notifications at github.com
Sun Jan 24 18:40:59 CET 2021


### Contribution description

The ADC in the QN908x cpu offers multiple options for ADC conversion using up to 8 external pins, one external reference pin and some internal signals like a 1.2V reference, Vss, Vcc and an internal temperature monitor.

This patch implements support for sampling ADC values from the ADC lines defined in the board configuration. Some configurations are really always present and don't require a board configuration, like the Vcc or internal temperature monitor but to coexist with other board ADC line options they are only set as part of the board configuration.

There are some limitations in what's implemented in this ADC module as outlined in the adc.c documentation. Namely the ADC block support a whole lot of more settings, but this patch implements enough to make it work for the common use case.

The sampled temperature value in Volts indeed varies with the temperature, but the correction factors in the factory calibration parameters are not present in my board and the default values in the vendor library don't make sense for the numbers I see. A future commit could provide a temperature reading in Celsius and deal with the calibration constants, but this is not really in scope for the adc.h interface.

### Testing procedure

Set the Analog inputs on hardware to different voltage values with a pair of resistors and compared the uV measured values against a multimeter getting values within a few mV of difference.

Checked that the temperature reading varies when warming up the CPU, and changes back to the original levels.

Used `tests/periph_adc` for testing, and modified the `RES` resolution to the custom `ADC_RES_UV` value to get uV samples and test the reference voltage as well.

### Issues/PRs references

This is part of FR #13852 .


You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15847

-- Commit Summary --

  * cpu/qn908x: Implement ADC support
  * boards/qn9080dk: Add ADC configuration

-- File Changes --

    M boards/qn9080dk/Kconfig (3)
    M boards/qn9080dk/Makefile.features (1)
    M boards/qn9080dk/include/periph_conf.h (23)
    M cpu/qn908x/Kconfig (9)
    M cpu/qn908x/doc.txt (77)
    M cpu/qn908x/include/periph_cpu.h (179)
    A cpu/qn908x/periph/adc.c (338)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15847.patch
https://github.com/RIOT-OS/RIOT/pull/15847.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15847
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210124/037f39a8/attachment.htm>


More information about the notifications mailing list