This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52 SAADC, which timer

Hi,

nRF5_SDK_11.0.0_89a8197\examples\peripheral\saadc\pca10040\arm5_no_packs

Which timer is used in this example? RTC timer or Timer0-4 ? I can not find it.

Thanks!

  • This example using Timer0 to generate regular compare event. At the beginning of the code, it declared a timer instance using NRF_DRV_TIMER_INSTANCE(0). Take a look at this macro:

    /**
     * @brief Macro for creating a timer driver instance.
     */
    #define NRF_DRV_TIMER_INSTANCE(id) \
    {                                                             \ 
        .p_reg            = CONCAT_2(NRF_TIMER, id),              \ 
        .instance_id      = CONCAT_3(TIMER, id, _INSTANCE_INDEX), \ 
        .cc_channel_count = NRF_TIMER_CC_CHANNEL_COUNT(id),       \ 
    } 
    

    And also, in the config/nrf_drv_config.h, you can find:

    /* TIMER */
    #define TIMER0_ENABLED 1
    
    #if (TIMER0_ENABLED == 1)
    #define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
    #define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
    #define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
    #define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
    
    #define TIMER0_INSTANCE_INDEX      0
    #endif
    
Related