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 going to try capturing debug logging.   I have the dev-dongle and I also bought the nRF52840 development kit (which I haven't used yet). If you can point me to docs to get started, that could speed up my learning curve. Can I do this with just the dev-kit, or do I need to get a connector to hook up the dev-dongle to the development kit?

  • Using the DK would be the simplest approach. Then you only need to set the configs that I described earlier (except NRF_LOG_BACKEND_UART_TX_PIN, which should be set to default pin 6), and open the serial terminal or RTT Viewer on the PC.

    To make the setup as similar as possible to the Dongle, you should use the USB connectivity firmware and use the nRF USB (J3) on the wide side of the board with your pc-ble-driver application.

    The J-Link USB port (J2) must be connected to the PC to use UART logging and to flash the firmware to the board.

  • I have used the nRF52840 Development Kit and loaded firmware with logging enabled. I was able to run my product on this, and reproduced the problem (events not received after read/write/disconnect). I can attach the trace I viewed in RTT, but I don't know how.  For now I'll just summarize what I see. Early on, there are multiple reads that succeed, and the logging shows an SD_BLE_GATTC_READ, several lines about transmitting and receiving, then the "event:BLE_GATTC_EVT_READ_RSP". But when the problem occurs, these are the final lines of logging (no event received to confirm the read):

    00> <debug> ser_conn: [SD_CALL]:SD_BLE_GATTC_READ

    00> <info> ser_conn_dec: Command process start

    00> <info> ser_conn_dec: Tx buffer allocated

    00> <debug> sphy_hci: TX request (6 bytes)

    00> <debug> sphy_hci: Started TX packet (payload 6).

    00> <debug> sphy_hci: EVT:Tx packet sent.

    00> <debug> sphy_hci: EVT:RX ACK packet (length:4)

    I have several questions:

    Is the sample logging I've shown the level of detail that you expect from the firmware with debug logging enabled?

    It would be helpful if the J-Link RTT Viewer would show timestamps for each line. Possible?

    I don't see how to add an attachment to this case, can you let me know?

    I would prefer to make this case Public, is there any reason not to?

  • Hi,

    The logging lever looks correct.

    I do not think there is any timestamp functionality in J-Link RTT Viewer. You may utilize the suggestions in this post to enable timestamps in NRF_LOG module.

    Click insert->Insert image/video/file, and select "File Upload" in the new window:

    No problem from my side, I understood it as this was a request from your side. I'm checking with the FAE you have been in contact with!

    Can you provide the steps required to get into this specific situation where the firmware fails? I will try to reproduce it on our end. There are no modifications to the connectivity firmware in your setup, besides the added logging, right?

  • I uploaded the logging from the firmware. The firmware has no modifications except to enable logging. I am still trying to create a standalone test program to try to reproduce this problem, so far without success. The trace comes from using my company's product , which calls pc-ble-driver.   The problem always occurs after receiving a series of BLE_GATTC_EVT_HVX events. After receiving those events, I try to do sd_ble_gattc_read or sd_ble_gattc_write with BLE_GATT_OP_WRITE_REQ) on the same connection, and never receive any event for that connection. If I try to disconnect that connection, I get no disconnect event. The only way to get the chip working again is sd_rpc_conn_reset

Related