Connection hangs after device successfully bonds with Android app

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi, 

   

I am currently trying to get OTA working with an Android app. I am wondering if there are any necessary steps after bonding the app with the device with the "createBond" method from the BluetoothDevice class before characteristics can be written?

   

I compared the PSoC debug printouts from when OTA is facilitated with CySmart and when OTA is facilitated with my own app. It seems that with CySmart, the device is able to see the "CYBLE_EVT_GAPC_CONNECTION_UPDATE_COMPLETE" event right after the "CYBLE_EVT_GAP_AUTH_COMPLETE" event (which I believe happens after bonding completes successfully). However, with my own application, the device only saw "CYBLE_EVT_GAP_AUTH_COMPLETE" and no "CYBLE_EVT_GAPC_CONNECTION_UPDATE_COMPLETE". The device also disconnects after 10 seconds or so, which I assume is due to a hanged connection. However, I am pretty lost at how to invoke this event on the device. 

   

I'm wondering how the CYBLE_EVT_GAPC_CONNECTION_UPDATE_COMPLETE event could be invoked on the device? Does anyone know what I could be missing on the android application's side? 

   

 

   

Thanks!!!

0 Likes
6 Replies
Anonymous
Not applicable

Are there any OTA experts out there who might have a clue?

   

Thanks!

0 Likes
Anonymous
Not applicable

I havn't done any OTA, but according to the comments in the libraries:

   


    /** This event is generated at the GAP Central and the Peripheral end after connection parameter update
        is requested from the host to the controller. Event parameter is a pointer to a structure of type CYBLE_GAP_CONN_PARAM_UPDATED_IN_CONTROLLER_T. */

   

A lack of seeing the event might be caused by the BLE security settings; Simply works, versus pairing versus authentication with pairing, etc. Might cause different events based on which security level you have set.

   

I would recommend checking the security settings for your app and comparing them with the cysmart to see if they are different in some way.

0 Likes
Anonymous
Not applicable

Thanks e.pratt for your reply! Unfortunately I don't think I saw anything related to security settings when CySmart attempts to bond with the device. 

   

Another thing is that I think the connection immediately hanged after bonding succeeded (CYBLE_EVT_GAP_AUTH_COMPLETE event) before I tried to write any characteristics. This may also be why the UPDATE event didn't show up - because the device has disconnected / hanged by then. 

   

I have been banging my head on this issue for at least a month by now 😞

0 Likes
Anonymous
Not applicable

Hmmm, seems like one of the two devices is either resetting (hard crashing the radio), or calling a disconnect function after the CYBLE_EVT_GAP_AUTH_COMPLETE occurs.

   

Under cysmart, if you go into "Configure Master Settings", and then select the tab "Security Parameters", there will be settings for whether the unit bonds when it pairs, uses unauthenticated, unencrypted, security mode 1 vs 2, etc.

   

If you can run in debug mode, or at least figure out the order that events and functions are being called, that should help with determining the cause as well.

0 Likes
Anonymous
Not applicable

Hey e.pratt, thanks for your help. I figured it out. 

   

Actually the communication hanged before bonding even began. My app was writing characteristics to PSoC but I did not have PSoC respond to any write requests. Once bonding is complete, the connection would just hang, as expected. 

   

After I added the responses to write request, the update event appeared and things worked as expected. 

   

Thanks again for your help! 

0 Likes
Anonymous
Not applicable

Glad you figured it out! Good luck with the rest of the project 🙂

0 Likes