Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented May 25, 2023

Pull Request Overview

This pull request adds an implementation of hil::adc::AdcHighSpeed for the nRF52.

The main issue is that the internal clock divider for the SAADC only allows dividing a 16 MHz clock by a value in the range 80 to 2047 (so 8 kHz to 200 kHz sampling). So there is a limited range of possible frequencies. This is also why it's hard to implement continuous sampling.

This also adds VDD detection to the calibrate step, since the nRF52840dk uses a 3V reference and I couldn't figure out why my ADC readings were wrong.

Testing Strategy

Using the libtock-c adc app.

TODO or Help Wanted

How good of a driver do we need?

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the chips/nrf Change pertains to the nRF5x family of MCUs. label May 25, 2023
@bradjc bradjc force-pushed the nrf52-adc-highspeed branch from d9f6a17 to 87ed018 Compare May 25, 2023 17:04
lschuermann
lschuermann previously approved these changes May 31, 2023
lschuermann
lschuermann previously approved these changes Jun 14, 2023
ppannuto
ppannuto previously approved these changes Jun 28, 2023
Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the default VREF setting up a level so that some other caller of adc::new() could set something else if needed. @bradjc I'll leave this for you to click merge in case there was some reason you'd not done that I didn't see.

@bradjc
Copy link
Contributor Author

bradjc commented Jun 28, 2023

Rebased. Looks good to me.

@ppannuto ppannuto added this pull request to the merge queue Jun 29, 2023
Merged via the queue into master with commit 0ef320e Jun 29, 2023
@alevy alevy deleted the nrf52-adc-highspeed branch June 30, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chips/nrf Change pertains to the nRF5x family of MCUs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants