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

nRF52832 "ble_peripheral->ble_app_uart" stops working

Hello,

        I am trying to evaluate the "ble_app_uart" in the "nRF5_SDK" and I am using "DVK-BL652-SA-01" development board from LAIRD.

        The example works fine for a while. After some time, the application stops working. I can not even see the BLE device with my phone.

        What could be the problem ? Any idea ?

Best Regards

Parents
  • Hello,

    So you are in a connection while this happens, is that right?

     

    Can you please try to define "DEBUG" in your preprocessor defines, and set a breakpoint in the error handler in app_error.c. Exactly what line that is on depends on the SDK version. 

     

    Does the DVK from Laird come with an external LFXTAL, or does it use the RC Oscillator? If it uses the RC Oscillator, what settings have you used for it?

     

    Best regards,
    Edvin

  • Hello Edvin,

            I debug the code. When the code hits the "app_error_fault_handler" function, I get the register content below.

    <error> app: ERROR 8198 [Unknown error code] at E:\nRF5_SDK\examples\ble_peripheral\ble_app_uart\main.c:339
    PC at: 0x00033103
    <error> app: End of error report

    the "app_error_fault_handler" is called from the function above I think

  • Hello,

    (dec) 8198 = 0x2006 = NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN.

     

    This happens because the function sd_power_system_off should not return. When you are in debug mode, it will actually be in a simulated system off state, and this function call may return, and it will return NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN.

     

    Please see the response in this case for some more detailed information.

     

    This leads back to my questions, what SDK and SoftDevice versions do you use? And are you in a connection when this happens, or are you advertising? I suspect this happens when you are advertising, and the advertising timer times out, calling the sd_power_system_off() function, turning off the chip to save power. Try to either extend your advertising timeout, APP_ADV_TIMEOUT_IN_SECONDS, or comment out the sd_power_system_off() call, or the sleep_mode_enter() call, which is the one calling sd_power_system_off(), and see if the issue disappears.

     

    Best regards,

    Edvin

Reply
  • Hello,

    (dec) 8198 = 0x2006 = NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN.

     

    This happens because the function sd_power_system_off should not return. When you are in debug mode, it will actually be in a simulated system off state, and this function call may return, and it will return NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN.

     

    Please see the response in this case for some more detailed information.

     

    This leads back to my questions, what SDK and SoftDevice versions do you use? And are you in a connection when this happens, or are you advertising? I suspect this happens when you are advertising, and the advertising timer times out, calling the sd_power_system_off() function, turning off the chip to save power. Try to either extend your advertising timeout, APP_ADV_TIMEOUT_IN_SECONDS, or comment out the sd_power_system_off() call, or the sleep_mode_enter() call, which is the one calling sd_power_system_off(), and see if the issue disappears.

     

    Best regards,

    Edvin

Children
  • Hello Edvin,

    I'm using nRF5 SDK v15 and S132 as a softdevice with nRF52832 IC. It happens when there is no connection.

    Sleep mode or syetem power off modes are quite nice feature. I is nice to have them.

    How about If I wanted to wake up the MCU from sleep mode, What do I need to do ? 

    For instance, I need to wake up the MCU by any gpio interrupt. What do I need to do ? Which example do I need to use ?

  • RTFM. There are not that may ways to wake an NRF chip from SYSTEM OFF.

    Waking from normal sleep is automatic, if the interrupt was enabled in the NVIC. See GPIOTE example.

  • How about Advertisement timeout. I can not find the below definition. Where can I find and modift it ?

    APP_ADV_TIMEOUT_IN_SECONDS

  • I didn't know what SDK version you used, so I gambled on the APP_ADV_TIMEOUT_IN_SECOND variable name. In SDK 15 this is called APP_ADV_DURATION, and is defined in units of 10ms. I guess it is defined as 18000 (=180s). 

     

    Yes. The sd_power_system_off() is a quite nice function, but it basically turns off the entire chip. A wakeup will be more or less like a reset, or power cycling the device. And also, you can't use e.g. the UART when you are in system off mode.

     

    There are a couple of ways to wake up from System_off mode. Either an interrupt on a GPIOTE pin, or alternatively, the NFC. Most of the ble_peripheral examples are set to wake up from a button press. You can play around with this by setting APP_ADV_DURATION to something short, like 2000 (=20sec), and see that it will turn off after 20 seconds, unless it has entered a connection. Then you can press one of the buttons, and see that it will start up again, and start advertising.

     

    However, you can not continue to send messages over the UART while in system off mode. It is intended as a deep sleep power saving mode for when the device is not in use, but can be turned back on with an interrupt from a GPIO or the NFC.

     

    Best regards,

    Edvin

  • Hello Edvin,

           I took a look at the "buttons_leds_init()" function. it works as you said. However, it is different from the link.

    in the link, the setup is something like below.

        nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true); 
        config.pull = NRF_GPIO_PIN_PULLUP;
        err_code = nrf_drv_gpiote_in_init(3, &config, pin_event_handler);
        nrf_drv_gpiote_in_event_enable(3, true);

    When I add the code above to my main code. it never wakes up the MCU ?

    Is there another think I need to do ? I assigned the pin "3" as the inturrupt pin. 

Related