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..

Parents
  • Hi,

    If you trigger sampling through PPI on an RTC event, it should be possible to achieve 4096 Hz. The RTC runs at 32.768 kHz, and a CC value of 8 should give you your desired frequency. If you are triggering sampling from interrupt event, the softdevice might delay sampling if higher priority events occurs, giving you a lower sample rate than expected.

    Note this issue if you are triggering sampling through PPI, and have multiple SAADC channels enabled.

    [EDIT]: Added main.c file that implements sampling triggered by RTC over PPI in ble_app_uart__saadc_timer_driven__scan_mode example: main.c

    Best regards,

    Jørgen

  • Hi sir, I trigger sample through PPI on an RTC, but it achieved 3900Hz. The following have my program function in saadc sampling event init:

    nrf_drv_timer_config_t timer_config = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_config.frequency = NRF_TIMER_FREQ_31250Hz;
    err_code = nrf_drv_timer_init(&m_timer, &timer_config, timer_handler);
    APP_ERROR_CHECK(err_code);
    /* setup m_timer for compare event */
    uint32_t ticks = nrf_drv_timer_us_to_ticks(&m_timer,SAADC_SAMPLE_RATE);
    nrf_drv_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
    nrf_drv_timer_enable(&m_timer);
    
    uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&m_timer, NRF_TIMER_CC_CHANNEL0);
    

    and in this function CC value is as per the following: Sampling Rate = 256us

    m_timer = NRF_DRV_TIMER_INSTANCE(3);
    
Reply
  • Hi sir, I trigger sample through PPI on an RTC, but it achieved 3900Hz. The following have my program function in saadc sampling event init:

    nrf_drv_timer_config_t timer_config = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_config.frequency = NRF_TIMER_FREQ_31250Hz;
    err_code = nrf_drv_timer_init(&m_timer, &timer_config, timer_handler);
    APP_ERROR_CHECK(err_code);
    /* setup m_timer for compare event */
    uint32_t ticks = nrf_drv_timer_us_to_ticks(&m_timer,SAADC_SAMPLE_RATE);
    nrf_drv_timer_extended_compare(&m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
    nrf_drv_timer_enable(&m_timer);
    
    uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&m_timer, NRF_TIMER_CC_CHANNEL0);
    

    and in this function CC value is as per the following: Sampling Rate = 256us

    m_timer = NRF_DRV_TIMER_INSTANCE(3);
    
Children
No Data
Related