hi,
I want to know why app_timer and nrf_drv_timer conflict。App_timer is used to broadcast data。When App_timer time out ,timer1 start.
Cannot broadcast data after initializing timer1 in main function。Here is the code, please help me solve this problem
#ifndef TIMER_ENABLED #define TIMER_ENABLED 1 #endif #ifndef TIMER1_ENABLED #define TIMER1_ENABLED 1 #endif void timer_sampling_event_handler(nrf_timer_event_t event_type, void* p_context) { switch(event_type) { case NRF_TIMER_EVENT_COMPARE0: temperature_calculate(); break; default: //Do nothing. break; } } const nrf_drv_timer_t TIMER_SAMPLING = NRF_DRV_TIMER_INSTANCE(1); void my_timer_init(uint32_t time_ms) { uint32_t time_ticks; uint32_t err_code = NRF_SUCCESS; //Configure TIMER_SAMPLING for generating simple light effect - leds on board will invert his state one after the other. err_code = nrf_drv_timer_init(&TIMER_SAMPLING, NULL, timer_sampling_event_handler); //NULL ĬÈÏΪ16λ¶¨Ê±Æ÷ ʱÖÓÆµÂÊΪ1M ʱÖÓԴλ1M½µµÍ¹¦ºÄ 3-8uA APP_ERROR_CHECK(err_code); time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SAMPLING, time_ms); nrf_drv_timer_extended_compare( &TIMER_SAMPLING, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); nrf_drv_timer_enable(&TIMER_SAMPLING); } static void timers_init(void) { ret_code_t err_code; // Initialize timer module, making it use the scheduler APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); err_code = app_timer_create(&m_adv_timer_id, APP_TIMER_MODE_REPEATED, adv_timeout_handler); APP_ERROR_CHECK(err_code); err_code = app_timer_start(m_adv_timer_id, APP_TIMER_TICKS(broast_cycle,0), NULL); //Æô¶¯¶¨Ê±Æ÷ APP_ERROR_CHECK(err_code); } int main(void) { ret_code_t err_code; ret_code_t poweron_flag=0; // Initialize. err_code = NRF_LOG_INIT(NULL); APP_ERROR_CHECK(err_code); leds_init(); timers_init(); //app_timer_init buttons_init(); WD3703_Init(); //temperature sampling init p0.11 my_timer_init(SAMPLING_COMPLETED_CYCLE); //timer1 init ble_stack_init(); gap_params_init(); services_init(); advertising_data_set(); conn_params_init(); // Start execution. NRF_LOG_INFO("Blinky Start!\r\n"); // Enter main loop. for (;;) { if (NRF_LOG_PROCESS() == false) { power_manage(); } } }