Application Note
15 of 45
001-84858 Rev. *N
2021-03-23
PSoC 4 Programming Using an External Microcontroller (HSSP)
Calculating HSSP Timeout Parameters
TESTPIN_OUTPUT_LOW;
for(timestamp = 0; timestamp < 10; ti+)
{
Read_IO (CPUSS_SYSREQ, &statusCode);
/*performing SROM_SYSREQ_BIT | SROM_PRIVILEGED_BIT */
statusCode &= (SROM_SYSREQ_BIT | SROM_PRIVILEGED_BIT);
}
/* Make the pin high after sending SWD clock train */
TESTPIN_OUTPUT_HIGH;
This macro signifies the number of times CPUSS_SYSREQ can be read and checked if SROM_SYSREQ_BIT and
SROM_PRIVILEGED_BIT are set to 0 in a 1-second interval.
5.3
XRES_PULSE_100US
To reset the target device, the host generates an active LOW signal with a minimum pulse width of 5 µs on the
XRES line. In the HSSP code, a pulse width of 100 µs is generated on the XRES pin.
The function
TestDelayHundredUs()
is defined in the
TimeoutCalc.c
file.
In the C_Hssp_TimeoutCalc project provided with the application note, this function is implemented using the
CyDelayUs()
API. Uncomment the line in
TimeoutCalc.h
to implement this function using microcontrollers
other than PSoC as host programmer.
#define
XRES_PULSE_100US
600
Modify the code in
TestDelayHundredUs()
defined in the
TimeoutCalc.c
as given in code 3.
To calculate this macro, uncomment the
TestDelayHundredUs()
function in the
main.c
file of the project,
and then program the device. Measure the pulse width of the test pin on an oscilloscope.
Code Listing 3
Delay Routine
unsignedshort timestamp;
/* Make the pin low before start of the delay */
TESTPIN_OUTPUT_LOW;
/* For loop to introduce the 100 us delay
for(timestamp = 0; timestamp < XRES_PULSE_100US; ti+)
{