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

disconnecting while operations are in progress never gives BLE_GAP_EVT_DISCONNECTED event

2020-01-24-092119EST-ProductStoppedGettingEventsFromNordicDK.txtImprivataTestNordicEventsNotReceived.zipCalls_to_pc_ble_driver.cpp0285.2020-02-24-TestProgramUploadedToNordicSupport.zipFeb25TestProgramUploadedToNordicSupport.zipImprivata_bgTestApp.zipbgSDKTestAppMay4.zip2020-05-05-035347-NordicDK_USB840M_200505_ClockInternal_2in1.hex.txt.txtbgSDKTestAppMay6.zipI’m developing an application based on pc-ble-driver to talk to an nRF52840-based dongle (from Fanstel).

I’m having trouble disconnecting cleanly when a connection has operations in progress.  For example, I call ‘sd_ble_gattc_write’, which returns NRF_SUCCESS, but I don’t receive event BLE_GATTC_EVT_WRITE_RSP (after waiting 60 seconds), so I decide to disconnect. When this happens, sd_ble_gap_disconnect returns NRF_SUCCESS, but I do not receive BLE_GAP_EVT_DISCONNECTED even after waiting 30 seconds. The connection supervision timeout is 4 seconds.  What could cause the disconnect to not generate any BLE_GAP_EVT_DISCONNECTED event?

What I’m trying to accomplish here: if a connection is not responsive, I want to end that connection, without disturbing other connections I have open.

Thanks,

Paul Bradford

  • I'm trying to reproduce the problem with the DK. How do I get the UART output?  That shows up as JLink CDC UART Port (COM8). So if I open COM8 with Putty I should see debug output, but I see nothing. Does the baud rate matter? If so, what is it?

    But if it is set to only show errors, then maybe I haven't encountered an error yet. But I don't know if I'm properly attached to the COM port.

  • increased sched queue_size, enabled UART log and compiler agian.

    I have  make sure the UART log has output with this BT840_USBconnectivity200430.hex.

    https://www.dropbox.com/s/yqkcn95qrwto6g7/BT840_USBconnectivity200430.rar?dl=0

  • I've been testing with the firmware file "USB840_Connect200430_3in1.hex" from the DropBox link that Leo from Fanstel referenced in the support case on April 29. This firmware has the critical section fix described by Nordic on April 24, and the queue size 64 change.

    With this firmware, I get errors quickly with the Fanstel dongle and Nordic dev-dongle, and after 17 hours with the Nordic Development Kit. 


    Reproduced event loss problem with Nordic Development Kit on May 2 at about 8 AM eastern daylight time, after running for over 17 hours.
    Test program "2020-05-02 08:02:15.759: (ERROR) no Nordic event  BLE_GATTC_EVT_WRITE_RSP  was received to complete the call to sd_ble_gattc_write"
    The dropbox link below has USB trace using USBPcap and PuTTY serial port logging from the Development Kit.

    The PuTTY output looks normal to me until the very end:
    [00:00:58.343,695] <error> app: Fatal error
    [00:00:58.710,920] <info> app: BLE connectivity 200427

    www.dropbox.com/.../May2ReproNordicDK.zip

  • The Fanstel USB840M does not have 32K crystal.

    The clock setting is different.

    I change the clock setting back to default.

    The application should all the same as patched SDK.

    The changed were add CRITICAL_REGION_ENTER/ CRITICAL_REGION_EXIT and Scheduler queue size increase to 64.

    These files can't work with USB840M.

    Application + softdevice

    https://www.dropbox.com/s/u77p0ub617i786e/USB840_Clock_ACCURACY_2in1.hex?dl=0

     

    Application + bootloader + softdevice

    https://www.dropbox.com/s/pg2hzhorhlivdoo/USB840_Clock_ACCURACY_3in1.hex?dl=0

    Would you please also try these files on Nordic dongle and DK.

    Leo

  • I tested the USB840_Clock_ACCURACY_3in1.hex file referenced in Leo's last post. I loaded it on the Nordic DK by dragging it to the "JLink CDC UART Port". After just a few minutes my test program got the "serial port write operation" error "The device does not recognize the command". The firmware logging over that JLink port looked the same as what I uploaded on May 2 (which was also the DK and used firmware "USB840_Connect200430_3in1.hex" ):

    [00:00:13.056,233] <debug> app: event:BLE_GAP_EVT_RSSI_CHANGED
    [00:00:13.061,999] <debug> sphy_hci: TX request (7 bytes)
    [00:00:13.067,421] <debug> sphy_hci: Started TX packet (payload 7).
    [00:00:13.074,211] <error> app: Fatal error
    [00:00:13.441,628] <info> app: BLE connectivity 200427
    [00:00:13.447,435] <info> app: USB power detected
    [00:00:13.453,251] <info> app: USB ready
    I have not been able to test this firmware with the Nordic dev-dongle. I tried loading USB840_Clock_ACCURACY_3in1.hex into the dev-dongle using nRF Connect Programmer, but that leaves the dev-dongle in a state where it does not show up as a serial port when I plug it in. If there is some other way I should try to program it, please let me know.
Related