<?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: MCXN5 CMPA Write Fails in MCX Microcontrollers</title>
    <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1948951#M1617</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your patience.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have escalate this issue to our internal team. And I have pushed again. I will send to you with any information. Sorry for the inconvenient to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2024 09:35:11 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2024-09-06T09:35:11Z</dc:date>
    <item>
      <title>MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1939668#M1552</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to update CMPA flash region by the firmware.&lt;/P&gt;&lt;P&gt;My code looks like this (very similar to the one in the reference manual):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;flash_config_t flashConfig;
uint8_t      cmpa[512] = {0};

if (FLASH_Init(&amp;amp;flashConfig) != kStatus_FLASH_Success)
{
    return kStatus_FLASH_Error;
}

if (FFR_Init(&amp;amp;flashConfig) != kStatus_FLASH_Success)
{
    return kStatus_FLASH_Error;
}

if (FFR_GetCustomerData(&amp;amp;flashConfig, cmpa, 0u, 512u) != kStatus_FLASH_Success)
{
    return kStatus_FLASH_Error;
}

if (FFR_CustFactoryPageWrite(&amp;amp;flashConfig, cmpa, false) != kStatus_FLASH_Success)
{
    return kStatus_FLASH_Error;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last call (FFR_CustFactoryPageWrite) ends with HardFault.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an SDK example code that demonstrate CMPA write?&lt;/P&gt;&lt;P&gt;What might be causing the behavior?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2024 10:36:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1939668#M1552</guid>
      <dc:creator>mosesrs</dc:creator>
      <dc:date>2024-08-25T10:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1941226#M1558</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please send your whole project to me, I help you check it on my side. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 10:37:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1941226#M1558</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-08-27T10:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1942400#M1570</link>
      <description>&lt;P&gt;the project is flashiap from the SDK (latest version). here is the main source file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/*
 * Copyright 2021 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "fsl_debug_console.h"
#include "fsl_flash.h"
#include "fsl_flash_ffr.h"
#include "fsl_common.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#if defined(LPCAC_INVALIDATE) &amp;amp;&amp;amp; LPCAC_INVALIDATE
#include "fsl_cache_lpcac.h"
#endif

#include "fsl_clock.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define SECTOR_INDEX_FROM_END 2U /* start from the last 2 page*/
#define BUFFER_LEN 512 / 4

/*******************************************************************************
 * Prototypes
 ******************************************************************************/
static void error_trap();
void app_finalize(void);

/*******************************************************************************
 * Variables
 ******************************************************************************/

/*! @brief Flash driver Structure */
static flash_config_t s_flashDriver;
/*! @brief Buffer for program */
static uint32_t s_buffer[BUFFER_LEN];
/*! @brief Buffer for readback */
static uint32_t s_buffer_rbc[BUFFER_LEN];

volatile uint32_t g_systickCounter;

/*******************************************************************************
 * Code
 ******************************************************************************/
void SysTick_Handler(void)
{
    if (g_systickCounter != 0U)
    {
        g_systickCounter--;
    }
}

void SysTick_DelayTicks(uint32_t n)
{
    g_systickCounter = n;
    while (g_systickCounter != 0U)
    {
    }
}

/*
 * @brief Gets called when an error occurs.
 *
 * @details Print error message and trap forever.
 */
void error_trap(void)
{
    PRINTF("\r\n\r\n\r\n\t---- HALTED DUE TO FLASH ERROR! ----");
    while (1)
    {
    }
}

/*
 * @brief Gets called when the app is complete.
 *
 * @details Print finshed message and trap forever.
 */
void app_finalize(void)
{
    /* Print finished message. */
    PRINTF("\r\n End of PFlash Example! \r\n");
    while (1)
    {
    }
}

int main()
{
    status_t status;
    uint32_t destAdrss; /* Address of the target location */
    uint32_t i, failedAddress, failedData;
    uint32_t pflashBlockBase  = 0U;
    uint32_t pflashTotalSize  = 0U;
    uint32_t pflashSectorSize = 0U;
    uint32_t PflashPageSize   = 0U;

    /* Init board hardware. */
    /* attach FRO 12M to FLEXCOMM4 (debug console) */
    CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 1u);
    CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);

    BOARD_InitPins();
    BOARD_InitBootClocks();
    BOARD_InitDebugConsole();

    /* Clean up Flash, Cache driver Structure*/
    memset(&amp;amp;s_flashDriver, 0, sizeof(flash_config_t));

    /* Print basic information for Flash Driver API.*/
    PRINTF("\r\n Flash driver API tree demo application. \r\n");
    /* Initialize flash driver */
    PRINTF("\r\n Initializing flash driver.");
    if (FLASH_Init(&amp;amp;s_flashDriver) != kStatus_Success)
    {
        error_trap();
    }
    PRINTF("\r\n Flash init successfull! \r\n");

    PRINTF("\r\n Initializing FFR driver.");
    if (FFR_Init(&amp;amp;s_flashDriver) != kStatus_Success)
    {
        error_trap();
    }
    PRINTF("\r\n FFR init successfull! \r\n");

    /* Adjust the clock cycle for accessing the flash memory according to the system clock. */
    PRINTF("\r\n Config flash memory access time. \r\n");

    /* Set systick reload value to generate 1ms interrupt */
    if (SysTick_Config(SystemCoreClock / 1000U))
    {
        error_trap();
    }

    /* Get flash properties kFLASH_ApiEraseKey */
    FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflashBlockBaseAddr, &amp;amp;pflashBlockBase);
    FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflashSectorSize, &amp;amp;pflashSectorSize);
    FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflashTotalSize, &amp;amp;pflashTotalSize);
    FLASH_GetProperty(&amp;amp;s_flashDriver, kFLASH_PropertyPflashPageSize, &amp;amp;PflashPageSize);

    /* print welcome message */
    PRINTF("\r\n PFlash Information:");
    /* Print flash information - PFlash. */
    PRINTF("\r\n kFLASH_PropertyPflashBlockBaseAddr = 0x%X", pflashBlockBase);
    PRINTF("\r\n kFLASH_PropertyPflashSectorSize = %d", pflashSectorSize);
    PRINTF("\r\n kFLASH_PropertyPflashTotalSize = %d", pflashTotalSize);
    PRINTF("\r\n kFLASH_PropertyPflashPageSize = 0x%X", PflashPageSize);

    uint8_t      cmpa[512u] = {0};

    if (FFR_GetCustomerData(&amp;amp;s_flashDriver, cmpa, 0u, 512u) != (status_t)kStatus_FLASH_Success)
    {
        return 0u;
    }

    if (FFR_CustFactoryPageWrite(&amp;amp;s_flashDriver, cmpa, false) != (status_t)kStatus_FLASH_Success)
    {
        return 0u;
    }

    PRINTF("\r\n DONE = 0x%X", PflashPageSize);


    return 0;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Aug 2024 15:18:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1942400#M1570</guid>
      <dc:creator>mosesrs</dc:creator>
      <dc:date>2024-08-28T15:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1945382#M1593</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your patience.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have reproduced your issue on my side. And I am checking with internal. I will send to you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;after I get any update. Sorry for the inconvenient to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 09:50:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1945382#M1593</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-09-02T09:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1945893#M1598</link>
      <description>Thank you. Waiting for your update.</description>
      <pubDate>Tue, 03 Sep 2024 05:13:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1945893#M1598</guid>
      <dc:creator>mosesrs</dc:creator>
      <dc:date>2024-09-03T05:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1948432#M1612</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;&amp;nbsp;, any update?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 17:00:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1948432#M1612</guid>
      <dc:creator>mosesrs</dc:creator>
      <dc:date>2024-09-05T17:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1948951#M1617</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your patience.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have escalate this issue to our internal team. And I have pushed again. I will send to you with any information. Sorry for the inconvenient to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 09:35:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1948951#M1617</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-09-06T09:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1950018#M1626</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry let me correct my answer.&lt;/P&gt;
&lt;P&gt;It will go to hard fault if write all FF to CMPA. Please write a valid CMPA. Or at least the last 16 bytes can't be all F.&amp;nbsp;Build and debug. It can work well. We haven't find the root cause, this is just a workaround. I will send to you after get any update.&lt;/P&gt;
&lt;P&gt;In fact, in our real development, we're not going to write all 0xff to CMPA. Just refer the definition of CMPA to config. You can find detail of CMPA in attachment of User Manual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 10:23:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1950018#M1626</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-09-10T10:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1951053#M1630</link>
      <description>&lt;P&gt;indeed, it is working. However, it seems like if seal_part=false, CRC and CMAC aren't calculated and the new data written to CMPA does not affect anything.&lt;/P&gt;&lt;P&gt;Can you try with seal_part=true ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 11:01:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1951053#M1630</guid>
      <dc:creator>mosesrs</dc:creator>
      <dc:date>2024-09-10T11:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1951702#M1632</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not recommended to set&amp;nbsp;&lt;SPAN&gt;seal_part=true before your product is in mass production.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;About write CMCA, I have escalate this issue to our internal SE team. And I will send to you with any update. For now, recommend using ISP to program CMPA. It will calculate the CMPA automatically when write CMPA.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV id="tinyMceEditorAlice_Yang_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="tinyMceEditorAlice_Yang_1" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-09-11_13-44-39.jpg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/298447i60839254D1BB3E1E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2024-09-11_13-44-39.jpg" alt="2024-09-11_13-44-39.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice &lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 05:46:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1951702#M1632</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-09-11T05:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: MCXN5 CMPA Write Fails</title>
      <link>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1956140#M1654</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/236767"&gt;@mosesrs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your patience.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry CMAC calculation is not supported by the ROM API when programing CMPA, so&lt;SPAN&gt;&amp;nbsp;the seal_part should be set as false and set the CMPA CMAC value of the as 0x00, then the CMPA value can be programmed without the CMAC. After all the CMPA value is verified and user can use the ISP write command the CMPA, that will calculate the CMPA CMAC, which will be checked when the lifecycle advance to secure_world(0x7) above.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 02:54:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCX-Microcontrollers/MCXN5-CMPA-Write-Fails/m-p/1956140#M1654</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-09-18T02:54:40Z</dc:date>
    </item>
  </channel>
</rss>

