background image

  

Application Note 

37 of 45 

001-84858 Rev. *N 

 

 

2021-03-23 

PSoC 4 Programming Using an External Microcontroller (HSSP) 

 

Appendix B: Status Codes for SROM Request 

15

 

Appendix B: Status Codes for SROM Request

 

All programming-related operations are implemented as system call functions. They are executed out of the 
SROM in the privileged mode of operation. 

You have no access to read or modify the SROM code. The DAP or the Cortex-M0 CPU requests the system call 
by writing the function opcode and function parameters to certain registers and then requesting the SROM to 
execute the function. Based on the function opcode, the SROM executes the corresponding system call from its 
memory and updates the function execution status in a register. The DAP or the CPU should read this status 
register for the pass/fail result of the function execution. 

When SROM_SYSREQ_BIT (bit 31) and SROM_PRIVILEGED_BIT (bit 28) of the CPUSS_SYSREQ register are 
cleared, that indicates the completion of the system call. The CPUSS_SYSARG register is read to check the 
success or failure status of the system call. 

If the 32-bit value read from the register is 0xAXXXXXXX (X 

denotes don’t

 care values), the system call was 

successful. If the value read from the register is in the form 0xF00000YY, it indicates failure, and YY indicates the 
reason for failure

Table 12

 shows the list of error codes. 

For more details, see the “Nonvolatile Memory Programming” chapters of the respective PSoC 4 

Architecture 

Technical Reference Manuals (TRM) listed in the 

Related Documentation

 section. 

Table 12

 

Error Status Codes and Reason for Failure 

Status Code 
(32-Bit Value in 
CPUSS_SYSARG 
Register) 

Description 

0xAXXXXXXX 

Success. The value “X” denotes 

the 

“don’t care” value, which contains 0 as 

returned by the SROM unless the API returns the parameter directly to the 
CPUSS_SYSARG register. 

0x F0000001 

Invalid Chip Protection Mode: This API is not available during the current chip 
protection mode. 

0x F0000003 

Invalid Page Latch Address: The address within the page latch buffer is either out 
of bounds or the size provided is too large for the page address. 

0x F0000004 

Invalid Address: The row ID or byte address provided is outside the available 
memory. 

0x F0000005 

Row Protected: The row ID provided is that of a protected row. 

0x F0000006 

SRAM Address Invalid: The SRAM address is out of bounds. 

0x F0000007 

Resume Completed: All non-blocking APIs have been completed. The resume API 
cannot be called until the next non-blocking API. 

0x F0000008 

Pending Resume: A non-blocking API was initiated, and it must be completed by 
calling the resume API before any other APIs may be called. 

0x F0000009 

System Call Still In Progress: A resume or non-blocking API is still in progress. The 
SPC ISR must fire before attempting the next resume. 

0x F000000A 

Checksum Zero Failed: The calculated checksum was not zero. 

0x F000000B 

Invalid Opcode: The opcode is not a valid API opcode. 

0x F000000C 

Key Opcode Mismatch; The opcode provided does not match key1 and key2. 

0x F000000E 

Invalid Start Address: The start address is greater than the end address provided. 

Содержание AN84858

Страница 1: ...code examples web page You can also explore the video training library here Table of contents About this document 1 Table of contents 1 1 Introduction 3 1 1 Types of Programmers 3 1 2 Terms and Defin...

Страница 2: ...cts 32 14 Appendix A Hex File Parser Application 33 14 1 Using the Hex File Parser Application 33 14 2 Adding the Generated Files to PSoC Creator Example Project 34 14 2 1 Using the HexImage c HexImag...

Страница 3: ...on the end application PCB You can connect the external programmer to the device s programming pins to do in system programming Socket programmers require the target device to be placed on the progra...

Страница 4: ...the host programmer Differences between bootloading and HSSP In embedded systems bootloaders are also used to update the system firmware Bootloading and HSSP differ in the following key aspects Bootlo...

Страница 5: ...interface I2 C SPI UART or USB or host flash as Figure 1 shows In addition the HSSP Programming Step layer uses the HSSP Timeout Parameters interface to configure timeouts in its programming APIs Host...

Страница 6: ...constitute the SWD Protocol Packet layer are described Table 2 SWD Protocol Packet Layer Files Source Files Description SWD_PacketLayer c and h files These files define the packet routines for sending...

Страница 7: ...nding flash protection 4 Checksum Privileged Calculation After all the user rows are erased this step calculates the checksum of the privileged rows which is used to verify the checksum of the user ro...

Страница 8: ...ls on the hex file format see Appendix B Intel Hex File Format in the programming specifications document of the respective device listed in the Related Documentation section of this document For host...

Страница 9: ...iption 2 0 SWD ACK These three bits store the acknowledge response of previous SWD transactions 3 SWD Read Data Parity Error If this bit is set it indicates a parity error in the data received by the...

Страница 10: ...ation section of this document Figure 3 shows the basic hardware connection required between the host programmer and the target device Host Programmer PSoC 40xx VDD VDDD SWDCK XRES SWDIO GND SWDCK P3...

Страница 11: ...ge h HexImage c DataFetch h DataFetch c ProgrammingSteps h ProgrammingSteps c RegisterDefines h 4 2 Code Changes Required While Porting Make the following changes to each of the files while porting th...

Страница 12: ...et the programming data In such a case remove these files DataFetch c The definitions for the functions should be modified based on the method used to get the programming data See Interface for Receiv...

Страница 13: ...Acquire in the ProgrammingSteps c file To program the device the device must be acquired within the maximum time window for acquiring the device after you do a device reset using the XRES pin Maximum...

Страница 14: ...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 request...

Страница 15: ...ne 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 applica...

Страница 16: ...yDelayUs API For microcontrollers other than PSoC as the host programmer the XRES_PULSE_100US parameter has to be defined in Timeout h and the delay should be implemented using this parameter in the D...

Страница 17: ...ce 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 mo...

Страница 18: ...18 of 45 001 84858 Rev N 2021 03 23 PSoC 4 Programming Using an External Microcontroller HSSP Interface for Receiving HSSP Programming Data for i 0 i BYTES_PER_FLASH_ROW i rowData i PLACE THE UART BU...

Страница 19: ...SWD Interface of the programming specifications document of the respective device listed in the Related Documentation section The host programmer must meet the timing parameters specified for the SWD...

Страница 20: ...ACQUIRE_TIMEOUT value discussed in the section DEVICE_ACQUIRE_TIMEOUT has to be modified to reflect the much longer 30 ms timeout window required for power cycle mode programming So for example if the...

Страница 21: ...hex file included by default in this project toggles pin P1 6 of PSoC 4 at 1 Hz frequency and displays PSoC Programmed on the character LCD mounted on the CY8CKIT 001 DVK after a successful programmin...

Страница 22: ...2 4 P12 4 P12 4 P12 4 To test this project follow these steps 1 Prepare the B_Hssp_Pioneer project a Generate the files containing the programming data HexImage c HexImage h for your target PSoC 4 dev...

Страница 23: ...eer Kit and the location of the status LED and reset switch Figure 6 PSoC 4 Pioneer Kit 3 Bootload the HSSP project to PSoC 5LP a Open the bootloader host tool Choose Tools Bootloader Host in PSoC Cre...

Страница 24: ...les are not signed Ignore the warning and proceed Now the USBUART driver is installed on your machine 5 Use HyperTerminal to start HSSP programming a Open HyperTerminal on your computer If you do not...

Страница 25: ...the B_Hssp_Pioneer cyacd project to PSoC 5LP via USB to be used as an HSSP host programmer This project uses a USB to UART Component to display the programming outputs on HyperTerminal which is a sta...

Страница 26: ...tion note and select KitProg2_Bootloader hex for the Bootloader HEX file field The Bootloader ELF file will be automatically generated on selecting the Bootloader HEX file Figure 10 Bootloadable Depen...

Страница 27: ...USBUART drivers do the following a Open Device Manager Make sure USBUART is present in the Other devices list b Double click the USBUART entry to open its properties c Click Update Driver d Select the...

Страница 28: ...the terminal displays the step and error code that you can use to debug the project Figure 13 Terminal Display 6 Reprogram PSoC 5LP with the kit firmware a Open PSoC Programmer b Enter the bootloader...

Страница 29: ...step of the HSSP Device Acquire has strict timing requirements with regards to entering the programming mode One of the important requirements is to ensure that the frequency of SWDCK clock line is a...

Страница 30: ...ion is useful for developing in system programming solutions for PSoC 4 devices It provides a cheap and robust method for programming PSoC 4 devices using an onboard embedded microcontroller as a host...

Страница 31: ...pecifications CY8C41XX CY8C42XX Programming Specifications CY8C4000 Programming Specifications 12 3 Architecture Technical Reference Manuals PSoC 4000 Family PSoC 4 Architecture Technical Reference Ma...

Страница 32: ...ogramming specifications document of the respective device listed in the Related Documentation section B_Hssp_Pioneer This is the PSoC 4 HSSP application project for testing on the PSoC 4 Pioneer Kit...

Страница 33: ...s The programming data is stored as an array of constants in the HexImage c and HexImage h files The C application with the source code is provided along with the application note To use the C applica...

Страница 34: ...t folder location 3 After selecting the hex file and the target folder location click Parse Hex File to generate the c and h files After parsing is complete a message is displayed 14 2 Adding the Gene...

Страница 35: ...are selected the Workspace Explorer window appears as follows Figure 17 Project Workspace showing HexImage c and HexImage h Files If you need to replace these files in the project with those correspon...

Страница 36: ...the programming data corresponding to the last few flash rows is deleted from the HexImage c and HexImage h files The corresponding logic has also been incorporated in the HEX_ReadRowData function in...

Страница 37: ...ve PSoC 4 Architecture Technical Reference Manuals TRM listed in the Related Documentation section Table 12 Error Status Codes and Reason for Failure Status Code 32 Bit Value in CPUSS_SYSARG Register...

Страница 38: ...al Microcontroller HSSP Appendix B Status Codes for SROM Request Status Code 32 Bit Value in CPUSS_SYSARG Register Description 0xF0000012 Invalid Flash Clock The CY8C40xx family of devices must set th...

Страница 39: ...e host during the previous SWD write packet Any other code Undefined code Treat this as a FAULT response All the responses except the OK ACK response require that the host abort the HSSP operation and...

Страница 40: ...the Cortex M0 DAP ID 0x0BB11477 Verify Silicon ID Step 2 Silicon ID Verification Error Silicon ID information in the hex file does not match the Silicon ID read from the target device Verify Flash St...

Страница 41: ...high impedance digital input drive mode SetXresHizInput Configures the host XRES pin for high impedance digital input drive mode ReadSwdio Returns the current state of the SWDIO input pin Table 16 Fun...

Страница 42: ...ay The byte size of the protection data is also passed as a parameter to this function HEX_ReadChipProtectionData Copies the chip protection data from the HexImage c file to an indicated destination H...

Страница 43: ...her the checksum data read from the target device matches the hex file checksum data ExitProgrammingMode Exits the target device programming mode by generating an active LOW pulse signal on the XRES p...

Страница 44: ...CKIT 046 I 2015 12 30 Updated the example projects to PSoC Creator 3 3 SP1 J 2017 03 23 AN updated to support PSoC 4000S PSoC 4100S and PSoC Analog Coprocessor Modified Figure 3 to include PSoC 4000S...

Страница 45: ...note The data contained in this document is exclusively intended for technically trained staff It is the responsibility of customer s technical departments to evaluate the suitability of the product...

Отзывы: