[S32K3] Restrict the debug access with a password when HSE is not used

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[S32K3] Restrict the debug access with a password when HSE is not used

[S32K3] Restrict the debug access with a password when HSE is not used

The procedure to restrict JTAG access on the S32K3 MCU depends on whether HSE Firmware (FW) is used:

With HSE FW: This scenario is not covered in this document.

Without HSE FW:

WARNING: ONCE THIS PROCESS IS COMPLETED, HSE CANNOT BE INSTALLED ON THE DEVICE.

Development Environment:
All code snippets provided represent the essential parts of the application and were developed using:

  • Test HW: S32K344 (not EVB)
  • MCU: S32K344
  • IDE: S32DS v3.5
  • Debugger: PEmicro USB Multilink Universal FX (unless otherwise noted)
  • Drivers: S32K3 Real-Time Drivers v3.0.0 (released March 31, 2023)
  • Base Project: Modified version of C40_Ip_Example_S32K344

Step 1: Program the CUST_DB_PSWD_A Field

The UTEST Sector is an OTP (One Time Programmable), meaning erase operations are not allowed. You can only append or read data.

  • Memory Range: 0x1B00_0080 to 0x1B00_009
  • Only the first 16 bytes (0x1B00_0080 to 0x1B00_008F) are usable.
  • The rest is reserved (see Table 202 in the S32K3xx Reference Manual, Rev. 11).

Programming Steps:

I. Unlock the UTEST sector using PFCBLKU_SPELOCK[SLCK].

II. Write the 16-byte password to address 0x1B00_0080.

Code Adjustments:

/*============================================================================
*                                       LOCAL MACROS
============================================================================*/
#define FLS_MASTER_ID                0U
#define FLS_BUF_SIZE                 16U
#define FLS_SECTOR_ADDR              0x1B000080U
#define FLS_SECTOR_TEST              C40_UTEST_ARRAY_0_S000

NOTE: Ensure FLS_MAX_VIRTUAL_SECTOR and C40_SECTOR_ERROR are correctly defined in C40_Ip_Cfg.h:

Instead of:

#define FLS_MAX_VIRTUAL_SECTOR              (527U)
… 
#define C40_SECTOR_ERROR                    (528U)    

Use:

#define FLS_MAX_VIRTUAL_SECTOR              (528U) 
…
#define C40_SECTOR_ERROR                    (529U)    
/*============================================================================
*                                      GLOBAL CONSTANTS
============================================================================*/
uint8 TxBuffer[FLS_BUF_SIZE] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F}; /* Password */
VaneB_0-1696631634239.png

You can verify the password using the Memory Viewer (not covered here).

VaneB_1-1696631672308.png
 

Step 2: Advance the MCU Lifecycle

I. Set the lifecycle configuration word address in the IVT/boot header. Refer to sections 32.5 and 32.5.3 of the Reference Manual.

NOTE: Ensure the structure of the boot_header (located in Project_Settings → Startup_Code → startup_cm7.s) is defined as follows:

VaneB_2-1696631885135.png

#define LF_CONFIG_ADDR              (0x007D2000) /* The LC word can be at any flash address, taking care that does not interfere with HSE */

II. Write the LC word to the defined address:

Life cycle stage Valid Values for LC Advancement
OEM_PROD DADA_DADAh
IN_FIELD BABA_BABAh

Code Adjustments:

/*===========================================================================
*                                       LOCAL MACROS
===========================================================================*/
#define FLS_MASTER_ID                0U
#define FLS_BUF_SIZE                 8U
#define FLS_SECTOR_ADDR              0x007D2000U
#define FLS_SECTOR_TEST              C40_CODE_ARRAY_0_BLOCK_3_S489 /* Look into C40_Ip_Cfg.h file to find the corresponding sector */
/*===========================================================================
*                                      GLOBAL CONSTANTS
===========================================================================*/
uint8 LC_TxBuffer[FLS_LC_SIZE] = {0xDA, 0xDA, 0xDA, 0xDA, 0x0, 0x0, 0x0, 0x0}; /* Minimum data length 8 bytes */

VaneB_3-1696632329064.png

Confirm the LC word using the Memory Viewer.

VaneB_4-1696632360649.png

III. Reset the MCU using the RESET_B pin, not the debugger.

If the procedure was done correctly, you should see the following message:

VaneB_5-1696632423439.png

Step 3: Debugger Authentication

To unlock the MCU, PEmicro provides Python scripts (PEmicro support files package) to facilitate debugger authentication when the password is set.

In summary:

I. Ensure Python 3.5 or later is installed.
II. Open Command Prompt.
III. Use cd to navigate to the directory containing the file package.
IV. Run the script: py authenticate_password_mode.py -hardwareid=USB1 -password=…

  • hardwareid: Debug hardware IP, name, serial number, or port
  • password: 16-byte hexadecimal password

NOTE: This must be done every time the MCU is reset or power cycled.  

VaneB_6-1696632573362.png

Step 4: Secure Debugging in S32DS

In S32DS, when configuring the Debug Configurations of a project, change the Target to "SECUREDEBUG". This is necessary because during debug entry, a hard reset is toggled, which clears the authentication.

VaneB_7-1696632658751.png

VaneB_8-1696632678698.png

Once authenticated, you can securely debug the device in S32DS. 

*Additional Resources

Comments

Can the CUST_DB_PSWD_A area be programmed by JTAG? 

We want to directly program this ares at ICT by PE.

%3CLINGO-SUB%20id%3D%22lingo-sub-1735073%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%5BS32K3%5D%20Restrict%20the%20debug%20access%20with%20a%20password%20when%20HSE%20is%20not%20used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1735073%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%0A%3CP%3EThe%20procedure%20to%20restrict%20JTAG%20access%20on%20the%20S32K3%20MCU%20depends%20on%20whether%20HSE%20Firmware%20(FW)%20is%20used%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EWith%20HSE%20FW%3A%20%3C%2FSTRONG%3E%3C%2FEM%3EThis%20scenario%20is%20not%20covered%20in%20this%20document.%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EWithout%20HSE%20FW%3A%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3E%3CEM%3EWARNING%3A%20ONCE%20THIS%20PROCESS%20IS%20COMPLETED%2C%20HSE%20CANNOT%20BE%20INSTALLED%20ON%20THE%20DEVICE.%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EDevelopment%20Environment%3A%3C%2FSTRONG%3E%3C%2FEM%3E%3CBR%20%2F%3EAll%20code%20snippets%20provided%20represent%20the%20essential%20parts%20of%20the%20application%20and%20were%20developed%20using%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETest%20HW%3A%20S32K344%20(not%20EVB)%3C%2FLI%3E%0A%3CLI%3EMCU%3A%20S32K344%3C%2FLI%3E%0A%3CLI%3EIDE%3A%20S32DS%20v3.5%3C%2FLI%3E%0A%3CLI%3EDebugger%3A%20PEmicro%20USB%20Multilink%20Universal%20FX%20(unless%20otherwise%20noted)%3C%2FLI%3E%0A%3CLI%3EDrivers%3A%20S32K3%20Real-Time%20Drivers%20v3.0.0%20(released%20March%2031%2C%202023)%3C%2FLI%3E%0A%3CLI%3EBase%20Project%3A%20Modified%20version%20of%20C40_Ip_Example_S32K344%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3EStep%201%3A%26nbsp%3B%3C%2FSTRONG%3EProgram%20the%20CUST_DB_PSWD_A%20Field%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20UTEST%20Sector%20is%20an%20OTP%20(One%20Time%20Programmable)%2C%20meaning%20erase%20operations%20are%20not%20allowed.%20You%20can%20only%20append%20or%20read%20data.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMemory%20Range%3A%200x1B00_0080%20to%200x1B00_009%3C%2FLI%3E%0A%3CLI%3EOnly%20the%20first%2016%20bytes%20(0x1B00_0080%20to%200x1B00_008F)%20are%20usable.%3C%2FLI%3E%0A%3CLI%3EThe%20rest%20is%20reserved%20(see%20Table%20202%20in%20the%20S32K3xx%20Reference%20Manual%2C%20Rev.%2011).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EProgramming%20Steps%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EI.%3C%2FSTRONG%3E%20Unlock%20the%20UTEST%20sector%20using%20PFCBLKU_SPELOCK%5BSLCK%5D.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EII.%3C%2FSTRONG%3E%20Write%20the%2016-byte%20password%20to%20address%200x1B00_0080.%3C%2FP%3E%0A%3CP%3ECode%20Adjustments%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F*%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A*%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20LOCAL%20MACROS%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*%2F%0A%23define%20FLS_MASTER_ID%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200U%0A%23define%20FLS_BUF_SIZE%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2016U%0A%23define%20FLS_SECTOR_ADDR%20%20%20%20%20%20%20%20%20%20%20%20%20%200x1B000080U%0A%23define%20FLS_SECTOR_TEST%20%20%20%20%20%20%20%20%20%20%20%20%20%20C40_UTEST_ARRAY_0_S000%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENOTE%3A%3C%2FEM%3E%3C%2FSTRONG%3E%20Ensure%20FLS_MAX_VIRTUAL_SECTOR%20and%20C40_SECTOR_ERROR%20are%20correctly%20defined%20in%20C40_Ip_Cfg.h%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3EInstead%20of%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%23define%20FLS_MAX_VIRTUAL_SECTOR%20%20%20%20%20%20%20%20%20%20%20%20%20%20(527U)%0A%E2%80%A6%20%0A%23define%20C40_SECTOR_ERROR%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(528U)%20%20%20%20%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%20class%3D%22paragraph%22%20style%3D%22margin%3A%200in%3B%20vertical-align%3A%20baseline%3B%22%3E%3CSPAN%20class%3D%22normaltextrun%22%3E%3CSTRONG%3E%3CI%3E%3CSPAN%3EUse%3A%3C%2FSPAN%3E%3C%2FI%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%23define%20FLS_MAX_VIRTUAL_SECTOR%20%20%20%20%20%20%20%20%20%20%20%20%20%20(528U)%20%0A%E2%80%A6%0A%23define%20C40_SECTOR_ERROR%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(529U)%20%20%20%20%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FBLOCKQUOTE%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F*%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A*%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20GLOBAL%20CONSTANTS%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*%2F%0Auint8%20TxBuffer%5BFLS_BUF_SIZE%5D%20%3D%20%7B0x01%2C0x02%2C0x03%2C0x04%2C0x05%2C0x06%2C0x07%2C0x08%2C0x09%2C0x0A%2C0x0B%2C0x0C%2C0x0D%2C0x0E%2C0x0F%7D%3B%20%2F*%20Password%20*%2F%0A%3C%2FCODE%3E%3C%2FPRE%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_0-1696631634239.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_0-1696631634239.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_0-1696631634239.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243923iD470A286AFBA6A11%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_0-1696631634239.png%22%20alt%3D%22VaneB_0-1696631634239.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CP%3EYou%20can%20verify%20the%20password%20using%20the%20Memory%20Viewer%20(not%20covered%20here).%3C%2FP%3E%0A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_1-1696631672308.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_1-1696631672308.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_1-1696631672308.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243924i486DF24B39878707%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_1-1696631672308.png%22%20alt%3D%22VaneB_1-1696631672308.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CDIV%20class%3D%22lia-message-template-content-zone%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-template-content-zone%22%3E%0A%3CP%3E%3CSTRONG%3EStep%202%3A%26nbsp%3B%3C%2FSTRONG%3EAdvance%20the%20MCU%20Lifecycle%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EI.%26nbsp%3B%3C%2FSTRONG%3ESet%20the%20lifecycle%20configuration%20word%20address%20in%20the%20IVT%2Fboot%20header.%20Refer%20to%20sections%2032.5%20and%2032.5.3%20of%20the%20Reference%20Manual.%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENOTE%3A%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E%20Ensure%20the%20structure%20of%20the%20boot_header%20(located%20in%20%3CSTRONG%3EProject_Settings%20%E2%86%92%20Startup_Code%20%E2%86%92%20startup_cm7.s%3C%2FSTRONG%3E)%20is%20defined%20as%20follows%3A%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_2-1696631885135.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_2-1696631885135.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_2-1696631885135.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243927i22C7BADC3B24D4A6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_2-1696631885135.png%22%20alt%3D%22VaneB_2-1696631885135.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%23define%20LF_CONFIG_ADDR%20%20%20%20%20%20%20%20%20%20%20%20%20%20(0x007D2000)%20%2F*%20The%20LC%20word%20can%20be%20at%20any%20flash%20address%2C%20taking%20care%20that%20does%20not%20interfere%20with%20HSE%20*%2F%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSTRONG%3EII.%3C%2FSTRONG%3E%20Write%20the%20LC%20word%20to%20the%20defined%20address%3A%3C%2FP%3E%0A%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%20class%3D%22lia-align-center%22%20style%3D%22text-align%3A%20center%3B%22%20style%3D%22text-align%3A%20center%3B%22%20style%3D%22text-align%3A%20center%3B%22%3ELife%20cycle%20stage%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%20class%3D%22lia-align-center%22%20style%3D%22text-align%3A%20center%3B%22%20style%3D%22text-align%3A%20center%3B%22%20style%3D%22text-align%3A%20center%3B%22%3EValid%20Values%20for%20LC%20Advancement%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%3EOEM_PROD%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%3EDADA_DADAh%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%3EIN_FIELD%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2225px%22%3EBABA_BABAh%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3ECode%20Adjustments%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F*%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A*%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20LOCAL%20MACROS%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*%2F%0A%23define%20FLS_MASTER_ID%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%200U%0A%23define%20FLS_BUF_SIZE%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%208U%0A%23define%20FLS_SECTOR_ADDR%20%20%20%20%20%20%20%20%20%20%20%20%20%200x007D2000U%0A%23define%20FLS_SECTOR_TEST%20%20%20%20%20%20%20%20%20%20%20%20%20%20C40_CODE_ARRAY_0_BLOCK_3_S489%20%2F*%20Look%20into%20C40_Ip_Cfg.h%20file%20to%20find%20the%20corresponding%20sector%20*%2F%0A%2F*%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A*%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20GLOBAL%20CONSTANTS%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D*%2F%0Auint8%20LC_TxBuffer%5BFLS_LC_SIZE%5D%20%3D%20%7B0xDA%2C%200xDA%2C%200xDA%2C%200xDA%2C%200x0%2C%200x0%2C%200x0%2C%200x0%7D%3B%20%2F*%20Minimum%20data%20length%208%20bytes%20*%2F%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_3-1696632329064.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_3-1696632329064.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_3-1696632329064.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243928iB994DE7E97980D41%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_3-1696632329064.png%22%20alt%3D%22VaneB_3-1696632329064.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EConfirm%20the%20LC%20word%20using%20the%20Memory%20Viewer.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_4-1696632360649.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_4-1696632360649.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_4-1696632360649.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243929iE3B144030B93734E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_4-1696632360649.png%22%20alt%3D%22VaneB_4-1696632360649.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3EIII.%3C%2FSTRONG%3E%20Reset%20the%20MCU%20using%20the%20RESET_B%20pin%2C%20not%20the%20debugger.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20the%20procedure%20was%20done%20correctly%2C%20you%20should%20see%20the%20following%20message%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_5-1696632423439.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_5-1696632423439.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_5-1696632423439.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243930i15FFCB5B70DF9F2E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_5-1696632423439.png%22%20alt%3D%22VaneB_5-1696632423439.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%203%3A%26nbsp%3B%3C%2FSTRONG%3EDebugger%20Authentication%3C%2FP%3E%0A%3CP%3ETo%20unlock%20the%20MCU%2C%20PEmicro%20provides%20Python%20scripts%20(%3CA%20href%3D%22https%3A%2F%2Fwww.pemicro.com%2Flearningcenter%2Fcontents.cfm%3Fcontent_id%3D82%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EPEmicro%20support%20files%20package%3C%2FA%3E)%20to%20facilitate%20debugger%20authentication%20when%20the%20password%20is%20set.%3C%2FP%3E%0A%3CP%3EIn%20summary%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EI.%26nbsp%3B%3C%2FSTRONG%3EEnsure%20Python%203.5%20or%20later%20is%20installed.%3CBR%20%2F%3E%3CSTRONG%3EII.%3C%2FSTRONG%3E%20Open%20Command%20Prompt.%3CBR%20%2F%3E%3CSTRONG%3EIII.%3C%2FSTRONG%3E%20Use%20cd%20to%20navigate%20to%20the%20directory%20containing%20the%20file%20package.%3CBR%20%2F%3E%3CSTRONG%3EIV.%3C%2FSTRONG%3E%20Run%20the%20script%3A%20%3CEM%3E%3CSTRONG%3Epy%20authenticate_password_mode.py%20-hardwareid%3DUSB1%20-password%3D%E2%80%A6%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Ehardwareid%3A%20Debug%20hardware%20IP%2C%20name%2C%20serial%20number%2C%20or%20port%3C%2FLI%3E%0A%3CLI%3Epassword%3A%2016-byte%20hexadecimal%20password%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENOTE%3A%3C%2FEM%3E%3C%2FSTRONG%3E%20This%20must%20be%20done%20every%20time%20the%20MCU%20is%20reset%20or%20power%20cycled.%3CEM%3E%26nbsp%3B%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_6-1696632573362.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_6-1696632573362.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_6-1696632573362.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243931iD00E4D992850236F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_6-1696632573362.png%22%20alt%3D%22VaneB_6-1696632573362.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%204%3A%3C%2FSTRONG%3E%26nbsp%3BSecure%20Debugging%20in%20S32DS%3C%2FP%3E%0A%3CP%3EIn%20S32DS%2C%20when%20configuring%20the%20Debug%20Configurations%20of%20a%20project%2C%20change%20the%20Target%20to%20%22SECUREDEBUG%22.%20This%20is%20necessary%20because%20during%20debug%20entry%2C%20a%20hard%20reset%20is%20toggled%2C%20which%20clears%20the%20authentication.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_7-1696632658751.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_7-1696632658751.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_7-1696632658751.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243932i396680C25FDE74AF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_7-1696632658751.png%22%20alt%3D%22VaneB_7-1696632658751.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VaneB_8-1696632678698.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_8-1696632678698.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VaneB_8-1696632678698.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243933i963F2BBE297F3A2C%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VaneB_8-1696632678698.png%22%20alt%3D%22VaneB_8-1696632678698.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOnce%20authenticated%2C%20you%20can%20securely%20debug%20the%20device%20in%20S32DS.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E*%3C%2FSTRONG%3EAdditional%20Resources%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EiSystem%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.isystem.com%2Fdownloads%2FwinIDEA%2Fhelp%2Fnxp-s32-unlock-secure-debug.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EHow%20to%20unlock%20secure%20debug%20on%20NXP%20S32G2%2F3xx%2C%20S32R45x%2C%20and%20S32K3%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3ESegger%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fkb.segger.com%2FNXP_S32K3xx%23Debug_Authentication%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ENXP%20S32K3xx%20-%26nbsp%3BDebug%20Authentication%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1765437%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%5BS32K3%5D%20Restrict%20the%20debug%20access%20with%20a%20password%20when%20HSE%20is%20not%20used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1765437%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ECan%20the%26nbsp%3B%3CSPAN%3ECUST_DB_PSWD_A%20area%20be%3C%2FSPAN%3E%26nbsp%3Bprogrammed%20by%20JTAG%3F%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20want%20to%20directly%20program%20this%20ares%20at%20ICT%20by%20PE.%3C%2FP%3E%3C%2FLINGO-BODY%3E
100% helpful (3/3)
Version history
Last update:
‎10-23-2025 12:10 PM
Updated by: