Hello People,
I was working on the example program of timer (PCA10056) and it was working fine, but when I change the same code to work on PCA10100 it is not showing any error still the timer is not working.
#define LED_PIN 13
#define LED_PIN_MIN 14
#define TIMER_INTERVAL_MS 1000
const nrfx_timer_t timer1 = NRFX_TIMER_INSTANCE(1);
static void timer1_callback(nrf_timer_event_t event_type, void* p_context)
{
switch (event_type)
{
case NRF_TIMER_EVENT_COMPARE0:
count++;
nrf_gpio_pin_toggle(LED_PIN);
if(count == 60)
{
nrf_gpio_pin_toggle(LED_PIN_MIN);
count = 0;
}
break;
default:
break;
}
}
int main(void)
{
uint32_t time_ticks;
nrf_gpio_cfg_output(LED_PIN_MIN);
nrf_gpio_cfg_output(LED_PIN);
nrf_gpio_pin_clear(LED_PIN_MIN);
nrf_gpio_pin_clear(LED_PIN);
nrfx_timer_config_t timer1_config = NRFX_TIMER_DEFAULT_CONFIG;
APP_ERROR_CHECK(nrfx_timer_init(&timer1, &timer1_config, timer1_callback));
time_ticks = nrfx_timer_ms_to_ticks(&timer1, TIMER_INTERVAL_MS);
nrfx_timer_extended_compare(
&timer1, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
nrfx_timer_enable(&timer1);
while (1)
{
__WFI();
}
}