nRF51422-BLE工作时如何使用定时器中断?

时间:2019-05-07 11:57:17

标签: bluetooth-lowenergy interrupt nrf51

我正在尝试在nRF51422上使用计时器中断。我正在使用S130 sofdevice。我按照以下代码配置了计时器:

void configure_timer()  // Saniyede bir tiki if bloku içinde vuran Timer
{
    NRF_TIMER1->MODE        = TIMER_MODE_MODE_Timer;
    NRF_TIMER1->TASKS_CLEAR = 1;
    NRF_TIMER1->PRESCALER   = 8;
    NRF_TIMER1->BITMODE     = TIMER_BITMODE_BITMODE_16Bit;
    NRF_TIMER1->CC[0]       = 62500;

    NRF_TIMER1->INTENSET = (TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos);
    NVIC_EnableIRQ(TIMER1_IRQn);

    NRF_TIMER1->TASKS_START = 1;
}

我还在尝试配置BLE与服务器通信。当我将代码构建并加载到板上时,它给我有关低频时钟源的错误。我看到该错误发生在评估板尝试初始化BLE堆栈时。堆栈初始化代码如下。

static void ble_stack_init(ble_evt_handler_t ble_evt_dispatcher)
{
    uint32_t err_code;

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

    ble_enable_params_t ble_enable_params;
    err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
                                                    PERIPHERAL_LINK_COUNT,
                                                    &ble_enable_params);
    APP_ERROR_CHECK(err_code);

    //Check the ram settings against the used number of links
    CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);

    // Enable BLE stack.
    err_code = softdevice_enable(&ble_enable_params);
    APP_ERROR_CHECK(err_code);

    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatcher);
    APP_ERROR_CHECK(err_code);
}

问题出在SOFTDEVICE_HANDLER_INIT(...);线。错误代码:4097

您认为我做错了什么?

0 个答案:

没有答案