This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640: OAD with Android App issue : Device Disconnects Randomly

Part Number: CC2640
Other Parts Discussed in Thread: CC2650

Hi,

We're trying to write an Android App to on-chip OAD into a CC2640 custom board. We have already tested the OAD using BTool + CC2650_USB_Dongle. It works perfectly fine.

We've followed all the steps mentioned in CC2640_OAD_Guide and came across an issue that Device gets disconnected in the middle randomly while OAD.. We're still not sure but based on our previous experience this issue might be due to incorrect connection parameters (CONN INTERVAL).

Following are the connection parameters that we're currently using:

/*********************************************************************
 * CONSTANTS
 */
// Advertising interval when device is discoverable (units of 625us, 160=100ms)
#define DEFAULT_ADVERTISING_INTERVAL          80

// Limited discoverable mode advertises for 30.72s, and then stops
// General discoverable mode advertises indefinitely
#define DEFAULT_DISCOVERABLE_MODE             GAP_ADTYPE_FLAGS_GENERAL

// Minimum connection interval (units of 1.25ms, 80=100ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL     1024

// Maximum connection interval (units of 1.25ms, 800=1000ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL     2048

// Slave latency to use if automatic parameter update request is enabled
#define DEFAULT_DESIRED_SLAVE_LATENCY         0

// Supervision timeout value (units of 10ms, 1000=10s) if automatic parameter
// update request is enabled
#define DEFAULT_DESIRED_CONN_TIMEOUT          100

// Whether to enable automatic parameter update request when a connection is
// formed
#define DEFAULT_ENABLE_UPDATE_REQUEST         GAPROLE_LINK_PARAM_UPDATE_INITIATE_APP_PARAMS

// Connection Pause Peripheral time value (in seconds)
#define DEFAULT_CONN_PAUSE_PERIPHERAL         1

// How often to perform periodic event (in msec)
#define OTA_PERIODIC_EVT_PERIOD               20

// The size of an OAD packet.
#define OAD_PACKET_SIZE                       ((OAD_BLOCK_SIZE) + 2)

// Task configuration
#define OTA_TASK_PRIORITY                     1

#ifndef OTA_TASK_STACK_SIZE
#define OTA_TASK_STACK_SIZE                   644
#endif

// Internal Events for RTOS application
#define OAD_STATE_CHANGE_EVT                  0x0001

/*--------------------------------------------------------------------------------------------------------------*/

Android logcat output for the failed OAD attempts are as follows:

/*-------------------------------------ATTEMPT - 1----------------------------------------------------*/

04-05 17:32:34.312 7634-7653/in.test.oadtest D/BluetoothGatt: discoverServices() - device: 0A:D0:AD:0A:D0:AD
04-05 17:32:34.333 7634-7653/in.test.oadtest D/BluetoothGatt: onSearchComplete() = Device=0A:D0:AD:0A:D0:AD Status=0
04-05 17:32:34.333 7634-7653/in.test.oadtest D/log: Service found with UUID : f000ffc0-0451-4000-b000-000000000000
04-05 17:32:34.334 7634-7653/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc1-0451-4000-b000-000000000000 enable: true
04-05 17:32:34.341 7634-7653/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc2-0451-4000-b000-000000000000 enable: true
04-05 17:32:34.344 7634-7653/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc4-0451-4000-b000-000000000000 enable: true
04-05 17:32:34.367 7634-7653/in.test.oadtest D/log: Characteristic found with UUID : f000ffc1-0451-4000-b000-000000000000
04-05 17:32:34.367 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 17:32:34.367 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 17:32:34.367 7634-7653/in.test.oadtest D/log: Characteristic found with UUID : f000ffc2-0451-4000-b000-000000000000
04-05 17:32:34.368 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 17:32:34.368 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 17:32:34.368 7634-7653/in.test.oadtest D/log: Characteristic found with UUID : f000ffc3-0451-4000-b000-000000000000
04-05 17:32:34.368 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 17:32:34.374 7634-7653/in.test.oadtest D/log: Characteristic found with UUID : f000ffc4-0451-4000-b000-000000000000
04-05 17:32:34.374 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 17:32:34.374 7634-7653/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 17:32:34.382 7634-7653/in.test.oadtest D/log: Descriptor write complete
04-05 17:32:34.391 7634-7652/in.test.oadtest D/log: Descriptor write complete
04-05 17:32:34.422 7634-7634/in.test.oadtest W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
04-05 17:32:34.472 7634-7634/in.test.oadtest I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3eb61466 time:68289858
04-05 17:32:34.477 7634-7652/in.test.oadtest D/log: Descriptor write complete
04-05 17:32:37.867 7634-7653/in.test.oadtest D/log: Characteristic write complete
04-05 17:32:37.938 7634-8277/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x00
04-05 17:32:37.962 7634-7653/in.test.oadtest D/log: Characteristic write complete
04-05 17:32:37.971 7634-7634/in.test.oadtest I/ViewRootImpl: CPU Rendering VSync enable = true
04-05 17:32:38.085 7634-8277/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x01
04-05 17:32:38.096 7634-7653/in.test.oadtest D/log: Characteristic write complete
04-05 17:32:38.182 7634-7653/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x02
04-05 17:32:38.193 7634-8277/in.test.oadtest D/log: Characteristic write complete
04-05 17:32:38.279 7634-8277/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x03
04-05 17:32:38.289 7634-8277/in.test.oadtest D/log: Characteristic write complete
04-05 17:32:38.377 7634-8277/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x04
04-05 17:33:13.380 7634-7653/in.test.oadtest D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=5 device=0A:D0:AD:0A:D0:AD //DISCONNECTED


/*-------------------------------------ATTEMPT - 2----------------------------------------------------*/

04-05 18:03:48.087 16676-16693/in.test.oadtest D/BluetoothGatt: discoverServices() - device: 0A:D0:AD:0A:D0:AD
04-05 18:03:48.125 16676-16693/in.test.oadtest D/BluetoothGatt: onSearchComplete() = Device=0A:D0:AD:0A:D0:AD Status=0
04-05 18:03:48.126 16676-16693/in.test.oadtest D/log: Service found with UUID : f000ffc0-0451-4000-b000-000000000000
04-05 18:03:48.126 16676-16693/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc1-0451-4000-b000-000000000000 enable: true
04-05 18:03:48.134 16676-16693/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc2-0451-4000-b000-000000000000 enable: true
04-05 18:03:48.142 16676-16693/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc4-0451-4000-b000-000000000000 enable: true
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic found with UUID : f000ffc1-0451-4000-b000-000000000000
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic found with UUID : f000ffc2-0451-4000-b000-000000000000
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:03:48.146 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:03:48.147 16676-16693/in.test.oadtest D/log: Characteristic found with UUID : f000ffc3-0451-4000-b000-000000000000
04-05 18:03:48.147 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:03:48.147 16676-16693/in.test.oadtest D/log: Characteristic found with UUID : f000ffc4-0451-4000-b000-000000000000
04-05 18:03:48.147 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:03:48.147 16676-16693/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:03:48.151 16676-16693/in.test.oadtest D/log: Descriptor write complete
04-05 18:03:48.157 16676-16693/in.test.oadtest D/log: Descriptor write complete
04-05 18:03:48.216 16676-16693/in.test.oadtest D/log: Descriptor write complete
04-05 18:03:52.041 16676-16693/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.117 16676-16693/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x00
04-05 18:03:52.124 16676-16693/in.test.oadtest D/log: Valid Image Metadata. Start Writing Blocks..
04-05 18:03:52.138 16676-16676/in.test.oadtest D/log: Writing Block : 0
04-05 18:03:52.144 16676-16692/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.147 16676-16676/in.test.oadtest I/ViewRootImpl: CPU Rendering VSync enable = true
04-05 18:03:52.215 16676-16706/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x01
04-05 18:03:52.240 16676-16676/in.test.oadtest D/log: Writing Block : 1
04-05 18:03:52.243 16676-16693/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.312 16676-16692/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x02
04-05 18:03:52.315 16676-16676/in.test.oadtest D/log: Writing Block : 2
04-05 18:03:52.318 16676-16706/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.409 16676-16692/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x03
04-05 18:03:52.413 16676-16676/in.test.oadtest D/log: Writing Block : 3
04-05 18:03:52.417 16676-16706/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.508 16676-16693/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x04
04-05 18:03:52.513 16676-16676/in.test.oadtest D/log: Writing Block : 4
04-05 18:03:52.518 16676-16706/in.test.oadtest D/log: Characteristic write complete
04-05 18:03:52.605 16676-16693/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x05
04-05 18:03:52.609 16676-16676/in.test.oadtest D/log: Writing Block : 5
04-05 18:04:27.327 16676-16692/in.test.oadtest D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=5 device=0A:D0:AD:0A:D0:AD //DISCONNECTED

/*-------------------------------------ATTEMPT - 3----------------------------------------------------*/

04-05 18:05:48.302 17518-17536/in.test.oadtest D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=0A:D0:AD:0A:D0:AD
04-05 18:05:48.304 17518-17536/in.test.oadtest D/BluetoothGatt: discoverServices() - device: 0A:D0:AD:0A:D0:AD
04-05 18:05:48.325 17518-17536/in.test.oadtest D/BluetoothGatt: onSearchComplete() = Device=0A:D0:AD:0A:D0:AD Status=0
04-05 18:05:48.325 17518-17536/in.test.oadtest D/log: Service found with UUID : f000ffc0-0451-4000-b000-000000000000
04-05 18:05:48.325 17518-17536/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc1-0451-4000-b000-000000000000 enable: true
04-05 18:05:48.359 17518-17536/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc2-0451-4000-b000-000000000000 enable: true
04-05 18:05:48.363 17518-17536/in.test.oadtest D/BluetoothGatt: setCharacteristicNotification() - uuid: f000ffc4-0451-4000-b000-000000000000 enable: true
04-05 18:05:48.365 17518-17536/in.test.oadtest D/log: Characteristic found with UUID : f000ffc1-0451-4000-b000-000000000000
04-05 18:05:48.365 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:05:48.365 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:05:48.365 17518-17536/in.test.oadtest D/log: Characteristic found with UUID : f000ffc2-0451-4000-b000-000000000000
04-05 18:05:48.365 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic found with UUID : f000ffc3-0451-4000-b000-000000000000
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic found with UUID : f000ffc4-0451-4000-b000-000000000000
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002902-0000-1000-8000-00805f9b34fb
04-05 18:05:48.366 17518-17536/in.test.oadtest D/log: Characteristic descriptor with UUID : 00002901-0000-1000-8000-00805f9b34fb
04-05 18:05:48.379 17518-17536/in.test.oadtest D/log: Descriptor write complete
04-05 18:05:48.383 17518-17536/in.test.oadtest D/log: Descriptor write complete
04-05 18:05:48.442 17518-17535/in.test.oadtest D/log: Descriptor write complete
04-05 18:05:48.872 17518-17518/in.test.oadtest I/ViewRootImpl: CPU Rendering VSync enable = true
04-05 18:05:52.106 17518-17536/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.195 17518-17556/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x00
04-05 18:05:52.198 17518-17556/in.test.oadtest D/log: Valid Image Metadata. Start Writing Blocks..
04-05 18:05:52.209 17518-17518/in.test.oadtest D/log: Writing Block : 0
04-05 18:05:52.212 17518-17535/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.225 17518-17518/in.test.oadtest I/ViewRootImpl: CPU Rendering VSync enable = true
04-05 18:05:52.293 17518-17535/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x01
04-05 18:05:52.312 17518-17518/in.test.oadtest D/log: Writing Block : 1
04-05 18:05:52.315 17518-17535/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.393 17518-17535/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x02
04-05 18:05:52.398 17518-17518/in.test.oadtest D/log: Writing Block : 2
04-05 18:05:52.401 17518-17556/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.488 17518-17556/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x03
04-05 18:05:52.499 17518-17518/in.test.oadtest D/log: Writing Block : 3
04-05 18:05:52.502 17518-17536/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.586 17518-17536/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x04
04-05 18:05:52.595 17518-17518/in.test.oadtest D/log: Writing Block : 4
04-05 18:05:52.597 17518-17535/in.test.oadtest D/log: Characteristic write complete
04-05 18:05:52.683 17518-17556/in.test.oadtest D/log: Characteristic Changed : UUID = f000ffc2-0451-4000-b000-000000000000 , Value = 0x05
04-05 18:05:52.691 17518-17518/in.test.oadtest D/log: Writing Block : 5
04-05 18:06:27.033 17518-17536/in.test.oadtest D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=5 device=0A:D0:AD:0A:D0:AD //DISCONNECTED

Packet Sniffer data while one of these attempts is in the following file:

0844.OAD_Snif.psd

Also, we have found, cloned and built this repo suggested in one of the e2e threads:

But, this seems to be for Off-Chip OAD process. Please suggest any on-chip OAD example, if there is any..

Thanks!

  • Hi Sharath,

    When I look at the sniffer log it seems like it's the phone that stops sending new data over the air.

    Admittedly, at some point later it looks like the slave has decided to not be in the connection any more, but for a good while they are both online and the phone does nothing after receiving the notification about which OAD block number is expected next. Can you comment on that?

    Also, it looks like your connection interval is almost a second after the update request from the slave. That seems a bit excessive and the OAD process will take forever. 20-100ms would be faster (obviously) but still slow enough that the slave has plenty of time to write the received data to flash.

    Best regards,
    Aslak