SAADC internal timer setup requirements for continuous mode

Hi there,

I'm using the product specification of the nRF52840 to program the SAADC in continuous mode using its internal timer. I'm not able to use your SDK. Unfortunately, I'm having difficulty in getting a repeated sampling to occur. I can get one-shot sampling working very well.

I'm doing everything per https://infocenter.nordicsemi.com/topic/ps_nrf52840/saadc.html?cp=4_0_0_5_22_3#saadc_easydma and Figure 4, sans firing the SAMPLE task. My expectation is that the SAMPLE task is fired by the internal timer of the SAADC. I see the STARTED event but then nothing else. I then read https://devzone.nordicsemi.com/f/nordic-q-a/73186/nrf52840-saadc-continuous-sampling-not-started-with-task_start and saw that a SAMPLE task should be issued after the first START task to kick things off (there being an omission in the product specification). When I do issue an initial SAMPLE task, I see the STARTED event and then an END event with samples... At this point, I issue another START task (as per Figure 4), but I don't see any more END events.

Here's the logging of events with the initial SAMPLE task included:

0 INFO Started
1 INFO Done
2 INFO Result done
3 INFO Done
4 INFO Result done
5 INFO Ended
6 INFO sample len=500
7 INFO Started

I'm logging Stopped events also, but not seeing them (which is good).

My sample rate is specified as 1600 and I also set TIMER mode. I'm using double-buffering, each buffer sized for 500 samples, and swap buffers on processing the Started event. There is just one channel configured.

Thanks for any help or guidance.

Kind regards,
Christopher

Parents Reply Children
  • Hello again, Christopher

    Christopher Hunt said:
    we found the problem. It was of our own making. :-) We simply forgot to re-enable the END and STARTED interrupts. Sorry for the noise here.

    No need to apologize, I am happy to hear that you were able to identify and resolve the issue so quickly! :) 

    Christopher Hunt said:
    The PR with the fixes is at: github.com/.../425

    Thank you for providing the PR for completeness - this will be helpful for other forum-users using Rust and the SAADC.

    Christopher Hunt said:
    Happy to review anything they draft, so please reach out if required. I'm keen that we're able to operate from the product specifications. We've been able to do so with a great deal of success for the other peripherals as the documentation is excellent in general.

    Thank you for saying that - I too absolutely think that this should be an option just as viable as using the provided drivers. The Product Specification should contain any and all relevant information about the SAADC needed to create a driver, no doubt.

    As mentioned in the other ticket you referenced, you could also take a look at the SAADC documentation for the nRF52832 since it currently is more fleshed out wrt. the different operating modes of the SAADC. I have already opened an internal ticket on this as well, to have the technical writers include this section in the nRF52840's SAADC documentation as well. The previously mentioned missing required SAMPLE task trigger for continuous mode is unfortunately not present here either. 

    Please do not hesitate to open another ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Related