• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

CMakeLists.txtD18-Mar-2025481 1712

README.mdD18-Mar-20253 KiB7054

main.cD18-Mar-202513.8 KiB338158

prj.confD18-Mar-2025105 65

sample.yamlD18-Mar-20251.3 KiB3938

README.md

1# SAADC maxmimum performance {#saadc_maximum_performance}
2
3The sample demonstrates an advanced functionality of the nrfx_saadc driver operating at its peak performance.
4
5## Requirements
6
7The sample supports the following development kits:
8
9| **Board**           | **Support** |
10|---------------------|:-----------:|
11| nrf52dk_nrf52832    |      No     |
12| nrf52833dk_nrf52833 |     Yes     |
13| nrf52840dk_nrf52840 |     Yes     |
14| nrf5340dk_nrf5340   |     No      |
15| nrf9160dk_nrf9160   |     Yes     |
16
17## Overview
18
19Application initializes the nrfx_saadc driver and starts operating in the non-blocking mode.
20Sampling is performed at the highest supported frequency.
21In the sample @p m_single_channel is configured, and the SAADC driver is set to the advanced mode.
22To achieve the maximum performance, do the following:
23- Provide an external timer in order to perform sampling at @p MAX_SAADC_SAMPLE_FREQUENCY.
24  You can do this by setting up endpoints of the channel @p m_gppi_channels [ @p gppi_channels_purpose_t::SAADC_SAMPLING ] to trigger the SAADC sample task ( @p nrf_saadc_task_t::NRF_SAADC_TASK_SAMPLE ) on the TIMER COMPARE event.
25- Provide hardware start-on-end.
26  You can do this by setting up endpoints of the channel @p m_gppi_channels [ @p gppi_channels_purpose_t::SAADC_START_ON_END ] to trigger SAADC task start ( @p nrf_saadc_task_t::NRF_SAADC_TASK_START ) on the SAADC event end ( @p nrf_saadc_event_t::NRF_SAADC_EVENT_END ).
27
28@p nrfx_saadc_offset_calibrate triggers calibration in a non-blocking manner.
29Then, sampling is initiated at @p NRFX_SAADC_EVT_CALIBRATEDONE event in @p saadc_handler() by calling @p nrfx_saadc_mode_trigger() function.
30Consecutive sample tasks are triggered by the external timer at the sample rate specified in @p SAADC_SAMPLE_FREQUENCY symbol.
31
32In the example there is GPPI channel configured to test the functionality of SAADC.
33The endpoints are setup up in a way that connects the @p NRF_SAADC_EVENT_RESULTDONE event with the GPIOTE task toggling the @p OUT_GPIO_PIN pin.
34
35> For more information, see **SAADC driver - nrfx documentation**.
36
37## Wiring
38
39To run the sample correctly, connect pins as follows:
40* `LOOPBACK_PIN_1A` with `LOOPBACK_PIN_1B`.
41
42## Building and running
43
44To 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.
45## Sample output
46
47You should see the following output:
48
49```
50- "Starting nrfx_saadc maximum performance example."
51- "SAADC event: CALIBRATEDONE"
52- "SAADC event: READY"
53- "SAADC event: BUF_REQ"
54- "SAADC event: DONE"
55- "Sample buffer address == 0x([0-9a-z]{8})"
56- ".Sample 0. value == -?[0-9]"
57- ".Sample 1. value == ([0-9]{3})"
58- "SAADC event: BUF_REQ"
59- "SAADC event: DONE"
60- "Sample buffer address == 0x([0-9a-z]{8})"
61- ".Sample 0. value == -?[0-9]"
62- ".Sample 1. value == ([0-9]{3})"
63- "SAADC event: BUF_REQ"
64- "SAADC event: DONE"
65- ".Sample 0. value == -?[0-9]"
66- ".Sample 1. value == ([0-9]{3})"
67```
68[//]: #
69[Building and running]: <../../../README.md#building-and-running>
70