Hello ,
I use SDK 15.3 , chip is 52811
I refer to the example of 52840 "examples \ peripheral \ timer"
The following is the example code, I have not changed it.
const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(0);
void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
{
static uint32_t i;
uint32_t led_to_invert = ((i++) % LEDS_NUMBER);
switch (event_type)
{
case NRF_TIMER_EVENT_COMPARE0:
bsp_board_led_invert(led_to_invert);
break;
default:
//Do nothing.
break;
}
}
int main(void)
{
uint32_t time_ms = 500; //Time(in miliseconds) between consecutive compare events.
uint32_t time_ticks;
uint32_t err_code = NRF_SUCCESS;
bsp_board_init(BSP_INIT_LEDS); // Configure all leds on board.
//Configure TIMER_LED for generating simple light effect - leds on board will invert his state one after the other.
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init(&TIMER_LED, &timer_cfg, timer_led_event_handler);
APP_ERROR_CHECK(err_code);
time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_LED, time_ms);
nrf_drv_timer_extended_compare(
&TIMER_LED, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
nrf_drv_timer_enable(&TIMER_LED);
while (1)
{
__WFI();
}
}
Than, I am trying to add a Timer code to my project "ble_app_uart"
After adding main.c, I only modified 3 places.
/* ----- Timer1 ----- */
const nrf_drv_timer_t TIMER1_SPI_W25Q16 = NRF_DRV_TIMER_INSTANCE(1);
/* ----- I want USART Output ----- */
void timer_event_handler(nrf_timer_event_t event_type, void* p_context)
{
switch (event_type)
{
case NRF_TIMER_EVENT_COMPARE0:
app_uart_put(0x01);
break;
default:
//Do nothing.
break;
}
}
/* -----Maybe channel 0 corresponds to Timer0, I changed to channel 1 ----- */
nrf_drv_timer_extended_compare(
&TIMER1_SPI_W25Q16, NRF_TIMER_CC_CHANNEL1, time_ticks, NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, true);
And, sdk_config.h

Am I still missing a step? So Timer1 is not executed?
In addition, I would like to ask, what is NRFX?
Because there are two, "NRFX_TIMER_ENABLE" and "TIMER_ENABLED"
Thanks.