1# SAADC advanced blocking {#saadc_advanced_blocking} 2 3The sample demonstrates an advanced functionality of the nrfx_saadc driver operating in the blocking mode. 4 5## Requirements 6 7The sample supports the following development kits: 8 9| **Board** | **Support** | 10|---------------------|:-----------:| 11| nrf52dk_nrf52832 | Yes | 12| nrf52833dk_nrf52833 | Yes | 13| nrf52840dk_nrf52840 | Yes | 14| nrf5340dk_nrf5340 | Yes | 15| nrf9160dk_nrf9160 | Yes | 16 17## Overview 18 19Application initializes the nrfx_saadc driver and starts operating in the blocking mode. 20Program works as a simple state machine and starts in state @p m_current_state == STATE_SINGLE_CONFIG. 21In this state the following configurations apply: 22- STATE_SINGLE_CONFIG - SAADC driver is configured to work with only one channel ( @p m_single_channel ) in the blocking mode. 23 Afterward, @p m_current_state changes to STATE_SINGLE_SAMPLING. 24- STATE_SINGLE_SAMPLING - sampling on a single channel ( @p m_single_channel ) is performed a specified number of times ( @p SAMPLING_ITERATIONS ), and then @p m_current_state changes to STATE_MULTIPLE_CONFIG. 25- STATE_MULTIPLE_CONFIG - SAADC driver is configured to work with multiple channels ( @p m_multiple_channels ) in the blocking mode. 26 Afterward, @p m_current_state changes to STATE_MULTIPLE_SAMPLING. 27- STATE_MULTIPLE_SAMPLING - sampling on multiple channels ( @p m_multiple_channels ) is performed specified number of times ( @p SAMPLING_ITERATIONS ). 28 29Before every sampling a calibration in the blocking manner is performed. Sampling is then invoked 30by the @p nrfx_saadc_mode_trigger() function. 31 32In the sample there are GPIOTE tasks configured to toggle the specified ( @p m_out_pins ) loopback pins. Those tasks are triggered between successive samplings to verify the functionality of the SAADC on the nonconstant analog signal. 33 34> For more information, see **SAADC driver - nrfx documentation**. 35 36## Wiring 37 38To run the sample correctly, connect pins as follows: 39* `LOOPBACK_PIN_1A` with `LOOPBACK_PIN_1B`. 40 41## Building and running 42 43To run this sample, build it for the appropriate board and then flash it as per instructions in [Building and running](@ref building_and_running) section. 44 45## Sample output 46 47You should see the following output: 48 49``` 50- "Starting nrfx_saadc advanced blocking example." 51- "Calibration in the blocking manner finished successfully." 52- "Sampling 1 / 5" 53- ".Sample 0. value == ([0-9]{3})" 54- ".Sample 1. value == ([0-9]{3})" 55- "Calibration in the blocking manner finished successfully." 56- "Sampling 2 / 5" 57- ".Sample 0. value == -?[0-9]" 58- ".Sample 1. value == -?[0-9]" 59- "Calibration in the blocking manner finished successfully." 60- "Sampling 3 / 5" 61- ".Sample 0. value == ([0-9]{3})" 62- ".Sample 1. value == ([0-9]{3})" 63- "Calibration in the blocking manner finished successfully." 64- "Sampling 4 / 5" 65- ".Sample 0. value == -?[0-9]" 66- ".Sample 1. value == -?[0-9]" 67- "Calibration in the blocking manner finished successfully." 68- "Sampling 5 / 5" 69- ".Sample 0. value == ([0-9]{3})" 70- ".Sample 1. value == ([0-9]{3})" 71``` 72[//]: # 73[Building and running]: <../../../README.md#building-and-running> 74