Application Note
17 of 45
001-84858 Rev. *N
2021-03-23
PSoC 4 Programming Using an External Microcontroller (HSSP)
Interface for Receiving HSSP Programming Data
6
Interface for Receiving HSSP Programming Data
The files
DataFetch.c
and
DataFetch.h
contain the functions to fetch the data to be programmed into the target
device.
In the example project, the programming data is stored in the on-chip flash memory of the PSoC 5LP host
programmer in the files
HexImage.c
and
HexImage.h
. The data fetch routines access this data from the
PSoC 5LP flash memory to perform HSSP.
However, not all host programmers may have the on-chip memory to store the HSSP programming data. When
that is the case, the programmer can use a communication interface (such as SPI, USB, or UART) to get the
programming data. Also, all the function definitions in the
DataFetch.c
file should be modified appropriately.
The following example is a reference that shows the modifications required for the
Hex_ReadRowData()
function. You can perform similar modifications for other functions as well.
Original Code
Code Listing 4
Original Code to Get Flash Data
void HEX_ReadRowData(unsignedshortrowCount, unsignedchar * rowData)
{
/* Maximum value of 'i' can be 256 */
unsignedshort i;
for(i = 0; i<BYTES_PER_FLASH_ROW; i++)
{
rowData[i] = FlashData_HexFile[rowCount][i];
}
}
Modified Code
If the programming data is received through a communication interface, then the modified code should be
similar to the following one.
Code Listing 5
Modified Code to Get Flash Data
void HEX_ReadRowData(unsignedshortrowCount, unsignedchar * rowData)
{
/* Maximum value of 'i' can be 256 */
unsignedshort i;
/* ADD WAITING CODE HERE FOR THE UART BUFFER TO GET THE FLASH DATA */