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

NUS example after advertising getting the fatal error?

HI , nrf52832 with SDK v16 on that using this nus example location below mentioned

examples\ble_peripheral\ble_app_uart\pca10040\s132

in this example, didn't change anything  whenever the program starts  start advertising until APP_ADV_DURATION time 180 sec  after that program terminates receiving a fatal error

anybody check this issue help me!!

Parents
  • Hi

    Are you seeing the application going to a NRF_BREAKPOINT_COND; when you are running it in debug mode? If so, you're seeing this error because the device is trying to go to sleep (system OFF), but that's not possible in debug mode, so you'll get an assert. The application should go to sleep by default after the advertising duration (APP_ADV_DURATION) expires.

    Best regards,

    Simon

Reply
  • Hi

    Are you seeing the application going to a NRF_BREAKPOINT_COND; when you are running it in debug mode? If so, you're seeing this error because the device is trying to go to sleep (system OFF), but that's not possible in debug mode, so you'll get an assert. The application should go to sleep by default after the advertising duration (APP_ADV_DURATION) expires.

    Best regards,

    Simon

Children
  • how to handle this if want to enter sleep mode 

  • While debugging, you won't be able to enter system OFF mode at all, and would rather have to go to sleep in system ON mode to see it working in debug mode. This is handled in the on_adv_evt() function in the BLE_ADV_EVT_IDLE case. By default you can see that this case calls sleep_mode_enter(); which puts the device in system OFF mode. If you change this case to call idle_state_handle(); instead for instance, it should go to sleep in a way that won't cause the debugger to crash.

    /**@brief Function for handling advertising events.
     *
     * @details This function will be called for advertising events which are passed to the application.
     *
     * @param[in] ble_adv_evt  Advertising event.
     */
    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 = bsp_indication_set(BSP_INDICATE_ADVERTISING);
                APP_ERROR_CHECK(err_code);
                break;
            case BLE_ADV_EVT_IDLE:
                sleep_mode_enter();
                break;
            default:
                break;
        }
    }
    

    Best regards,

    Simon

  • i removed   sd_power_off function then added idle_state_handler function even if I pressed wake up button it's not advertising again it's in sleep mode only

Related