Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

usbd_ble_uart(peripheral) example in the 17.0.2 SDK, LED_0 not working intended

I am currently going through the usbd_ble_uart example and understanding what states make which LED's active,

Within the example, LED_BLE_NUS_CONN  is defined as BSP_BOARD_LED_0, which is the single green LED (LD1) on the dongle.

In the below code snippet taken from the example (I have only added comments), LED_BLE_NUS_CONN should be blinking when advertising, 

static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
    uint32_t err_code;

    switch (ble_adv_evt)
    {
        case BLE_ADV_EVT_FAST:
            err_code = app_timer_start(m_blink_ble,
                                       APP_TIMER_TICKS(LED_BLINK_INTERVAL),
                                       (void *) LED_BLE_NUS_CONN); // this should blink when the dongle is advertising but it doesnt?

and upon connecting to a peer, the LED should stop blinking, and turn on, as seen in the below snippet:

static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    uint32_t err_code;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO("BLE NUS connected");
            err_code = app_timer_stop(m_blink_ble); // this should stop LED_0 from blinking
            APP_ERROR_CHECK(err_code);
            bsp_board_led_on(LED_BLE_NUS_CONN); // this should stay on when connected but doesnt?
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            break;

There is no other code in the example that affects that LED.

However, the behaviour I am seeing is:

- Upon powering the dongle LED_0 will flash on once, and then turn off

- Upon a connection event, LED_0 will flash on once and then turn off.

I am unsure why the LED is ever turning off as I cant see any code to indicate that it should be in any other state than blinking, or solid on.

I do not believe this is a hardware issue as I have two dongles both with the same results, and I am able to run a modified blinky example to control the same LED at my will.

Any insight into why this could be happening is appreciated.

Thanks,

Luke

Parents Reply Children
No Data
Related