How to provide data to DFU over BLE (OTA) from custom host

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

cross mob
user_4631386
Level 1
Level 1
First question asked First reply posted

We are using the DFU library to update our firmware via BLE (OTA). A custom app is responsible for sending the update file, but we have not been able to find much documentation of how the DFU library expects the data.

In the "PSoC 6 MCU Device Firmware Update Software Development Kit Guide" the command protocol is described, but we have not been able to find any documentation of how the response packet is returned using BLE. Is it a notification on the Bootloader Command characteristic? Or something else? How should the app expect to receive this?

We are also not sure which commands to use, but from the document we are thinking something like this:

1. Enter DFU

2. Send data (repeatedly until all content from update file is sent)

3. Program data

4. Exit DFU

Is that correct? And does that mean the the app needs to know the address of the flash where the data should be programmed?

0 Likes
1 Solution
RavikiranH_01
Employee
Employee
10 sign-ins 25 replies posted 10 replies posted

@user_4631386
Ganesh has provided the best hints above to understand the process. If you are looking for further details on the protocol,  Please take a look at  WritePacket() , Cy_DFU_Continue() API;s in DFU SDK

Additionally, section B.2.4/B.2.5 and B.2.6 of AN213924 briefs the command sequence.   As you might know already, "Program data" is the core of the operation. You may want to have multiple ProgramData commands based on the local buffer size available. Having said that, SendData command would keep the data in temporary buffer which have to be transferred to flash/NVM with Programdata command.

Please refer to the Output section of each command to understand the command and corresponding response available for the host. Host can follow this response structure to take decisions.

Lastly, looking at the console logs of CYSmart toll will be helpful (after once you compete the DFU process) to understand the command sequence used.

Hope it helps.

View solution in original post

2 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Have you gone through the PSoC 6 code examples from PSoC Creator that use BLE to upgrade the firmware over the air?

Please refer PSoC6DfuBleApp0 and PSoC6DfuBleApp1 code examples from PSoC Creator if you have not already seen them.

The Bootloader service in PSoC6DfuBleApp0 project takes care of loading the firmware from the host through the air. Please refer transport_ble.c in this code example for more information.

PSoC6DfuBleApp1 is your final application that will run in the PSoC which you can modify according to your wish.

-->On the Host side, you can use PC based CySmart GUI to load the application into PSoC. You can also look at the CySmart application documentation if you want to develop your own application.

Please go through all the above documentation and let us know if you have any queries.

Thanks

Ganesh

0 Likes
RavikiranH_01
Employee
Employee
10 sign-ins 25 replies posted 10 replies posted

@user_4631386
Ganesh has provided the best hints above to understand the process. If you are looking for further details on the protocol,  Please take a look at  WritePacket() , Cy_DFU_Continue() API;s in DFU SDK

Additionally, section B.2.4/B.2.5 and B.2.6 of AN213924 briefs the command sequence.   As you might know already, "Program data" is the core of the operation. You may want to have multiple ProgramData commands based on the local buffer size available. Having said that, SendData command would keep the data in temporary buffer which have to be transferred to flash/NVM with Programdata command.

Please refer to the Output section of each command to understand the command and corresponding response available for the host. Host can follow this response structure to take decisions.

Lastly, looking at the console logs of CYSmart toll will be helpful (after once you compete the DFU process) to understand the command sequence used.

Hope it helps.