This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52840 DK, SAADC, and HFXO

Hello, all.

I am working on a project in which I got to sample a signal that has a minimum frequency of 1Hz and a maximum frequency of 10kHz (The full range must be faithfully sampled and transmitted) and stream the sampled data via BLE to an Android device. Overall, I made the thing work, not perfectly, however. I am having problems sampling certain frequency ranges. If I configure the SAADC:

  • No Oversample mode
  • Gain 1/6
  • 8-bits
  • Vdd/4 Reference

When configured as above, the performance is relatively good for frequencies above 5kHz. But the signal is significantly distorted for lower frequencies, especially, under 1kHz.

If I enable Oversampling, on the other hand, the data is perfectly sampled for frequencies under 1kHz, but the signal is distorted above that.

From the datasheet of the NRF52840, on the last page of the SAADC chapter, I see that the performance is increased when the HFXO is used. In the Segger Embedded Studio debugger, I see that the HFCLKSTAT, field SRC is configured as RC (HFINT source). I would like to test the sampling with the HFXO as the source.

First of all, is the ADC in the NRF52840 capable of correctly sample this whole range of frequencies? Secondly, how could I configure the high-frequency clock to have the HFXO as a source?

Parents
  • Hi,

    What is the sample-rate you are using for sampling? Enabling oversampling will reduce the effective maximum sample-rate, as the SAADC needs to capture N number of samples for each channel before performing the averaging, so it makes sense that enabling oversampling may distort the higher frequency signals if the sample rate is not kept high enough. I can't explain why the lower frequency signals are distorted without oversampling though.

    Can you give some example output or plots of the distorted samples compared to the original signal, to give a better understanding of the problem?

    The source of the HFCLK is not configured per se, but it is used whenever it is started by triggering the HFCLKSTART task:

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);

    Best regards,
    Jørgen

  • Hello.

    I tested two channels ADC and sent the data via UART to a terminal after reorganizing the samples, a necessary step since ADC stores the samples in an alternate fashion. I tested signals with 10kHz and 20kHz frequencies.

    This is how the waveforms look like:

    At 10kHz:

    At 20kHz:

    This probably means that if there is a problem it is with the BLE transmission, either in the client or the server.

Reply Children
Related