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

NRF52832 SDK 17 NUS LESC problem


Hi.

NRF52832 is used as central for connecting with phones as peripheral.
NUS service is used. Lesc is used too.

SDK 17
SoftDevice S132 V7.0.1

I have sometimes crash of application.
I suppose it is crash of softdevice.
there aren't any logs in that time.
Application is just restarting in random times (every 1 - 15 minutes).
Breakpoint on NVIC_SystemReset() doesn't catches too.
Size of stack was increased. So i think perhaps sd has crashed in that time.

How can i find cause of that?
Thanks for any suggestions.

Another strange thing is that after resetting chip in this cases
resolving of private resolved address doesn't work (im_address_resolve).
(it is usually actual for one phone from two. phone1 is connecting successfully, another phone has not resolved address.)

Parents Reply Children
  • Hi!

    DEBUG was present in preprocessor directives.
    Reset problem is solved now. (It is described above)

    I have another question.
    When chip as central is connected with phone ( as peripheral)
    disconnection appears sometimes:

    <info> app: ble_nus_c_evt_handler(): conn_handle=0x0, evt_type=0x2
    <info> app: BLE_NUS_C_EVT_DISCONNECTED: 0x0
    <info> app: BLE_GAP_EVT_DISCONNECTED: 1 , reason=0x13

    0x13 means:
    #define BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13 /**< Remote User Terminated Connection. */


    It happens on old phone (BQ-5001L ble 4.0).
    I seem that another phone (more modern) doesn't has this issue.

    What may be caused of that disconnection?

  • You still don't know who initiated the disconnect, but either the nRF or the phone decided to disconnect. Check all the places in your application that can call sd_ble_gap_disconnect, and try to set breakpoints. Alternatively, you can try to capture a sniffer trace and see which device that sends the disconnect packet. 

  • Hello!

    Breakpoint at this place is catched sometimes.

    case BLE_GATTC_EVT_TIMEOUT:
    // Disconnect on GATT Client timeout event.
    NRF_LOG_INFO("BLE_GATTC_EVT_TIMEOUT: %d ", conn_handle);
    err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
    BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    APP_ERROR_CHECK(err_code);
    break;


    but it is rarely.
    So i hesitate that it is cause.

    Breakpoints work strange sometimes.
    May be so that breakpoints catch not all times?

  • Breakpoints should catch, but the order of things may behave weird if optimization is enabled. Try to disable it. Let me knoe what IDE you are using if you are not sure how to do this.

    Another thing with breakpoints: If you have hit a breakpoint, you may try to step a few steps, but the softdevice will after a while realize that it missed some time critical events, and assert. So basically, this means that you need to reset the application after a breakpoint is hit.

    BR,

    Edvin

  • I use IAR 8

    Optimisation is switched off now.

    Disconnections are observed periodically.
    Connection is set up. Data exchange is processed some seconds. And after that disconnect is following:
    <info> app: ble_nus_c_evt_handler(): conn_handle=0x2000, evt_type=0x2
    <info> app: BLE_GAP_EVT_DISCONNECTED: 1 , reason=0x13

    break points on sd_ble_gap_disconnect doesn't catch.

    Is it means that phone makes disconnect?


    I try to sniff rf logs by wireshark.
    But i don't understand how to setup filter to catch interesting devices.
    I enter passkey
    But addresses are changing on every connect (they are random)

Related