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

Multilink central example stuck at SOFTDEVICE_HANDLER_INIT

I'm trying the multilink central example with s120 and SDK 7.2 (because of simple_uart). However, my PCA10028 board gets stuck at this macro:

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, false);

How can I solve this? (I'm using Keil 5)

The main is the only file I've altered main.c

Parents
  • Hi Olivier,

    It seems like the softdevice thinks that UART0 is a protected block and sd_softdevice_enable fails with an error when it sees that you have enabled UART0 interrupts.

    there is a check for this error in softdevice_handler.h

    #define SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,                                                      \
                                    EVT_HANDLER)                                                     \
        do                                                                                             \
        {                                                                                              \
            static uint32_t BLE_EVT_BUFFER[CEIL_DIV(BLE_STACK_EVT_MSG_BUF_SIZE, sizeof(uint32_t))];    \
            uint32_t ERR_CODE;                                                                         \
            ERR_CODE = softdevice_handler_init((CLOCK_SOURCE),                                         \
                                               BLE_EVT_BUFFER,                                         \
                                               sizeof(BLE_EVT_BUFFER),                                 \
                                               EVT_HANDLER);      \
            APP_ERROR_CHECK(ERR_CODE);                                                                 \
        } while (0)
    

    APP_ERROR_CHECK defaults to a NVIC_SystemReset() if you have not handled errors yourself in app_error_handler.

    your code checks APP_ERROR_CHECK you can fix your problem by moving the uart configuration after the softdevice init

    // Initialization of various modules.
    LEDS_CONFIGURE(LEDS_MASK);
    LEDS_OFF(LEDS_MASK);
    buttons_init();
    ble_stack_init();
    simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, HWFC);
    client_handling_init();
    device_manager_init();
       LEDS_ON(LEDS_MASK);
    

    I will dig more into it to find out if this is a bug in softdevice or the documentation regarding UART0 being open to use by applications or not when we use softdevice.

  • Oh, I forgot to mention I deleted those calls. The first call to one of the simple_uart functions is after UART configuration :)

Reply Children
No Data
Related