<?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: S32K344 EHV in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777890#M29816</link>
    <description>&lt;P&gt;&lt;SPAN class=""&gt;Thank you for your reply!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Your code is from C40_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Ip_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Example_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is it in S32K344?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I referred to one of the methods, but the result was not satisfactory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Let me share my thoughts:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I am trying CAN BOOT. The upper computer sends two frames of data, and the lower computer calls its own function FLASH every time it receives it_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;HAL_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;WriteData() for Flash writing.&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;This function mainly unlocks and then writes Flash based on the amount of data written.&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The main writing code is as follows (see the &lt;EM&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;/EM&gt;branch at the end for details).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; boolean FLASH_HAL_WriteData(const uint32 i_startAddr,
								   const uint8 *i_pDataBuf, 
								   const uint32 i_dataLen)
{
    boolean retstates = FALSE;
	uint8 lessWriteLen = 8u;
	uint8 aDataBuf[8u] = {0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu};
	uint32 writeDataLen = 0u;
	uint8 index = 0u;
	uint32 sectorLength = 0u;
	C40_Ip_StatusType C40Status;
	C40_Ip_VirtualSectorsType VirtualSector;
	C40_Ip_VirtualSectorsType endVirtualSector;
	
	sectorLength = 8192U;
	VirtualSector = (i_startAddr - 0x400000u)/sectorLength + FLS_MAX_DATA_SECTOR;
	endVirtualSector = ((i_startAddr + i_dataLen) - 0x400000u) / sectorLength + FLS_MAX_DATA_SECTOR;

	while(VirtualSector &amp;lt;= endVirtualSector) 
	{
		if(STATUS_C40_IP_SECTOR_PROTECTED == C40_Ip_GetLock(VirtualSector))
		{
			C40_Ip_ClearLock(VirtualSector, 0);
		}

		VirtualSector++;
	}

	DisableAllInterrupts(); 
	if(i_dataLen  &amp;amp; (lessWriteLen - 1)) 
	{
		......
	}
	else 
	{
		retstates = TRUE;
		C40Status=C40_Ip_MainInterfaceWrite(i_startAddr,i_dataLen,i_pDataBuf, 0);
		do
		{
			C40Status = C40_Ip_MainInterfaceWriteStatus();
		}
		while (STATUS_C40_IP_BUSY == C40Status);

		if(STATUS_C40_IP_SUCCESS != C40Status)
	    {
	    	retstates = FALSE;
	    }

	}
	EnableAllInterrupts();
	
	return retstates;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But during debugging, it was found that FLASH_ HAL_ WriteData() returns a successful operation, but all the data written to the Flash area is 0xFF, which is not what I expected. In theory, this is considered a write failure, but the return value is STATUS_ C40_ IP_ SUCCESS has no problem.&lt;BR /&gt;I was wondering if my understanding was incorrect and there was a problem with the method of calling the function? Or is it caused by frequent unlocking of Flash. I hope you can give me some guidance, thank you very much!!!&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2023 10:10:10 GMT</pubDate>
    <dc:creator>CHYYDS</dc:creator>
    <dc:date>2023-12-20T10:10:10Z</dc:date>
    <item>
      <title>S32K344 EHV</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777053#M29768</link>
      <description>&lt;P&gt;Hello everyone!!!&lt;BR /&gt;I encountered the following problem while using the C40 Flsah erase function of the RTD in S32K344:&lt;/P&gt;&lt;P&gt;The first time I called the function area to write data, the code is as follows:↓&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C40Status=C40_Ip_MainInterfaceWrite(i_startAddr,i_dataLen,i_pDataBuf, 0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;On the second call, C40Status returns STATUS_ C40_ IP_ Error.&lt;BR /&gt;I entered the function and found that an error occurred here:↓&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;C40_Ip_MainInterfaceWritePreCheck() &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;......&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; /* Verify that EHV may be set */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; else if (0UL != (C40_Ip_pFlashBaseAddress-&amp;gt;MCR &amp;amp; (FLASH_MCR_ERS_MASK |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FLASH_MCR_PGM_MASK)))&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ReturnCode = STATUS_C40_IP_ERROR;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;......&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;May I ask what the problem is? What is EHV? I'm a bit confused. Could you please explain, thank you very much!!!&lt;BR /&gt;May I ask how can I solve this situation? Thank you!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 09:20:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777053#M29768</guid>
      <dc:creator>CHYYDS</dc:creator>
      <dc:date>2023-12-19T09:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 EHV</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777854#M29814</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224244"&gt;@CHYYDS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that's expected behavior. This is asynchronous driver. Function C40_Ip_MainInterfaceWrite will only initiate the write operation and then it exits. You are supposed to call C40_Ip_MainInterfaceWriteStatus after that. You can take a look at this example:&lt;/P&gt;
&lt;P&gt;c:\NXP\S32DS.3.5\S32DS\software\PlatformSDK_S32K3\RTD\Fls_TS_T40D34M30I0R0\examples\S32DS\S32K3XX\C40_Ip_Example_S32K344\&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Write data */&lt;BR /&gt;C40_Ip_MainInterfaceWrite(FLS_SECTOR_ADDR, FLS_BUF_SIZE, TxBuffer, FLS_MASTER_ID);&lt;BR /&gt;do&lt;BR /&gt;{&lt;BR /&gt;C40Status = C40_Ip_MainInterfaceWriteStatus();&lt;BR /&gt;}&lt;BR /&gt;while (STATUS_C40_IP_BUSY == C40Status);&lt;BR /&gt;/* Check job result */&lt;BR /&gt;Fls_ExampleAssert(STATUS_C40_IP_SUCCESS == C40Status);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 09:37:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777854#M29814</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2023-12-20T09:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 EHV</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777890#M29816</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;Thank you for your reply!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Your code is from C40_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Ip_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Example_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is it in S32K344?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I referred to one of the methods, but the result was not satisfactory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Let me share my thoughts:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I am trying CAN BOOT. The upper computer sends two frames of data, and the lower computer calls its own function FLASH every time it receives it_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;HAL_&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;WriteData() for Flash writing.&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;This function mainly unlocks and then writes Flash based on the amount of data written.&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The main writing code is as follows (see the &lt;EM&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;/EM&gt;branch at the end for details).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt; boolean FLASH_HAL_WriteData(const uint32 i_startAddr,
								   const uint8 *i_pDataBuf, 
								   const uint32 i_dataLen)
{
    boolean retstates = FALSE;
	uint8 lessWriteLen = 8u;
	uint8 aDataBuf[8u] = {0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFFu};
	uint32 writeDataLen = 0u;
	uint8 index = 0u;
	uint32 sectorLength = 0u;
	C40_Ip_StatusType C40Status;
	C40_Ip_VirtualSectorsType VirtualSector;
	C40_Ip_VirtualSectorsType endVirtualSector;
	
	sectorLength = 8192U;
	VirtualSector = (i_startAddr - 0x400000u)/sectorLength + FLS_MAX_DATA_SECTOR;
	endVirtualSector = ((i_startAddr + i_dataLen) - 0x400000u) / sectorLength + FLS_MAX_DATA_SECTOR;

	while(VirtualSector &amp;lt;= endVirtualSector) 
	{
		if(STATUS_C40_IP_SECTOR_PROTECTED == C40_Ip_GetLock(VirtualSector))
		{
			C40_Ip_ClearLock(VirtualSector, 0);
		}

		VirtualSector++;
	}

	DisableAllInterrupts(); 
	if(i_dataLen  &amp;amp; (lessWriteLen - 1)) 
	{
		......
	}
	else 
	{
		retstates = TRUE;
		C40Status=C40_Ip_MainInterfaceWrite(i_startAddr,i_dataLen,i_pDataBuf, 0);
		do
		{
			C40Status = C40_Ip_MainInterfaceWriteStatus();
		}
		while (STATUS_C40_IP_BUSY == C40Status);

		if(STATUS_C40_IP_SUCCESS != C40Status)
	    {
	    	retstates = FALSE;
	    }

	}
	EnableAllInterrupts();
	
	return retstates;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But during debugging, it was found that FLASH_ HAL_ WriteData() returns a successful operation, but all the data written to the Flash area is 0xFF, which is not what I expected. In theory, this is considered a write failure, but the return value is STATUS_ C40_ IP_ SUCCESS has no problem.&lt;BR /&gt;I was wondering if my understanding was incorrect and there was a problem with the method of calling the function? Or is it caused by frequent unlocking of Flash. I hope you can give me some guidance, thank you very much!!!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:10:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777890#M29816</guid>
      <dc:creator>CHYYDS</dc:creator>
      <dc:date>2023-12-20T10:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 EHV</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777891#M29817</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37795"&gt;@lukaszadrapa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:12:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-EHV/m-p/1777891#M29817</guid>
      <dc:creator>CHYYDS</dc:creator>
      <dc:date>2023-12-20T10:12:29Z</dc:date>
    </item>
  </channel>
</rss>

