PSOC4 UART bootloader with custom protocol (packets)

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

cross mob
frprc_1262176
Level 1
Level 1
5 sign-ins First like received Welcome!

Hi all,

I will have to customize the protocol (specifically the packets) of the communication between bootloader and PC host, basically ignoring the commands used in Infineon out-of-the-box update process.

Reading through the various appnotes, it seems to me that the only way to achieve this is through:

void Bootloader_InitCallback(Bootloader_callback_type userCallback);

that initializes the callback variable used when the bootloader receives an unknown packet.

 

As I have no hardware yet to test this, Am I right? 

 

If yes,  is there a way to throw away all the code that supports the Infineon standard commands? From what I see, it seems precompiled in binary form in cybootloader.c (Generated):

__attribute__ ((__section__(".cybootloader"), used))
const uint8 cy_bootloader[] = {
0x00u, 0x10u, 0x00u, 0x20u, 0x11u, 0x00u, 0x00u, 0x00u, ...

 

Thanks for any hint,

BR

F

7 Replies
Sidramesh_S
Moderator
Moderator
Moderator
250 sign-ins 100 replies posted 25 solutions authored

Hi @frprc_1262176 ,

Do you want to customize the packets you send through the UART while Bootloading?

also, let me know which PSoC 4 device(MCU) you wish/want to use ? 

I found the below in the Bootloader and Bootloadable Component datasheet.
The Bootloader_Callback  feature is intended for the creation of the user’s own command for communication between the Host and the Bootloader. The callback feature is available only if a callback functionality is initialized
by Bootloader_InitCallback() function.

It is mentioned only for using the user's own commands, not sure about the entire package.

I will look into the other documents and update you.

Thanks and regards,
Sidramesh

0 Likes
frprc_1262176
Level 1
Level 1
5 sign-ins First like received Welcome!

Hi Sidramesh,

>> Do you want to customize the packets you send through the UART while Bootloading?

Yes, I need to implement different packets (format) in order to bootload.

 

>> which PSoC 4 device(MCU) you wish/want to use ? 

Sorry but I don't know the exact PSoC part number to use.

 

>> The Bootloader_Callback  feature is intended for the creation of the user’s own command for communication between the Host and the Bootloader

In Bootloader.c (about row 1725) there is a check of the received packet as follows:

 

if(
   (numberRead < Bootloader_MIN_PKT_SIZE) ||
   (packetBuffer[Bootloader_SOP_ADDR] != Bootloader_SOP))
{
  ackCode = Bootloader_ERR_DATA;
}
else
{
  ...
}

 

that tells me that  the expected format of the packet is restricted. In other words I can add new commands but with the format of the standard ones.

 

I think I'll proceed disabling API generation for the bootloader component and modifying Bootloader.c source file in order to implement my protocol. I prefer that over building a new component for my special needs.

What do you think about my approach?

Thanks for your time,

BR

0 Likes
lock attach
Attachments are accessible only for community members.
Sidramesh_S
Moderator
Moderator
Moderator
250 sign-ins 100 replies posted 25 solutions authored

Hi @frprc_1262176 ,

Apologies for the delay.

If you are changing the packets of UART then it will comes under custom communication interface.

Please go through the Custom Communication Interface Section(present in page number 56) in the attached Bootloader and Bootloadable component datasheet for more details.

Thanks and regards,
Sidramesh

0 Likes

Hello Sidramesh.

Why was the text of section Custom Communication Interface deleted from version 1.6 of Bootloader and Bootloadable document?  This was very useful information to have handy.  Can it be put back into a future version of document?

regards.

0 Likes
Adward654
Level 1
Level 1
First reply posted Welcome!

newtoki@Creating a custom protocol for a UART bootloader on a PSoC 4 device involves defining a set of rules and procedures for communication between the host and the PSoC device during the firmware update process. Below are the general steps and considerations for implementing a custom protocol:

1. Define Packet Structure:

  • Decide on the structure of the data packets exchanged between the host and the PSoC device. This includes header fields, payload, and checksum/CRC for error checking.
0 Likes
lock attach
Attachments are accessible only for community members.
Sidramesh_S
Moderator
Moderator
Moderator
250 sign-ins 100 replies posted 25 solutions authored

Hi @BiBi_1928986 ,

Bootloader and bootloadable datasheet 1.60 is based on version 1.50, which does not have both communication interface functions and the Custom Communication Interface section.

Both communication interface functions and Custom Communication Interface Section are updated in Bootloader and Bootloadable datasheet 1.50a and I have attached it kindly refer.

Sidramesh_0-1696418049387.png


So I requested our internal team to update both communication interface functions and the Custom Communication Interface Section in the next version of  Bootloader and Bootloadable datasheet 1.60.
It will be updated soon.

Thanks and regards,
Sidramesh

0 Likes

Thank you for the clarification.

0 Likes