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

ADC Conversion using 4096Hz for nRF52832 Chip?

Hello Sir,

We are using nRF52832 chip and Softdevice is S132. Is it possible to sample an analog signal using internal ADC conversion using 4096Hz?. Its look like it does at 3900Hz.

Thanks in Advance..

  • PPI sampling with RTC is setup very similar to PPI sampling with TIMER, if you use the drivers in the SDK. You only need to change the function that get the address of the compare event from timer, into the funtion that get the compare event from RTC:

    uint32_t timer_compare_event_addr = nrf_drv_rtc_event_address_get(&rtc,NRF_RTC_EVENT_COMPARE_0);
    
  • Thanks Jorgen, As per you told me i changed the function is

    uint32_t timer_compare_event_addr = rf_drv_rtc_event_address_get(&rtc,NRF_RTC_EVENT_COMPARE_0);
    

    it give error for &m_timer unresolve So i uncomment in my code is

    static const nrf_drv_timer_t   m_timer = NRF_DRV_TIMER_INSTANCE(3); 
    

    but it for timer peripheral. NRF_Timer frequency as sampling rate but this all parameter is use for timer peripheral is it write. What should i do for other parameter like NRF timer frequency sampling rate etc. If i set same as it is and sampling rate set is 125ms. Then i have test this function but it consume lots power it near about 5.56mA while BLE broadcasting. When transmitting adc value to android app at that time peak current is 7.2mA. Why this more power consume?

  • I don't know how you have setup RTC, but you should make sure you do not enable interrupt if you want to trigger the sampling through PPI. You also need to clear the RTC after getting the compare event. This can also be done using PPI. I will edit my answer above with a working main.c file for ble_app_uart__saadc_timer_driven__scan_mode that implement sampling using RTC over PPI. Note that you need to include the nrf_drv_rtc.c source file, and enable RTC in sdk_config.h.

  • Thanks you so much Jorgen, Now my program is working as per you refer me, But problem is current consumption. In my old program using Timer peripheral ADC the current consumption is 5mA with BLE advertising. But now when i implement my code into RTC over PPI current consumption is 5.78mA. If i use RTC the current consumption it will reduce because RTC is low power consumption instead of timer. Can you tell why current consumption increase in my device. My device is operate on battery so to reduce current consumption is important for me.

  • How do you measure the current? If 5 mA is your average current consumption with only advertising, this seems quite high. switching to RTC for sampling should not increase your current consumption. Do you have approximately the same sample rate with both setups? The EasyDMA current (~2mA) enabled with the SAADC could be limited by disabling the SAADC between samples, as shown in the low power SAADC example, but with your samplerate, you might not gain much on this either. Could you upload your applications for debugging?

Related