Hi,
I need to activate one pin just before the sample is taken on a saadc channel. I have settings as in saadc example.
How can I do this? Is there any event that I can handle to do that? and where.
Thanks!
Hi,
I need to activate one pin just before the sample is taken on a saadc channel. I have settings as in saadc example.
How can I do this? Is there any event that I can handle to do that? and where.
Thanks!
Hi,
The SAADC example in the SDK is configured to trigger the sample task using PPI, on the compare event from a timer. If you want to set a pin before sampling, you have two options:
Option 1 is quite simple to implement in the SAADC example project. These instructions are for main.c in SDK 14.2.0:
Enable interrupt for timer compare
event by setting the enable_int
parameter to
nrf_drv_timer_extended_compare()
to
true
on line 104.
Setup timer_handler to set pin and trigger sample task:
void timer_handler(nrf_timer_event_t event_type, void * p_context)
{
// Set GPIO pin and add necessary delay before sampling can start
nrf_drv_saadc_sample(); // Trigger SAADC sample task
}
Remove/comment out code configuring PPI to trigger SAADC sample task (line 57, 76, 90-91, 107-118, 122-127, and 191).
Best regards,
Jørgen
Hi,
The SAADC example in the SDK is configured to trigger the sample task using PPI, on the compare event from a timer. If you want to set a pin before sampling, you have two options:
Option 1 is quite simple to implement in the SAADC example project. These instructions are for main.c in SDK 14.2.0:
Enable interrupt for timer compare
event by setting the enable_int
parameter to
nrf_drv_timer_extended_compare()
to
true
on line 104.
Setup timer_handler to set pin and trigger sample task:
void timer_handler(nrf_timer_event_t event_type, void * p_context)
{
// Set GPIO pin and add necessary delay before sampling can start
nrf_drv_saadc_sample(); // Trigger SAADC sample task
}
Remove/comment out code configuring PPI to trigger SAADC sample task (line 57, 76, 90-91, 107-118, 122-127, and 191).
Best regards,
Jørgen
Hi,
I did follow exactly the instructions in your post but after doing that the sompling does not start after boot. Do I need to start the saadsc timer somehow?
Thanks in advace, Jacek
Hi,
I had to change the timer. All working now. Thanks a lot for help!