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

Timer and PWM (and BLE) in nRF5 v12

(Building with nRF5 12.2.0 / armgcc)

I want to do bursts of pulses using PWM for the pulses and a TIMER to enable the bursts. I need this to be non-blocking so I can also use BLE.

Now PWM uses a timer so its inner timer will be controlled by an outer timer.

The first challenge is to make sure that the two timers are different.

APP_PWM_INSTANCE(PWM1,1); // seems to say to use Timer1
nrf_drv_timer_init(&TIMER_LED, &timer_cfg, timer_led_event_handler);
.. where timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
.. which in turn does not specify a timer (.p_context = NULL)

So how can one tell the outer timer to be other than Timer1??

and BTW there's another strange thing happening when I try to build this.

#include "app_pwm.h"
err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);

gives

undefined reference to app_pwm_init

Is hard to understand as the problem goes away if I revert to the PWM example without the outer timer.

Any suggestions appreciated?

Related