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

cross mob

Custom communication interface support for PSoC 3/5 bootloaders

lock attach
Attachments are accessible only for community members.

Custom communication interface support for PSoC 3/5 bootloaders

Anonymous
Not applicable
Question: How to use the custom communication interface support for PSoC 3/5 bootloader in PSoC Creator 1.0 SP2?

 

Answer:

To use the custom communication interface support for bootloader, you need to follow the three step procedure as given below:


1) In the bootloader project, place the component which is used as communication interface for bootloading. Then, in the ‘Systems’ tab of design wide resources of the bootloader project, select 'Custom_Inteface' as the Bootloader IO Component as shown in the screenshot below:

 

2) Copy the following five communication function prototypes from the bottom of cybtldr.h into a c file where you want to implement them:

(i) void CyBtldrCommStart(void);
/*Start the communication component*/

(ii) void CyBtldrCommStop (void);
/*Stop the communication component*/

(iii) void CyBtldrCommReset(void);
/*Reset the communication component and its buffers to its initial state*/

(iv) cystatus CyBtldrCommWrite(uint8* buffer, uint16 size, uint16* count, uint8 timeOut);
/*This function should take the data from a buffer and send it over the selected communication protocol to the bootloader host. The parameters “buffer” and “size” give the pointer to the array that contains the data to be sent to the host and number of bytes of the data. This function should pass this data to the communication component and wait for the time specified by the “timeout” parameter (in multiples of 10s of milliseconds). The number of bytes of data actually sent over to the host should be written by this function to the parameter “count”.

Parameters:
buffer  - Pointer to the data to be sent across to the host
size    - Size of data buffer in number of bytes
count   - This function should update this variable with number of bytes those were actually read by the bootloader host within timeout period
timeout - This parameter sets a timeout in the units of 10 milliseconds. This function should wait for communication to finish for the time specified by timeout

Return:
CYRET_EMPTY    - If the communication did not complete within the specified timeout
CYRET_SUCCESS  - If the communication was completed successfully within the specified timeout */

 

(v) cystatus CyBtldrCommRead (uint8* buffer, uint16 size, uint16* count, uint8 timeOut);
/* This function should read the data received from the bootloader host over the selected communication protocol. The data received should be copied to an array locate at a pointer passed via the parameter “buffer”. This function should update the parameter “count” with the number bytes received from host. The parameter “size” contains the expected number of bytes to be received from host. This function should copy N data bytes to the array located at “buffer”; where N is least of the actual number of bytes received and the value of “size”. This function should wait for the time specified by the “timeout” parameter (in multiples of 10s of milliseconds).

Parameters:
buffer  - Pointer to the buffer where the data received over the communication interface should be copied
size    - Expected size of data buffer in number of bytes
count   - This function should update this variable with number of bytes received from the host
timeout - This parameter sets a timeout in the units of 10 milliseconds. This function should wait for host to finish writing data for the time specified by timeout

Return:
CYRET_EMPTY    - If the communication did not complete within the specified timeout
CYRET_SUCCESS  - If the data was received successfully within the specified timeout */


3) Provide implementations for these functions as described in the comments above and according to communication protocol being used. You can refer to the attached file below for the implementation of these functions in current dedicated I2C bootloader component in PSoC Creator.

 

For more details, kindly refer to the application note AN68272 - PSoC3 and PSoC5 - Customizing the bootloader communication channel.

Attachments
0 Likes
1272 Views
Contributors