This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DFU with SDK 7.1 and GCC

Hi all,

I'm trying to set up DFU over BLE - Single Bank using:

Mac OS 10.10.1
gcc 4.9 SDK 7.1 w SD110 7.1.0
PCA10001 v2.2.0
MCP 3.7.1.8567 (modified lib/dfu folder according to SDK instructions regarding INIT packet)

Everything seems to work until the MCP requests the image validation after the app image upload. Then the MCP log looks like the device didn't responded to the GATT write request:

8641;01:35:44.9227 [480108241][MainThread] [01:35:44.921] Sending 'VALIDATE FIRMWARE IMAGE' command
8642;01:35:44.9237 [480108241][MainThread] GATT: Sending Write Request on Characteristic Value uuid 0x15311212EFDE1523785FEABCD123 on handle=000D
8643;01:35:44.9237 [480108241][MainThread] WRITE DATA PACKET:04-00-04-00-12-0D-00-04
8644;01:35:44.9237 [480108241][MainThread] Sending packet: AttWriteRequest, 12-0D-00-04, Handle: 0x000D, Value: 04
8645;01:35:44.9247 [480108241][MainThread] Serial port write: 02-00-00-08-00-04-00-04-00-12-0D-00-04
8646;01:35:44.9247 [480108241][MainThread] Data buffer queue length (+1): 1 
8647;01:35:44.9247 [480108241][MainThread] Number of data packets sent: 428
8648;01:35:44.9287 [480108241][ReadPacketQueueThread] Serial port read: 04-13-05-01-00-00-01-00
8649;01:35:44.9287 [480108241][ReadPacketQueueThread] HCI event: BTLE_EVENT_NUMBER_OF_COMPLETED_PACKETS, NumberOfHandles: 1, ConnectionHandle: 0x0000, NumberOfPackets: 1
8650;01:35:44.9287 [480108241][ReadPacketQueueThread] Data buffer queue length: 0
8651;01:36:15.0535 [480108241][MainThread] GATT: Received None - None
8652;01:36:15.0545 [480108241][MainThread] [01:36:15.054] [Emulator] Failed to send data on pipe number 2
8653;01:36:15.0545 [480108241][MainThread] Failed to send data on pipe number 2
8654;01:36:15.0646 [480108241][MainThread] Data could not be sent - failed!
8655;01:36:16.0898 [480108241][MainThread] [01:36:16.089] Will disconnect now

At that point, by halting the device and looking to the PC Register, seems like the boot loader is stuck on an infinite loop:

J-Link>h
PC = 0003D386, CycleCnt = 00000000
R0 = 00000000, R1 = 20002B2C, R2 = 00002000, R3 = 00002000
R4 = 00000000, R5 = 20002970, R6 = 00001FF4, R7 = 20003F20
R8 = FFFFFFFF, R9 = FFFFFFFF, R10= 1FFF4000, R11= 00000000
R12= 00000000
SP(R13)= 20003EC0, MSP= 20003EC0, PSP= FFFFFFFC, R14(LR) = 0003E8FF
XPSR = 61000000: APSR = nZCvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
J-Link>s
0003D386:  FE E7              B       #-0x04
J-Link>s
0003D386:  FE E7              B       #-0x04

The map file points to dfu_transport_ble.c : on_dfu_evt...

             0x000000000003cf9c                on_dfu_evt.lto_priv.130
             0x000000000003d510                sd_ble_gatts_sys_attr_set.lto_priv.68

... but there isn't any loop on that function. The only way to recover seems to be resetting the target.

I'm sorry if I'm missing something silly, but I'm stuck and can't figure what's going on... any hint?

Thank you for your help!!

Best regards,

-- Jorge

Related