![]() |
nrfx 4.5.0
|
The sample demonstrates an advanced functionality of the nrfx_saadc driver operating in the blocking mode.
The sample supports the following development kits:
| Board | Support |
|---|---|
| nrf52dk_nrf52832 | Yes |
| nrf52833dk_nrf52833 | Yes |
| nrf52840dk_nrf52840 | Yes |
| nrf5340dk_nrf5340 | Yes |
| nrf54l15dk_nrf54l15 | Yes |
| nrf9160dk_nrf9160 | Yes |
Application initializes the nrfx_saadc driver and starts operating in the blocking mode. Program works as a simple state machine and starts in state m_current_state == STATE_SINGLE_CONFIG. In this state the following configurations apply:
m_single_channel ) in the blocking mode. Afterward, m_current_state changes to STATE_SINGLE_SAMPLING.m_single_channel ) is performed a specified number of times ( SAMPLING_ITERATIONS ), and then m_current_state changes to STATE_MULTIPLE_CONFIG.m_multiple_channels ) in the blocking mode. Afterward, m_current_state changes to STATE_MULTIPLE_SAMPLING.m_multiple_channels ) is performed specified number of times ( SAMPLING_ITERATIONS ).Before every sampling a calibration in the blocking manner is performed. Sampling is then invoked by the nrfx_saadc_mode_trigger() function.
In the sample there are GPIOTE tasks configured to toggle the specified ( m_out_pins ) loopback pins. Those tasks are triggered between successive samplings to verify the functionality of the SAADC on the nonconstant analog signal.
For more information, see SAADC driver - nrfx documentation.
To run the sample correctly, connect pins as follows:
LOOPBACK_PIN_1A with LOOPBACK_PIN_1B.To run this sample, build it for the appropriate board and then flash it as per instructions in Building and running section.
You should see the following output: