Application Note
14 of 45
001-84858 Rev. *N
2021-03-23
PSoC 4 Programming Using an External Microcontroller (HSSP)
Calculating HSSP Timeout Parameters
Measure the LOW pulse width on the test pin for one iteration of the device-acquiring sequence by using an
oscilloscope. Then, calculate this macro as follows:
DEVICE_ACQUIRE_TIMEOUT = (X ms/low pulse width), where X is the maximum time window for acquiring the
device as defined in
Code Listing 1
Calculating DEVICE_ACQUIRE_TIMEOUT Parameter
Unsignedshort
timestamp = 0;
Unsignedlongchip
_DAP_Id = 0;
/* Make the pin LOW before sending SWD clock train
*/
TESTPIN_OUTPUT_LOW;
for
(timestamp = 0; timestamp < 1; ti+)
{
Swd_LineReset();
Read_DAP(DPACC_DP_IDCODE_READ, &chip_DAP_Id);
}
/* Make the pin HIGH after sending SWD clock train
*/
TESTPIN_OUTPUT_HIGH;
5.2
SROM_POLLING_TIMEOUT
This macro is used in the SROM polling operations during HSSP programming. It is used while polling the result
of the nonvolatile memory read and write operations through SROM requests in the target device.
When the host requests a SROM system call through the SWD interface, it waits a maximum of one second while
reading the CPUSS_SYSREQ register for status. If a response is not received, the host aborts the HSSP
operation.
SROM_POLLING_TIMEOUT indicates the maximum number of times the CPUSS_SYSREQ register can be read in
a time window of one second.
To calculate this macro, uncomment the
TestSromPollingTimeout()
function in the
main.c
file of the
project, and then program the device.
Measure the LOW pulse width on the test pin after sending 10 iterations of the SROM polling sequence by using
an oscilloscope. Then calculate the macro as follows:
SROM_POLLING_TIMEOUT = (1 s/LOW pulse width)*10
Code Listing 2
Calculating the SROM_POLLING_TIMEOUT Parameter
Unsignedshort timestamp = 0;
UnsignedlongstatusCode = 0;
/* Make the pin low before sending SWD clock train */