<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: S32K3 UTEST program generates hardfault in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421218#M61471</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Please check the value of "&lt;STRONG&gt;21.7.1.3 Module Configuration Status (MCRS)&lt;/STRONG&gt;"&amp;nbsp;at address 0x402EC004.&amp;nbsp; If MCRS[RWE] = 1, it means that an&amp;nbsp;RWW error occurred during a previous read.&lt;/P&gt;
&lt;P&gt;Then please read the discussion in&amp;nbsp; "&lt;A href="https://community.nxp.com/t5/S32K/Hard-Fault-in-C40-Ip-MainInterfaceHVJobStatus-api-when-flash-is/m-p/2002382" target="_self"&gt;Hard Fault in C40_Ip_MainInterfaceHVJobStatus api when flash is erase in s32k312&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Robin&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2026 03:29:12 GMT</pubDate>
    <dc:creator>Robin_Shen</dc:creator>
    <dc:date>2026-10-15T03:29:12Z</dc:date>
    <item>
      <title>S32K3 UTEST program generates hardfault</title>
      <link>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421177#M61470</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am trying to create a test application to restrict JTAG/debug access by setting a 16 byte password (without HSE) for an S32K312. Previously my approach was 2 staged - I had one program to set the password, and another to advance the lifecycle, and this seemingly worked fine.&lt;BR /&gt;&lt;BR /&gt;I am now trying to combine both into a single sequence to integrate into my main application eventually, but I am facing issues where the MCU generates a hardfault when I try to program the password.&lt;BR /&gt;&lt;BR /&gt;I can confirm that before trying to program the password, there is no password set (0xFF throughout) and even though a hardfault was generated, the password has actually been programmed - this must have been why my previous 2 staged approach worked, as even if the first stage hardfaulted, I would not have noticed and simply programmed the second stage.&lt;BR /&gt;&lt;BR /&gt;Below is my code snippet. Do note that I have also set the lifecycle configuration word address in the startup script, to be included in the IVT. There are no other modifications to the startup script or linker.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define MASTER_ID 						(0U)
#define CUST_DB_PSWD_A_ADDR 			(0x1B000080U)
#define CUST_DB_PSWD_A_SECTOR 			(C40_UTEST_ARRAY_0_S000)
#define CUST_DB_PSWD_A_LENGTH 			(16U)

#define LC_CONFIGURATION_WORD_ADDR 		(0x005A6000)
#define LC_CONFIGURATION_WORD_SECTOR 	(C40_CODE_ARRAY_0_BLOCK_1_S211)
#define LC_CONFIGURATION_WORD_LENGTH 	(8U)

uint8_t cust_db_pswd_a[CUST_DB_PSWD_A_LENGTH] __attribute__((aligned(4)))
= { 0x35, 0x2E, 0x04, 0x92, 0x65, 0x25, 0x09, 0x23, 0x35, 0x2E, 0x04, 0x92,
		0x65, 0x25, 0x09, 0x23 };

uint8_t lc_configuration_word[LC_CONFIGURATION_WORD_LENGTH] __attribute__((aligned(4)))
= { 0xBA, 0xBA, 0xBA, 0xBA, 0x0, 0x0, 0x0, 0x0 }; /* Minimum data length 8 bytes */

int main(void) {

	Clock_Ip_Init(&amp;amp;Clock_Ip_aClockConfig[0]);

	C40_Ip_Init(&amp;amp;C40_Ip_InitCfg);

	/* PROGRAMMING ADKP */
	if (C40_Ip_GetLock(CUST_DB_PSWD_A_SECTOR)
			== C40_IP_STATUS_SECTOR_PROTECTED) {
		C40_Ip_ClearLock(CUST_DB_PSWD_A_SECTOR, MASTER_ID);
	}

	C40_Ip_MainInterfaceWrite(CUST_DB_PSWD_A_ADDR, CUST_DB_PSWD_A_LENGTH,
			cust_db_pswd_a, MASTER_ID); /* Hardfaults here, but UTEST program is actually successful */
	while (C40_Ip_MainInterfaceWriteStatus() == C40_IP_STATUS_BUSY)
		;

	/* ADVANCING LC */
	if (C40_Ip_GetLock(LC_CONFIGURATION_WORD_SECTOR)
			== C40_IP_STATUS_SECTOR_PROTECTED) {
		C40_Ip_ClearLock(LC_CONFIGURATION_WORD_SECTOR, MASTER_ID);
	}

	C40_Ip_MainInterfaceSectorErase(LC_CONFIGURATION_WORD_SECTOR,
	MASTER_ID);
	while (C40_Ip_MainInterfaceSectorEraseStatus() == C40_IP_STATUS_BUSY)
		;

	C40_Ip_MainInterfaceWrite(LC_CONFIGURATION_WORD_ADDR,
	LC_CONFIGURATION_WORD_LENGTH, lc_configuration_word, MASTER_ID);
	while (C40_Ip_MainInterfaceWriteStatus() == C40_IP_STATUS_BUSY)
		;

	while (true)
		;

	return 0U;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;my .mex configuration is as such -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hareesh_S_3-1792008676439.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/397991i92A8175A287898E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hareesh_S_3-1792008676439.png" alt="Hareesh_S_3-1792008676439.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hareesh_S_4-1792008695732.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/397992i082051CCC79472FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hareesh_S_4-1792008695732.png" alt="Hareesh_S_4-1792008695732.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any inputs as to what I am doing wrong?&lt;BR /&gt;&lt;BR /&gt;With regards,&lt;BR /&gt;Hareesh S&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2026 20:13:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421177#M61470</guid>
      <dc:creator>Hareesh_S</dc:creator>
      <dc:date>2026-10-14T20:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: S32K3 UTEST program generates hardfault</title>
      <link>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421218#M61471</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Please check the value of "&lt;STRONG&gt;21.7.1.3 Module Configuration Status (MCRS)&lt;/STRONG&gt;"&amp;nbsp;at address 0x402EC004.&amp;nbsp; If MCRS[RWE] = 1, it means that an&amp;nbsp;RWW error occurred during a previous read.&lt;/P&gt;
&lt;P&gt;Then please read the discussion in&amp;nbsp; "&lt;A href="https://community.nxp.com/t5/S32K/Hard-Fault-in-C40-Ip-MainInterfaceHVJobStatus-api-when-flash-is/m-p/2002382" target="_self"&gt;Hard Fault in C40_Ip_MainInterfaceHVJobStatus api when flash is erase in s32k312&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Robin&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2026 03:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421218#M61471</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2026-10-15T03:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: S32K3 UTEST program generates hardfault</title>
      <link>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421490#M61485</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/57959"&gt;@Robin_Shen&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thanks for reverting back - It was indeed a RWW error as you had suggested.&lt;BR /&gt;I assumed the UTEST section was a different block and hence flash erase/program functions could run from flash but apparently not. Moving the functions to RAM solved my issues.&lt;BR /&gt;&lt;BR /&gt;With regards,&lt;BR /&gt;Hareesh S&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2026 18:13:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K3-UTEST-program-generates-hardfault/m-p/2421490#M61485</guid>
      <dc:creator>Hareesh_S</dc:creator>
      <dc:date>2026-10-15T18:13:03Z</dc:date>
    </item>
  </channel>
</rss>

