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

cross mob
ALuo4
Level 1
Level 1
First reply posted First question asked First like given

I am looking for a standalone package that has an executable bootloader host application without the need for PSoC Creator. This is similar to project AN73503 that creates a bootloader host for HIDs but instead I require a UART version.

I am aware of project AN68272 as well, which although is for UART’s, it only configures a UART bootloader without a separate host.

0 Likes
1 Solution
ARH
Level 3
Level 3
10 replies posted 5 replies posted 5 sign-ins

If you look in the PSoC Creator/4.3/PSoC Creator/cybootloaderutils directory you will find the C source files that you need in order to create your own bootloader host.

 

In order to do this you need to be able to make and compile a c-program for your target host.

The library is easy to use.... basically you create and fill a structure of type 

CyBtldr_CommunicationsDat
 
The members of this structure are 
typedef struct
{
/* Function used to open the communications connection */
int (*OpenConnection)(void);
/* Function used to close the communications connection */
int (*CloseConnection)(void);
/* Function used to read data over the communications connection */
int (*ReadData)(unsigned char*, int);
/* Function used to write data over the communications connection */
int (*WriteData)(unsigned char*, int);
/* Value used to specify the maximum number of bytes that can be trasfered at a time */
unsigned int MaxTransferSize;
} CyBtldr_CommunicationsData;


 
So you need to provide function pointers to:
open the serial port
close the serial port
read data from the device
write data to the device
 
And a limit of the maximum transfer size.
 
I did an I2C implementation for the raspberry pi... here is some cuts of the code.
 
To use this you do something like this:
 
printf("Starting Setup\n");

//setup reset pin
if(!bcm2835_init())
{
printf("init failed\n");
exit(0);
}

bcm2835_gpio_fsel(P4RESET, BCM2835_GPIO_FSEL_OUTP);
bcm2835_gpio_clr(P4RESET);

cd.OpenConnection = &CYPIOpenConnection;

cd.CloseConnection = &CYPICloseConnection;
cd.ReadData = &CYPIReadData;
cd.WriteData = &CYPIWriteData;
// cd.MaxTransferSize = 100;
cd.MaxTransferSize = 20;

printf("Ending Setup\n");

return CYRET_SUCCESS;
 
CyBtldr_Action action = PROGRAM;
rval = CyBtldr_RunAction(action, "p4arduino-creek.cyacd", &cd , &PUpdate);
 
 
Alan
 

View solution in original post

3 Replies