Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK
Hi Team,
I have a similar setup as "simple_peripheral_oad_onchip" example project in order to perform On-chip over-the-air download with SimpleLink CC2640R2 SDK version 2_30_00_28 and CCS-8.2.0.0. I am following the "Performing a BLE OAD" section of "BLE-Stack User’s Guide" to use the bTool.
For our application needs, the following changes have been made:
a. Limited discoverable mode
b. Custom Advertisement and Scan response payload
c. Simple profile service is removed and only the OAD reset service is available
d. SimplePeripheral_performPeriodicTask is removed
With bTool used to perform OAD(unsecure mode), we see that the process stops in between and the control is not switching to OAD persistent application.
On debugging the code, it is found that the write cmd (start OAD) reaches "SimplePeripheral_processOadResetEvt" and the BIM variable "_bim_var" is set to trigger OAD.But the Connection event callback "SimplePeripheral_connEvtCB" is not received eventhough it is registered properly in the application. From bTool end, it waits for reset to happen and then reports "OAD download not successful".
As per the logic available in the application, it does not immediately perform a reset "HAL_SYSTEM_RESET" instead waits for a connection callback (as per the statement: /* We cannot reboot the device immediately after receiving the enable command, we must allow the stack enough time to process and responsd to the OAD_EXT_CTRL_ENABLE_IMG command. The current implementation will wait one cxn evt */).
Please provide some insights on the need to wait for one connection event after receiving "OAD Start" command, OAD_EXT_CTRL_ENABLE_IMG and also the circumstances where there are issues in receiving the connection event.
[1] : <Tx> - 11:38:34.976
-Type : 0x01 (Command)
-OpCode : 0xFE09 (GAP_EstablishLinkRequest)
-Data Length : 0x09 (9) byte(s)
HighDutyCycle : 0x00 (0) (Disable)
WhiteList : 0x00 (0) (Disable)
AddrTypePeer : 0x00 (0) (ADDRTYPE_PUBLIC)
PeerAddr : F0:F8:F2:CB:72:6D
Dump(Tx):
0000:01 09 FE 09 00 00 00 6D 72 CB F2 F8 F0 .......mr....
--------------------------------------------------------------------
[2] : <Rx> - 11:38:35.007
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFE09 (GAP_EstablishLinkRequest)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 09 FE 00 .........
--------------------------------------------------------------------
[3] : <Rx> - 11:38:35.070
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x14 (20) bytes(s)
Event : 0x0605 (1541) (GAP_EstablishLink)
Status : 0x00 (0) (SUCCESS)
DevAddrType : 0x00 (0) (ADDRTYPE_PUBLIC)
DevAddr : F0:F8:F2:CB:72:6D
ConnHandle : 0x0000 (0)
ConnRole : 0x08 (8) (
Central)
ConnInterval : 0x0050 (80)
ConnLatency : 0x0000 (0)
ConnTimeout : 0x07D0 (2000)
ClockAccuracy : 0x00 (0)
Dump(Rx):
0000:04 FF 14 05 06 00 00 6D 72 CB F2 F8 F0 00 00 08 .......mr.......
0010:50 00 00 00 D0 07 00 P......
--------------------------------------------------------------------
[4] : <Tx> - 11:38:35.070
-Type : 0x01 (Command)
-OpCode : 0x2022 (HCI_LE_SetDataLength)
-Data Length : 0x06 (6) byte(s)
Handle : 0x0000 (0)
TxOctets : 0x00FB (251)
TxTime : 0x0848 (2120)
Dump(Tx):
0000:01 22 20 06 00 00 FB 00 48 08 ." .....H.
--------------------------------------------------------------------
[5] : <Rx> - 11:38:35.101
-Type : 0x04 (Event)
-EventCode : 0x000E (HCI_CommandCompleteEvent)
-Data Length : 0x06 (6) bytes(s)
Packets : 0x01 (1)
OpCode : 0x2022 (HCI_LE_SetDataLength)
Status : 0x00 (0) (SUCCESS)
Handle : 0x0000 (0)
Dump(Rx):
0000:04 0E 06 01 22 20 00 00 00 ...." ...
--------------------------------------------------------------------
[6] : <Info> - 11:38:35.210
Device Connected
Handle = 0x0000
Addr Type = 0x00 (ADDRTYPE_PUBLIC)
BDAddr = F0:F8:F2:CB:72:6D
--------------------------------------------------------------------
[7] : <Rx> - 11:38:35.210
-Type : 0x04 (Event)
-EventCode : 0x003E (HCI_LE_GenericReportEvent)
-Data Length : 0x0B (11) bytes(s)
LE Event Code : 0x07 (7) (HCI_LE_DataLengthChangeEvent)
LE Event Code : 0x07 (7) (HCI_LE_DataLengthChangeEvent)
Handle : 0x0000 (0)
MaxTxOctets : 0x00FB (251)
MaxTxTime : 0x0848 (2120)
MaxRxOctets : 0x001B (27)
MaxRxTime : 0x0148 (328)
Dump(Rx):
0000:04 3E 0B 07 00 00 FB 00 48 08 1B 00 48 01 .>......H...H.
--------------------------------------------------------------------
[8] : <Info> - 11:39:20.860
OAD - Update Connection Settings
--------------------------------------------------------------------
[9] : <Info> - 11:39:20.875
Start OAD Download
--------------------------------------------------------------------
[10] : <Info> - 11:39:20.875
StartReset Service Discovery
--------------------------------------------------------------------
[11] : <Info> - 11:39:20.891
OAD Send UUID Discovery
--------------------------------------------------------------------
[12] : <Tx> - 11:39:20.875
-Type : 0x01 (Command)
-OpCode : 0x2016 (HCI_LEReadRemoteUsedFeatures)
-Data Length : 0x02 (2) byte(s)
Handle : 0x0000 (0)
Dump(Tx):
0000:01 16 20 02 00 00 .. ...
--------------------------------------------------------------------
[13] : <Tx> - 11:39:20.907
-Type : 0x01 (Command)
-OpCode : 0xFD86 (GATT_DiscPrimaryServiceByUUID)
-Data Length : 0x12 (18) byte(s)
ConnHandle : 0x0000 (0)
Value : 00:00:00:00:00:00:00:B0:00:40:51:04:D0:FF:00:F0
Dump(Tx):
0000:01 86 FD 12 00 00 00 00 00 00 00 00 00 B0 00 40 ...............@
0010:51 04 D0 FF 00 F0 Q.....
--------------------------------------------------------------------
[14] : <Rx> - 11:39:20.938
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD86 (GATT_DiscPrimaryServiceByUUID)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 86 FD 00 .........
--------------------------------------------------------------------
[15] : <Info> - 11:39:21.110
OAD Send UUID Info Discovery
--------------------------------------------------------------------
[16] : <Rx> - 11:39:21.110
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0A (10) bytes(s)
Event : 0x0507 (1287) (ATT_FindByTypeValueRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x04 (4)
Handle : 1C:00
Handle : FF:FF
Dump(Rx):
0000:04 FF 0A 07 05 00 00 00 04 1C 00 FF FF .............
--------------------------------------------------------------------
[17] : <Rx> - 11:39:21.219
-Type : 0x04 (Event)
-EventCode : 0x003E (HCI_LE_GenericReportEvent)
-Data Length : 0x0C (12) bytes(s)
LE Event Code : 0x04 (4) (HCI_LE_ReadRemoteUsedFeaturesCompleteEvent)
LE Event Code : 0x04 (4) (HCI_LE_ReadRemoteUsedFeaturesCompleteEvent)
Status : 0x00 (0) (SUCCESS)
ConnectionId : 0x0000 (0)
Features : 0x00000000000000FD (253) (
Encryption
Reject_Extended_Indication
Slave_Features_Exchange
Ping
Data_Packet_Length_Extension
Privacy
Extended_Scanner_Filter_Policies)
Dump(Rx):
0000:04 3E 0C 04 00 00 00 FD 00 00 00 00 00 00 00 .>.............
--------------------------------------------------------------------
[18] : <Rx> - 11:39:21.313
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0507 (1287) (ATT_FindByTypeValueRsp)
Status : 0x1A (26) (bleProcedureComplete)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 07 05 1A 00 00 00 .........
--------------------------------------------------------------------
[19] : <Tx> - 11:39:21.313
-Type : 0x01 (Command)
-OpCode : 0xFD84 (GATT_DiscAllCharDescs)
-Data Length : 0x06 (6) byte(s)
ConnHandle : 0x0000 (0)
StartHandle : 0x001C (28)
EndHandle : 0xFFFF (65535)
Dump(Tx):
0000:01 84 FD 06 00 00 1C 00 FF FF ..........
--------------------------------------------------------------------
[20] : <Rx> - 11:39:21.360
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD84 (GATT_DiscAllCharDescs)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 84 FD 00 .........
--------------------------------------------------------------------
[21] : <Rx> - 11:39:21.516
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0F (15) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x09 (9)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 001C
Uuid : 00:28
Handle : 001D
Uuid : 03:28
Dump(Rx):
0000:04 FF 0F 05 05 00 00 00 09 01 1C 00 00 28 1D 00 .............(..
0010:03 28 .(
--------------------------------------------------------------------
[22] : <Rx> - 11:39:21.719
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x19 (25) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x13 (19)
Format : 0x02 (2) (HANDLE_UUID_TYPE__handles_and_128_bit_UUIDs)
Handle : 001E
Uuid : 00:00:00:00:00:00:00:B0:00:40:51:04:D1:FF:00:F0
Dump(Rx):
0000:04 FF 19 05 05 00 00 00 13 02 1E 00 00 00 00 00 ................
0010:00 00 00 B0 00 40 51 04 D1 FF 00 F0 .....@Q.....
--------------------------------------------------------------------
[23] : <Rx> - 11:39:21.922
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0B (11) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x05 (5)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 001F
Uuid : 01:29
Dump(Rx):
0000:04 FF 0B 05 05 00 00 00 05 01 1F 00 01 29 .............)
--------------------------------------------------------------------
[24] : <Rx> - 11:39:22.109
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x1A (26) (bleProcedureComplete)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 05 05 1A 00 00 00 .........
--------------------------------------------------------------------
[25] : <Info> - 11:39:22.109
OAD Invalidate Image On StartReset
--------------------------------------------------------------------
[26] : <Tx> - 11:39:22.109
-Type : 0x01 (Command)
-OpCode : 0xFE11 (GAP_UpdateLinkParamReq)
-Data Length : 0x0A (10) byte(s)
ConnHandle : 0x0000 (0)
IntervalMin : 0x0006 (6)
IntervalMax : 0x0006 (6)
ConnLatency : 0x0000 (0)
ConnTimeout : 0x0032 (50)
Dump(Tx):
0000:01 11 FE 0A 00 00 06 00 06 00 00 00 32 00 ............2.
--------------------------------------------------------------------
[27] : <Tx> - 11:39:22.125
-Type : 0x01 (Command)
-OpCode : 0xFD96 (GATT_WriteLongCharValue)
-Data Length : 0x07 (7) byte(s)
ConnHandle : 0x0000 (0)
Handle : 0x001E (30)
Offset : 0x0000 (0)
Value : 01
Dump(Tx):
0000:01 96 FD 07 00 00 1E 00 00 00 01 ...........
--------------------------------------------------------------------
[28] : <Rx> - 11:39:22.156
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFE11 (GAP_UpdateLinkParamReq)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 11 FE 00 .........
--------------------------------------------------------------------
[29] : <Rx> - 11:39:22.188
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD96 (GATT_WriteLongCharValue)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 96 FD 00 .........
--------------------------------------------------------------------
[30] : <Info> - 11:39:22.516
Waiting For Device Reset
--------------------------------------------------------------------
[31] : <Rx> - 11:39:22.516
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0519 (1305) (ATT_ExecuteWriteRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 19 05 00 00 00 00 .........
--------------------------------------------------------------------
[32] : <Rx> - 11:39:22.812
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0B (11) bytes(s)
Event : 0x0607 (1543) (GAP_LinkParamUpdate)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
ConnInterval : 0x0006 (6)
ConnLatency : 0x0000 (0)
ConnTimeout : 0x0032 (50)
Dump(Rx):
0000:04 FF 0B 07 06 00 00 00 06 00 00 00 32 00 ............2.
--------------------------------------------------------------------
[33] : <Info> - 11:39:23.422
Device Disconnected
Handle = 0x0000
Addr Type = 0x00 (ADDRTYPE_PUBLIC)
BDAddr = F0:F8:F2:CB:72:6D
--------------------------------------------------------------------
[34] : <Rx> - 11:39:23.422
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0606 (1542) (GAP_TerminateLink)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
Reason : 0x08 (8) (SUPERVISION_TIMEOUT_TERM)
Dump(Rx):
0000:04 FF 06 06 06 00 00 00 08 .........
--------------------------------------------------------------------
[35] : <Info> - 11:39:37.528
Establish Connection
--------------------------------------------------------------------
[36] : <Tx> - 11:39:37.528
-Type : 0x01 (Command)
-OpCode : 0xFE09 (GAP_EstablishLinkRequest)
-Data Length : 0x09 (9) byte(s)
HighDutyCycle : 0x00 (0) (Disable)
WhiteList : 0x00 (0) (Disable)
AddrTypePeer : 0x00 (0) (ADDRTYPE_PUBLIC)
PeerAddr : F0:F8:F2:CB:72:6D
Dump(Tx):
0000:01 09 FE 09 00 00 00 6D 72 CB F2 F8 F0 .......mr....
--------------------------------------------------------------------
[37] : <Rx> - 11:39:37.559
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFE09 (GAP_EstablishLinkRequest)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 09 FE 00 .........
--------------------------------------------------------------------
[38] : <Rx> - 11:39:37.606
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x14 (20) bytes(s)
Event : 0x0605 (1541) (GAP_EstablishLink)
Status : 0x00 (0) (SUCCESS)
DevAddrType : 0x00 (0) (ADDRTYPE_PUBLIC)
DevAddr : F0:F8:F2:CB:72:6D
ConnHandle : 0x0000 (0)
ConnRole : 0x08 (8) (
Central)
ConnInterval : 0x0050 (80)
ConnLatency : 0x0000 (0)
ConnTimeout : 0x07D0 (2000)
ClockAccuracy : 0x00 (0)
Dump(Rx):
0000:04 FF 14 05 06 00 00 6D 72 CB F2 F8 F0 00 00 08 .......mr.......
0010:50 00 00 00 D0 07 00 P......
--------------------------------------------------------------------
[39] : <Tx> - 11:39:37.606
-Type : 0x01 (Command)
-OpCode : 0x2022 (HCI_LE_SetDataLength)
-Data Length : 0x06 (6) byte(s)
Handle : 0x0000 (0)
TxOctets : 0x00FB (251)
TxTime : 0x0848 (2120)
Dump(Tx):
0000:01 22 20 06 00 00 FB 00 48 08 ." .....H.
--------------------------------------------------------------------
[40] : <Rx> - 11:39:37.653
-Type : 0x04 (Event)
-EventCode : 0x000E (HCI_CommandCompleteEvent)
-Data Length : 0x06 (6) bytes(s)
Packets : 0x01 (1)
OpCode : 0x2022 (HCI_LE_SetDataLength)
Status : 0x00 (0) (SUCCESS)
Handle : 0x0000 (0)
Dump(Rx):
0000:04 0E 06 01 22 20 00 00 00 ...." ...
--------------------------------------------------------------------
[41] : <Info> - 11:39:38.215
OAD - Restore Connection Settings
--------------------------------------------------------------------
[42] : <Error> - 11:39:38.215
OAD Download Not Successful
--------------------------------------------------------------------
[43] : <Rx> - 11:39:38.215
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0606 (1542) (GAP_TerminateLink)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
Reason : 0x3E (62) (FAILED_TO_ESTABLISH)
Dump(Rx):
0000:04 FF 06 06 06 00 00 00 3E ........>
--------------------------------------------------------------------
Thanks,
Arul Christopher