<?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>S12 / MagniV MicrocontrollersのトピックRe: Debug Port Lock &amp;amp; Unlock</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Debug-Port-Lock-amp-Unlock/m-p/2167725#M20741</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;More about security…&lt;BR clear="none" /&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12-X-MCU-Security/ta-p/1111118" target="_blank" rel="noopener" shape="rect"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12-X-MCU-Security/ta-p/1111118&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;Of course the communication with the debugger is lost after the security is enabled.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;As soon as the security is enabled the MCU is not able to communicate via BDM anymore.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;The S12G temporary unsecure is attached. I see that you program backdoor kay but it requires write ,not program it. Backdoor key is programmed during program download.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;See routine in the SCI.c file of attached G128-FLASH_EEPROM examples\G128-SECURITY-SCI_Unsecure-CW51.zip…&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;#pragma CODE_SEG UNSECURE_CODE_RAM&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;void near unsecure(void)&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;{&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;//FCNFG_KEYACC = 1;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF00 = incomming_security_array_code[0];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF02 = incomming_security_array_code[1];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF04 = incomming_security_array_code[2];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF06 = incomming_security_array_code[3];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;//FCNFG_KEYACC = 0;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;}&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;#pragma CODE_SEG DEFAULT&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;It is placed inside RAM to avoid read flash while it is under processing. If you do not believe the code will remain always in RAM, you can create a PICK code in the flash and copy it into RAM before you execute it out of the RAM.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;For permanent unsecure you have to either erase and rewrite flash security bytes and restart the MCU or use externa &lt;A href="http://www.pemicro.com" target="_blank" rel="noopener" shape="rect"&gt;www.pemicro.com&lt;/A&gt; unsecure_12 program or CodeWarrior unsecure routine (sometimes working strange better to use pemicro).&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;If the CAN communication is not working, then there can be another issue. If you have MCU secured after reset and it runs then the MCU is started by reset in the normal mode. In normal mode, there are some registers write once only or some of them are writeable. In opposite, in debug mode they can be written anytime. It must be ensured this mistake is considered.&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;Also writing to the flash while processing it or reading it while processing it can cause exception which is not served and then CAN is not working correctly. I think that what you see is symptom of different error.&lt;/P&gt;
&lt;P&gt;&lt;BR clear="none" /&gt;Best regards, &lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;</description>
    <pubDate>Thu, 11 Sep 2025 09:32:47 GMT</pubDate>
    <dc:creator>lama</dc:creator>
    <dc:date>2025-09-11T09:32:47Z</dc:date>
    <item>
      <title>Debug Port Lock &amp; Unlock</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Debug-Port-Lock-amp-Unlock/m-p/2165931#M20740</link>
      <description>&lt;P&gt;Hello Support,&lt;/P&gt;&lt;P&gt;We are trying to Lock &amp;amp; Unlock the Debug Port Interface on &lt;SPAN&gt;MC9S12G128 controller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Configurations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;0xFF0F : FSEC update to 0xBC &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;KEYEN[1:0] = 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SEC[1:0] = 00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Background Verification Key Update : 0x0652, 0x5C7B, 0x7E75, 0x6440 provided.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Debug Port locked&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but Unable to set CAN communication to Unlock the ECU.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you please support me as soon as possible.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dump:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In Dump at address location 0xFF0F instead of 0xBD getting written, even though Hardcore value provided in "BackdoorKey" array variable.&lt;/P&gt;&lt;P&gt;check attachement dump&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define CCIF 0x80U /* CCIF bit of FSTAT register */&lt;BR /&gt;#define ACCERR 0x20U /* EEPROM Access Error */&lt;/P&gt;&lt;P&gt;eUDSreactor_Response UDSreactor_secure_Flash(void)&lt;BR /&gt;{&lt;BR /&gt;tUI8 I_Bit;&lt;BR /&gt;eUDSreactor_Response retVal = E_UDSREACTOR_SUCCESS;&lt;BR /&gt;static tUI8 flsoffset=0;&lt;/P&gt;&lt;P&gt;tUI8 BackdoorKey[16u]={0x06, 0x52u, 0x5C, 0x7Bu, 0x7E, 0x75u, 0x64, 0x40u, 0xFF, 0xFFu, 0xFF, 0xFFu, 0xFF, 0xFFu, 0xFFu, 0xBDu};/* local array storing to the keywords */&lt;/P&gt;&lt;P&gt;/* inhibit all interrupts */&lt;BR /&gt;I_Bit = sei();&lt;BR /&gt;retVal = Flash_UnsecureFlash(&amp;amp;BackdoorKey[0u]);&lt;BR /&gt;/* allow the interrupts if they have been enabled before */&lt;BR /&gt;cli(I_Bit);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note:-&lt;/P&gt;&lt;P&gt;In case if you need any clarification we can directly set meeting to resolve it the issue.&lt;BR /&gt;return retVal;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#define PVIOL_MASK 0x10&lt;BR /&gt;#define ACCERR_MASK 0x10&lt;/P&gt;&lt;P&gt;/* Macro to clear bits PVIOL and ACCERR. */&lt;BR /&gt;#define FLASH_CLEAR_PV_ACC FSTAT = (FSTAT | (PVIOL_MASK + ACCERR_MASK))&lt;/P&gt;&lt;P&gt;static tUI8 Flash_UnsecureFlash(const tUI8 *pBackdoorKey)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;tUI8 j=0, Error=0, Return_Value = E_UDSREACTOR_SUCCESS;&lt;BR /&gt;tUI16 FlashAddress = 0xFF00;&lt;/P&gt;&lt;P&gt;while((j&amp;lt;2) &amp;amp;&amp;amp; (Error == 0))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;/* If FPVIOL/ACCERR set, clear flags */&lt;BR /&gt;if( FSTAT &amp;amp; ( PVIOL_MASK + ACCERR_MASK ) )&lt;BR /&gt;{&lt;BR /&gt;FLASH_CLEAR_PV_ACC;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;FCCOBIX = CCOBIX_CMD;&lt;BR /&gt;FCCOBHI = 0x06; /* P- Flash sector*/&lt;BR /&gt;FCCOBLO = 0x3;&lt;BR /&gt;FCCOBIX = CCOBIX_ADDR_16;&lt;BR /&gt;FCCOBHI = (tUI8)((FlashAddress &amp;amp; 0XFFFF) &amp;gt;&amp;gt; 8);&lt;BR /&gt;FCCOBLO = (tUI8)((FlashAddress &amp;amp; 0XFFFF) &amp;amp; 0xFF);&lt;/P&gt;&lt;P&gt;/* write data to be programmed to Flash Block */&lt;BR /&gt;FCCOBIX = CCOBIX_DATA_WORD_0;&lt;BR /&gt;FCCOBHI = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;FCCOBLO = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;/P&gt;&lt;P&gt;FCCOBIX = CCOBIX_DATA_WORD_1;&lt;BR /&gt;FCCOBHI = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;FCCOBLO = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;&lt;BR /&gt;FCCOBIX = CCOBIX_DATA_WORD_2;&lt;BR /&gt;FCCOBHI = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;FCCOBLO = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;/P&gt;&lt;P&gt;FCCOBIX = CCOBIX_DATA_WORD_3;&lt;BR /&gt;FCCOBHI = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;FCCOBLO = *(pBackdoorKey);&lt;BR /&gt;pBackdoorKey++;&lt;BR /&gt;&lt;BR /&gt;/* Execute the program command */&lt;BR /&gt;Error = Flash_ExecuteFlashCommand();&lt;/P&gt;&lt;P&gt;/* set FlashAddress for next 8Byte Block */&lt;BR /&gt;FlashAddress = FlashAddress + 0x08;&lt;/P&gt;&lt;P&gt;j++;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;&lt;BR /&gt;if( FSTAT &amp;amp; ( PVIOL_MASK + ACCERR_MASK ) )&lt;BR /&gt;{&lt;BR /&gt;/* indicating error during the Flash operation and stop the cycle */&lt;BR /&gt;Return_Value = E_UDSREACTOR_CONDITIONS_NOT_CORRECT;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;Return_Value = E_UDSREACTOR_SUCCESS;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return Return_Value;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 13:27:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Debug-Port-Lock-amp-Unlock/m-p/2165931#M20740</guid>
      <dc:creator>angad</dc:creator>
      <dc:date>2025-09-09T13:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Debug Port Lock &amp; Unlock</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Debug-Port-Lock-amp-Unlock/m-p/2167725#M20741</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;More about security…&lt;BR clear="none" /&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12-X-MCU-Security/ta-p/1111118" target="_blank" rel="noopener" shape="rect"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12-X-MCU-Security/ta-p/1111118&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;Of course the communication with the debugger is lost after the security is enabled.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;As soon as the security is enabled the MCU is not able to communicate via BDM anymore.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;The S12G temporary unsecure is attached. I see that you program backdoor kay but it requires write ,not program it. Backdoor key is programmed during program download.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;See routine in the SCI.c file of attached G128-FLASH_EEPROM examples\G128-SECURITY-SCI_Unsecure-CW51.zip…&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;#pragma CODE_SEG UNSECURE_CODE_RAM&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;void near unsecure(void)&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;{&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;//FCNFG_KEYACC = 1;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF00 = incomming_security_array_code[0];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF02 = incomming_security_array_code[1];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF04 = incomming_security_array_code[2];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;*(unsigned int *)0xFF06 = incomming_security_array_code[3];&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;//FCNFG_KEYACC = 0;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;}&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;#pragma CODE_SEG DEFAULT&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;It is placed inside RAM to avoid read flash while it is under processing. If you do not believe the code will remain always in RAM, you can create a PICK code in the flash and copy it into RAM before you execute it out of the RAM.&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;For permanent unsecure you have to either erase and rewrite flash security bytes and restart the MCU or use externa &lt;A href="http://www.pemicro.com" target="_blank" rel="noopener" shape="rect"&gt;www.pemicro.com&lt;/A&gt; unsecure_12 program or CodeWarrior unsecure routine (sometimes working strange better to use pemicro).&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;If the CAN communication is not working, then there can be another issue. If you have MCU secured after reset and it runs then the MCU is started by reset in the normal mode. In normal mode, there are some registers write once only or some of them are writeable. In opposite, in debug mode they can be written anytime. It must be ensured this mistake is considered.&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm; line-height: 115%; font-size: 12pt; font-family: Aptos, sans-serif;"&gt;Also writing to the flash while processing it or reading it while processing it can cause exception which is not served and then CAN is not working correctly. I think that what you see is symptom of different error.&lt;/P&gt;
&lt;P&gt;&lt;BR clear="none" /&gt;Best regards, &lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 09:32:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Debug-Port-Lock-amp-Unlock/m-p/2167725#M20741</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2025-09-11T09:32:47Z</dc:date>
    </item>
  </channel>
</rss>

