Code Snippets NOTE: The timer works but has Jitter ============================================================================== // Main() startup calls for BLE using SDK S132 v7.0.1 // 1) HFXO Startup fails here // Basic startup log_init(); timers_init(); // Application timers in OS (1Hz) buttons_leds_init(&erase_bonds); power_management_init(); // BLE Startup ble_stack_init(); memset(&mac_addr, 0, sizeof(mac_addr)); sd_ble_gap_addr_get(&mac_addr); gap_params_init(); gatt_init(); advertising_init(); services_init(); conn_params_init(); peer_manager_init(); init_my_timer(); // 2) HFXO Startup fails here application_timers_start(); advertising_start(erase_bonds); // 3) HFXO Startup fails here ============================================================================== // Attempt to start the HFClock using HFXO // Fails in all 3 locations above // The while loop never quits ??? static uint32_t * p_is_running; sd_clock_hfclk_is_running(p_is_running); if (!p_is_running){ //NRF_CLOCK->TASKS_HFCLKSTART = 1; sd_clock_hfclk_request(); // Force the use of the external HFXO? while (!p_is_running) sd_clock_hfclk_is_running(p_is_running); } ============================================================================== // Timer init code static const nrf_drv_timer_t m_timer3 = NRF_DRV_TIMER_INSTANCE(3); // Internal timer[3] nrf_drv_timer_config_t timer_cfg = NRFX_TIMER_DEFAULT_CONFIG; void init_my_timer() { timer_cfg.frequency = NRF_TIMER_FREQ_16MHz; // Use the HF Clock timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32; err_code = nrfx_timer_init(&m_timer3, &timer_cfg, timer3_event_handler); APP_ERROR_CHECK(err_code); nrfx_timer_extended_compare(&m_timer3, NRF_TIMER_CC_CHANNEL0, nrf_drv_timer_us_to_ticks(&m_timer3, 50) // Init 50uS timer NOTE: This is off by about 2uS NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true); } ============================================================================== // Note I can use buttons to start/stop this timer on the nRF52 SD nrfx_timer_enable(&m_timer3); // Start the timer nrfx_timer_disable(&m_timer3); // Stop the timer ============================================================================== // Timer IRQ handler static bool timer3_trig_state = false; static void timer3_event_handler(nrf_timer_event_t event_type, void * p_context) { // Toggle PO.13 (D2) every 50uS if (timer3_trig_state){ *gpio_outclr_cfg = 1UL<