Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer HAL driver SDK15

Hi,

I am trying to run a simple LED blinking program using timer 0 using HAL library.

in functions such as 

  nrf_timer_bit_width_set (NRF_TIMER_Type *p_reg, nrf_timer_bit_width_t bit_width)

 

  nrf_timer_frequency_set (NRF_TIMER_Type *p_reg, nrf_timer_frequency_t frequency)

I tried passing the Timer 0 Memory location(mentioned in the nRF52 datasheet) to NRF_TIMER_Type, But I am getting the following error

main_timer.c(70): error: #167: argument of type "const NRF_TIMER_Type *" is incompatible with parameter of type "NRF_TIMER_Type *"
nrf_timer_mode_set(timer0_addr,NRF_TIMER_MODE_TIMER);

And the SDK documentation (Nordic info center) doesn't have any explanations for "NRF_TIMER_Type".

1. How to point the register structure? 

2. I tried finding the nrf_timer.c file, but couldn't find it, where are the HAL function routines?

Parents
  • Hi,

    1. NRF_TIMER_Type is defined in the MDK. For nRF52832, it is defined in the file nrf52.h, which can be found in nRF5_SDK_15.0.0_a53641a\modules\nrfx\mdk\nrf52.h. You should use the defined symbols NRF_TIMERx, where x is the timer number (0-4 for nRF52832), for this argument when using the HAL functions.
    2. There are no file nrf_timer.c in the SDK, only a header file: nrf_timer.h. This HAL driver implementations can be found in nRF5_SDK_15.0.0_a53641a\modules\nrfx\hal.

    Best regards,
    Jørgen

Reply
  • Hi,

    1. NRF_TIMER_Type is defined in the MDK. For nRF52832, it is defined in the file nrf52.h, which can be found in nRF5_SDK_15.0.0_a53641a\modules\nrfx\mdk\nrf52.h. You should use the defined symbols NRF_TIMERx, where x is the timer number (0-4 for nRF52832), for this argument when using the HAL functions.
    2. There are no file nrf_timer.c in the SDK, only a header file: nrf_timer.h. This HAL driver implementations can be found in nRF5_SDK_15.0.0_a53641a\modules\nrfx\hal.

    Best regards,
    Jørgen

Children
Related