Hi,
I am currently trying to use SDK 15.3 secure serial UART bootloader (from the example in nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_uart) on a custom chip embedding an nRF52832 and a GSM chip, communicating between themselves via UART. In order to adapt the given example to my particular case, I just added in nrf_dfu_init() function the power-on of the GSM chip. I also modified UART configuration (pinout, HWFC activated, baudrate = 57600).
After calling this function, the bootloader then loops forever (loop_forever() function), and waits for commands, via UART, from the GSM chip. The GSM chip basically connects to server, downloads new firmware, checks if a firmware upgrade is needed, and "if true" starts to transfer said firmware to nRF52832.
Here is the detailed communication between GSM and nRF52832, from the GSM chip point of view:
<--Sent CMD: 02, len: 4--> Received 0x02 0x01 <--Sent CMD: 07, len: 2--> Received 0x07 0x01 <--Sent CMD: 06, len: 3--> Received 0x06 0x01 <--Sent CMD: 01, len: 7--> Received 0x01 0x01 <--Sent CMD: 08, len: 130--> (command) <--Sent CMD: 08, len: 16--> (command) <--Sent CMD: 03, len: 2--> Received 0x03 0x01 <-- Received CALC CRC message response --> <-- Received CRC: 912423956 (36627C14), local CRC: 912423956(36627C14) --> <-- Received offset: 141, local offset: 141 --> <--Sent CMD: 04, len: 2--> Received 0x04 0x01 <--Sent CMD: 06, len: 3--> Received 0x06 0x01 <--Sent CMD: 01, len: 7--> Received 0x01 0x01 <--Sent CMD: 08, len: 129--> (data) <-- Sent 127 bytes, local CRC: -1046533821(C19F2943) --> <--Sent CMD: 08, len: 129--> (data) <-- Sent 254 bytes, local CRC: -340869425(EBAEBECF) --> <--Sent CMD: 08, len: 129--> (data) <-- Sent 381 bytes, local CRC: -793576822(D0B2FA8A) --> <--Sent CMD: 08, len: 129--> (data) <-- Sent 508 bytes, local CRC: 143380219(088BCEFB) --> ... <--Sent CMD: 08, len: 34--> (data) <-- Sent 4096 bytes, local CRC: 1943765718(73DB82D6) --> <--Sent CMD: 03, len: 2-->
This command sequence is right and was working perfectly fine with a secure serial UART bootloader I used with SDK 12.1. The problem here is that after having received and handled successfully the 2 first chunks of data (lines 30 and 32), so 254 bytes, the nRF52832 seems to stop receiving the data, or at least handling it: it does not go into the case NRF_DFU_OP_OBJECT_WRITE from the nrf_dfu_serial_on_packet_received() function anymore. As so of course it doesn't reply to the CRC command (0x03, line 45) sent by the GSM chip, which is waiting for a CRC answer before proceeding with sending next data packet.
Now I am having trouble understanding the source of this issue. I thought at first that it could be a full buffer issue, but it is supposed to be freed asynchronously. I then thought the GSM chip was sending chunks of data too quickly for the nRF52832 to handle, but even after adding a 500ms delay between each chunks (originally 100ms), the issue is still there.
Also, for some reason the logs are not working properly, which does not help debugging... Some of them seems to be missing on the viewer, and they appear very slowly, like they are flushed 30 seconds after being called (and again, not all of them...). So for now my only way of debugging, which is also how I know of this issue, is a buzzer embedded on the board.
Thank you in advance for any help !