This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Blocking BLE_STACK_HANDLER_INIT

Dear Support Team,

currently I'm working on a custom board which contains the NRF51822_QFAB_A0. I installed the softdevice (not the most recent version, but a version that worked on the development board NRF51822_QFAA).

Now every time I call BLE_STACK_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, BLE_L2CAP_MTU_DEF, ble_evt_dispatch, true);

the device hangs. What can be the reason for this? (I also tried different other clock sources.)

Thank you and best, Peer.

Parents
  • This could happen if your 16MHz crystal is not able to spin up. Try spinning it up directly to check:

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) 
    {
    }
    
    

    (turn on an LED after this code block or something)

  • Hi,

    I have a similar issue with a nRF58122 board from China (Xuntong PTR 9048-B). Not sure what to do next.

    I am using the ble_app_hrs sample code which seems to work fine on the Evaluation Kit but fails on this board. I debugged this and the code seems to get stuck. What's next?

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
    

    More info: the SoC hardware revision is QFAAC0 and I am using the 6.0.0 S110 soft device.

    I also ensured that I wait for both EVENTS_LFCLKSTARTED and EVENTS_LFCLKSTARTED to be set to 1 (BTW, maybe I am missing something but the code mentioned in the previous post starts the HF clock but tests for the LF clock?). This is the code I used:

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    {
    }
    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
    }
    
Reply
  • Hi,

    I have a similar issue with a nRF58122 board from China (Xuntong PTR 9048-B). Not sure what to do next.

    I am using the ble_app_hrs sample code which seems to work fine on the Evaluation Kit but fails on this board. I debugged this and the code seems to get stuck. What's next?

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
    

    More info: the SoC hardware revision is QFAAC0 and I am using the 6.0.0 S110 soft device.

    I also ensured that I wait for both EVENTS_LFCLKSTARTED and EVENTS_LFCLKSTARTED to be set to 1 (BTW, maybe I am missing something but the code mentioned in the previous post starts the HF clock but tests for the LF clock?). This is the code I used:

    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    
    while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
    {
    }
    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
    }
    
Children
No Data
Related