Intermittent Bootloader → Application Jump Failure on S32K3 (Not Reproducible on All Boards)

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

Intermittent Bootloader → Application Jump Failure on S32K3 (Not Reproducible on All Boards)

121 Views
yusupkhan241
Contributor III

Hi NXP Team,

I’m continuing from the earlier discussion on C40 flash erase/program limitations C40 Flash Erase/Write from Bootloader in S32K311 (Same Flash Block Execution)  in S32K3 devices:

With your support, we resolved the flash erase/program issue by:

  • Ensuring no execution from the target flash block during operations

 

Current Issue

We are now observing an intermittent issue during bootloader → application jump.

  • The same jump implementation works reliably in most cases:
    • Tested on ~20 boards
    • Application reflashed >100 times
    • ECU reset >1000 times
    • No issue observed in these scenarios
  • However, in 2 boards, we occasionally see:
    • Control does not jump to application
    • Device remains stuck in bootloader
  • Recovery method:
    • Reflashing a combined HEX (bootloader + application) using debugger resolves the issue
  • Concern:
    • In production (vehicle-installed ECU), reflashing via debugger is not practical

 

Jump Implementation Used

C

void JumpToApplication(void)

{

    uint32 appStack = *(uint32 *)(APP_STARTADDR);

    uint32 func = *(uint32 volatile *)(APP_STARTADDR + 0xC);

    func = *(uint32 volatile *)(((uint32)func) + 0x4);

    DisableAllInterrupts();

    S32_SCB->VTOR = APP_STARTADDR;

    __asm volatile ("msr msp, %0" :: "r"(appStack));

    __asm volatile ("msr psp, %0" :: "r"(appStack));

 

    func = ((((uint32)func) & 0xFFFFFFFEU) | 1U);

 

    (*(void (*)(void))func)();

    while (1);

}

static void DisableAllInterrupts(void)

{

    for (int i = DMATCD0_IRQn; i <= SoC_IRQn; i++)

    {

        IntCtrl_Ip_DisableIrq((IRQn_Type)i);

        IntCtrl_Ip_ClearPending((IRQn_Type)i);

    }

    S32_SysTick->CSRr = 0U;

}

Observations

  • Issue is not consistently reproducible
  • Appears intermittent & happens randomly.
  • Full image reflash (combined HEX) restores normal behaviour

 

Request for Guidance

Could you please help with:

  1. What additional checks should be added before jumping to application?
  2. Are there any known corner cases (MPU, cache, VTOR, barriers, etc.) that could cause this intermittent behaviour?
  3. Could this be related to:
    • Cache state (I/D cache not cleaned/disabled)?
    • Incomplete flash programming or alignment issue?
    • Vector table or reset handler inconsistency?
  4. Any recommended production-grade sequence before jump (barriers, cache handling, etc.)?

If any additional details are needed, please let me know and thanks in advance for your support.

Best regards,
Yusup Khan

S32DS-ARM S32K3 S32K31XEVB-Q100  @danielmartynek C40 Flash Erase/Write from Bootloader in S32K311 (Same Flash Block Execution) 

0 Kudos
Reply
3 Replies

89 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Yusup,

What does it mean that the device remains stuck in the bootloader?
Can you attach a debugger and check where it is stuck?
Is it a fault exception or a software loop?


Is reflashing really necessary, or would a POR be sufficient?


Regarding MPU and cache, it is good practice to clean and disable the cache. The application reconfigures the MPU for its use case, so the cache should be cleaned and disabled anyway.


You can add memory barriers or refer to the S32K3xx Reference Manual, Section 3.8 “Serialization of Memory Operations” and use the read-after-write sequence.

Also, check the DCM_GPR registers for faults. (RM, Table 231. DCM controlled features and availability in product family.)

Make sure that the clock configuration matched one of the clock options listed in the RM, e.g. Table 157. Option A - High Performance mode (CORE_CLK @ 160 MHz).

Anyway. the key point is to identify the loop where the bootloader is stuck. If there is a fault exception, you need to gather more information about the fault.

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-HARDFAULT-Handling-Interrupt-DS3-5-...

https://community.nxp.com/t5/S32K-Knowledge-Base/How-To-Debug-A-Fault-Exception-On-ARM-Cortex-M-V7M-...

https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447

 

Regards,

Daniel

0 Kudos
Reply

49 Views
yusupkhan241
Contributor III

Hi  @danielmartynek 

Thanks for your response.

To clarify, we are observing two intermittent behaviours:

1) Bootloader active but jump fails:

- Bootloader receives update command and successfully programs the application.

- Application CRC check passes.

- However, after issuing jump, control does not transfer to the application.

 

2) Bootloader becomes unresponsive:

- No UART response and no LED indication.

- POR/software reset does not recover.

- Only reflashing via debugger restores the system.

 

So far, POR alone does NOT resolve the issue.

For the jump sequence, we are currently using the following approach:

 

- Validate application before jump:

  •             IVT marker check
  •             Stack pointer (not 0x0 / 0xFFFFFFFF)
  •             Reset handler validity

- Jump sequence includes:

  •             Disable interrupts (clearing individually)
  •             Disable SysTick
  •             Cache clean + invalidate
  •             VTOR update
  •             MSP/PSP update
  •             DSB/ISB barriers
  •             Jump to reset handler

/* -------------------------------------------------------------------------- */
/* Flash memory layout */
/* -------------------------------------------------------------------------- */
/** @brief Base address of internal flash memory. */
#define FLASH_BASE_ADDR (0x00400000U)
/** @brief Total flash memory size (1 MB). */
#define FLASH_TOTAL_SIZE (0x00100000U)
/** @brief End address of internal flash memory. */
#define FLASH_END_ADDR (FLASH_BASE_ADDR + FLASH_TOTAL_SIZE)
/** @brief Start address of the application image region. */
#define APP_STARTADDR (0x00422000U)
/** @brief Maximum supported application image size in bytes. */
#define APPLICATION_IMAGE_SIZE (FLASH_END_ADDR - APP_STARTADDR)
/** @brief Maximum payload buffer allocated per transfer step. */
#define FLASH_CHUNK_SIZE (512U)
/** @brief Chunk size used during post-reset CRC verification. */
#define CRC_CHUNK_SIZE (4096U)

/** @brief Expected IVT marker value at the application image base. */
#define IVT_MARKER_MAGIC (0x5AA55AA5U)
/** @brief Kept for layout compatibility with existing application image builds. */
#define IVT_ENTRY_ADDR (APP_STARTADDR + 0x2000U)

/* -------------------------------------------------------------------------- */
/* Application Jump Configuration */
/* -------------------------------------------------------------------------- */
/** @brief Offset to core entry address from application start. */
#define FLASH_APP_CORE_ENTRY_OFFSET (0x0CU)
/** @brief Offset to reset handler from core entry address. */
#define FLASH_APP_RESET_HANDLER_OFFSET (0x04U)
/** @brief Expected IVT marker magic value for valid application image. */
#define FLASH_IVT_MARKER_MAGIC (0x5AA55AA5U)

/** @brief Default erased 32-bit flash value. */
#define FLASH_ERASED_U32_VALUE (0xFFFFFFFFU)
/** @brief Default zero 32-bit value. */
#define FLASH_ZERO_U32_VALUE (0x00000000U)

/**
* @brief Validate an address read from application flash.
*
* @details
* This function checks whether a given address value is valid and usable.
* It filters out common invalid values such as:
* - 0x00000000 (unprogrammed / null)
* - 0xFFFFFFFF (erased flash)
*
* This function is used for validating stack pointer and reset handler.
*
* @param addressValue Address read from flash (stack pointer or reset handler).
*
* @return TRUE if the value is valid, otherwise FALSE.
*/
static boolean Flash_IsAddressValid(uint32 addressValue)
{
return ((addressValue != FLASH_ZERO_U32_VALUE) &&
(addressValue != FLASH_ERASED_U32_VALUE)) ? TRUE : FALSE;
}


static AppJumpError_t Flash_PrecheckApplication(void)
{
uint32 appStack;
uint32 coreEntry;
uint32 resetHandler;

/* IVT marker validation */
if ((*(volatile const uint32 *)APP_STARTADDR) != FLASH_IVT_MARKER_MAGIC)
{
return APP_JUMP_ERR_CORRUPT;
}

/* Stack pointer validation */
appStack = *(volatile const uint32 *)APP_STARTADDR;

if (Flash_IsAddressValid(appStack) == FALSE)
{
return APP_JUMP_ERR_STACKPTR;
}

/* Reset handler validation */
coreEntry = *(volatile const uint32 *)(APP_STARTADDR + FLASH_APP_CORE_ENTRY_OFFSET);
resetHandler = *(volatile const uint32 *)(coreEntry + FLASH_APP_RESET_HANDLER_OFFSET);

if (Flash_IsAddressValid(resetHandler) == FALSE)
{
return APP_JUMP_ERR_RESETHANDLER;
}

return APP_JUMP_OK;
}


/**
* @brief Transfer execution from bootloader to application.
*
* @details
* This function performs the final steps required to transfer control
* from the bootloader to the application firmware:
*
* - Disables all interrupts
* - Stops system tick
* - Clears and invalidates caches
* - Sets the Main Stack Pointer (MSP)
* - Updates vector table
* - Jumps to application reset handler
*
* IMPORTANT:
* - All validation must be completed before calling this function.
* - This function does not return.
*/
void JumpToApplication(void)
{
uint32 appStack;
uint32 coreEntry;
uint32 resetHandler;

/* ------------------------------------------------------------------ */
/* Read application vector table */
/* ------------------------------------------------------------------ */
appStack = *(volatile const uint32 *)(APP_STARTADDR);
coreEntry = *(volatile const uint32 *)(APP_STARTADDR + FLASH_APP_CORE_ENTRY_OFFSET);
resetHandler = *(volatile const uint32 *)(coreEntry + FLASH_APP_RESET_HANDLER_OFFSET);

/* ------------------------------------------------------------------ */
/* Disable interrupts */
/* ------------------------------------------------------------------ */
Flash_DisableAllInterrupts();

/* Disable SysTick */
S32_SysTick->CSRr = 0x00000000;

/* ------------------------------------------------------------------ */
/* Cache handling */
/* ------------------------------------------------------------------ */
Cache_Ip_Clean(CACHE_IP_CORE, CACHE_IP_DATA, TRUE);
Cache_Ip_Invalidate(CACHE_IP_CORE, CACHE_IP_INSTRUCTION);

/* ------------------------------------------------------------------ */
/* Set vector table address */
/* ------------------------------------------------------------------ */
S32_SCB->VTOR = (uint32)APP_STARTADDR;

/* ------------------------------------------------------------------ */
/* Set Main Stack Pointer */
/* ------------------------------------------------------------------ */
__asm volatile ("msr msp, %0" :: "r"(appStack));
__asm volatile ("msr psp, %0" :: "r"(appStack));

__asm__ __volatile__ ("dsb 0xF" : : : "memory");
__asm__ __volatile__ ("isb 0xF" : : : "memory");

/* Ensure Thumb mode */
resetHandler = (resetHandler & FLASH_THUMB_ADDRESS_MASK) | FLASH_THUMB_ADDRESS_BIT;

/* ------------------------------------------------------------------ */
/* Jump to application */
/* ------------------------------------------------------------------ */
((void (*)(void))resetHandler)();

/* Should never reach here */
while (1)
{
/* Trap */
}
}

We have a few specific questions:

1) Is there anything critical missing or incorrect in this validation/jump sequence?

2) Do you recommend additional checks (e.g., stricter SP/PC range validation or alignment checks)?

3) Could cache/MPU state or missing barriers still cause this intermittent behaviour even with this sequence?

4) Is there any known dependency on flash alignment or ECC correction that could explain why debugger reflashing always resolves the issue?

 

5) Additionally, we observed that using global interrupt disable:

    __asm volatile("cpsid i");

causes the jump to fail, whereas disabling interrupts one-by-one works reliably:

    for (irqIndex = DMATCD0_IRQn; irqIndex <= SoC_IRQn; irqIndex++)

    {

        IntCtrl_Ip_DisableIrq((IRQn_Type)irqIndex);

        IntCtrl_Ip_ClearPending((IRQn_Type)irqIndex);

    }

Could you please advise why global interrupt disable might affect the jump behaviour in this case?

S32DS-ARM S32K3 

Best regards,

Yusup

0 Kudos
Reply

43 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yusupkhan241,

You tested it on many boards successfully, and only a few show this issue. So this is clearly sporadic, and I cannot determine the root cause from the available information. There are many possible causes, and proper debugging on a failing board (with a debugger attached) is required.


What is interesting is that a power-on reset does not help. If this were just a runtime issue (e.g. bad cache state, pending IRQ, CPU register state, or leftover RAM content), a POR should clear it.
Do the other working boards behave normally standalone after a POR?
If yes, this points to something related to non-volatile memory. I would recommend dumping the flash content on a failing board and comparing it byte-for-byte with a working one.

 

Regards,

Daniel

 

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2378133%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIntermittent%20Bootloader%20%E2%86%92%20Application%20Jump%20Failure%20on%20S32K3%20(Not%20Reproducible%20on%20All%20Boards)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2378133%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%20Team%2C%3C%2FP%3E%3CP%3EI%E2%80%99m%20continuing%20from%20the%20earlier%20discussion%20on%20C40%20flash%20erase%2Fprogram%20limitations%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FC40-Flash-Erase-Write-from-Bootloader-in-S32K311-Same-Flash%2Fm-p%2F2349201%23U2349201%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3EC40%20Flash%20Erase%2FWrite%20from%20Bootloader%20in%20S32K311%20(Same%20Flash%20Block%20Execution)%3C%2FA%3E%26nbsp%3B%26nbsp%3Bin%20S32K3%20devices%3A%3C%2FP%3E%3CP%3EWith%20your%20support%2C%20we%20resolved%20the%20flash%20erase%2Fprogram%20issue%20by%3A%3C%2FP%3E%3CUL%3E%3CLI%3EEnsuring%20no%20execution%20from%20the%20target%20flash%20block%20during%20operations%3C%2FLI%3E%3C%2FUL%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3ECurrent%20Issue%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EWe%20are%20now%20observing%20an%20%3CSTRONG%3Eintermittent%20issue%20during%20bootloader%20%E2%86%92%20application%20jump%3C%2FSTRONG%3E.%3C%2FP%3E%3CUL%3E%3CLI%3EThe%20same%20jump%20implementation%20works%20reliably%20in%20most%20cases%3A%3C%2FLI%3E%3CUL%3E%3CLI%3ETested%20on%20~20%20boards%3C%2FLI%3E%3CLI%3EApplication%20reflashed%20%26gt%3B100%20times%3C%2FLI%3E%3CLI%3EECU%20reset%20%26gt%3B1000%20times%3C%2FLI%3E%3CLI%3ENo%20issue%20observed%20in%20these%20scenarios%3C%2FLI%3E%3C%2FUL%3E%3CLI%3EHowever%2C%20%3CSTRONG%3Ein%202%20boards%3C%2FSTRONG%3E%2C%20we%20occasionally%20see%3A%3C%2FLI%3E%3CUL%3E%3CLI%3EControl%20does%20%3CSTRONG%3Enot%20jump%20to%20application%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3EDevice%20remains%20stuck%20in%20bootloader%3C%2FLI%3E%3C%2FUL%3E%3CLI%3E%3CSTRONG%3ERecovery%20method%3A%3C%2FSTRONG%3E%3C%2FLI%3E%3CUL%3E%3CLI%3EReflashing%20a%20%3CSTRONG%3Ecombined%20HEX%20(bootloader%20%2B%20application)%3C%2FSTRONG%3E%20using%20debugger%20resolves%20the%20issue%3C%2FLI%3E%3C%2FUL%3E%3CLI%3EConcern%3A%3C%2FLI%3E%3CUL%3E%3CLI%3EIn%20production%20(vehicle-installed%20ECU)%2C%20reflashing%20via%20debugger%20is%20%3CSTRONG%3Enot%20practical%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FUL%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3EJump%20Implementation%20Used%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EC%3C%2FP%3E%3CP%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%20%3CSTRONG%3EJumpToApplication%3C%2FSTRONG%3E(%3CSTRONG%3Evoid%3C%2FSTRONG%3E)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20uint32%20%3CSTRONG%3EappStack%3C%2FSTRONG%3E%20%3D%20*(uint32%20*)(APP_STARTADDR)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20uint32%20func%20%3D%20*(uint32%20%3CSTRONG%3Evolatile%3C%2FSTRONG%3E%20*)(APP_STARTADDR%20%2B%200xC)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20func%20%3D%20*(uint32%20%3CSTRONG%3Evolatile%3C%2FSTRONG%3E%20*)(((uint32)func)%20%2B%200x4)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DisableAllInterrupts()%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20S32_SCB-%26gt%3BVTOR%20%3D%20APP_STARTADDR%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3E__asm%3C%2FSTRONG%3E%20%3CSTRONG%3Evolatile%3C%2FSTRONG%3E%20(%22%3CU%3Emsr%3C%2FU%3E%20%3CU%3Emsp%3C%2FU%3E%2C%20%250%22%20%3A%3A%20%22r%22(appStack))%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3E__asm%3C%2FSTRONG%3E%20%3CSTRONG%3Evolatile%3C%2FSTRONG%3E%20(%22%3CU%3Emsr%3C%2FU%3E%20%3CU%3Epsp%3C%2FU%3E%2C%20%250%22%20%3A%3A%20%22r%22(appStack))%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20func%20%3D%20((((uint32)func)%20%26amp%3B%200xFFFFFFFEU)%20%7C%201U)%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(*(%3CSTRONG%3Evoid%3C%2FSTRONG%3E%20(*)(%3CSTRONG%3Evoid%3C%2FSTRONG%3E))func)()%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3Ewhile%3C%2FSTRONG%3E%20(1)%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3Estatic%20void%20DisableAllInterrupts(void)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20for%20(int%20i%20%3D%20DMATCD0_IRQn%3B%20i%20%26lt%3B%3D%20SoC_IRQn%3B%20i%2B%2B)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20IntCtrl_Ip_DisableIrq((IRQn_Type)i)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20IntCtrl_Ip_ClearPending((IRQn_Type)i)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20S32_SysTick-%26gt%3BCSRr%20%3D%200U%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%3CSTRONG%3EObservations%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%3E%3CLI%3EIssue%20is%20%3CSTRONG%3Enot%20consistently%20reproducible%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3EAppears%20%3CSTRONG%3Eintermittent%20%26amp%3B%20happens%20randomly.%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3EFull%20image%20reflash%20(combined%20HEX)%20restores%20normal%20behaviour%3C%2FLI%3E%3C%2FUL%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3ERequest%20for%20Guidance%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ECould%20you%20please%20help%20with%3A%3C%2FP%3E%3COL%3E%3CLI%3EWhat%20additional%20checks%20should%20be%20added%20before%20jumping%20to%20application%3F%3C%2FLI%3E%3CLI%3EAre%20there%20any%20known%20%3CSTRONG%3Ecorner%20cases%20(MPU%2C%20cache%2C%20VTOR%2C%20barriers%2C%20etc.)%3C%2FSTRONG%3E%20that%20could%20cause%20this%20intermittent%20behaviour%3F%3C%2FLI%3E%3CLI%3ECould%20this%20be%20related%20to%3A%3C%2FLI%3E%3CUL%3E%3CLI%3ECache%20state%20(I%2FD%20cache%20not%20cleaned%2Fdisabled)%3F%3C%2FLI%3E%3CLI%3EIncomplete%20flash%20programming%20or%20alignment%20issue%3F%3C%2FLI%3E%3CLI%3EVector%20table%20or%20reset%20handler%20inconsistency%3F%3C%2FLI%3E%3C%2FUL%3E%3CLI%3EAny%20recommended%20%3CSTRONG%3Eproduction-grade%20sequence%3C%2FSTRONG%3E%20before%20jump%20(barriers%2C%20cache%20handling%2C%20etc.)%3F%3C%2FLI%3E%3C%2FOL%3E%3CP%3EIf%20any%20additional%20details%20are%20needed%2C%20please%20let%20me%20know%20and%20thanks%20in%20advance%20for%20your%20support.%3C%2FP%3E%3CP%3E%3CSTRONG%3EBest%20regards%2C%3C%2FSTRONG%3E%3CBR%20%2F%3EYusup%20Khan%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32DS-ARM%2Fpd-p%2FS32DS-ARM%22%20class%3D%22lia-product-mention%22%20data-product%3D%223477-1%22%20target%3D%22_blank%22%3ES32DS-ARM%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32K3%2Fpd-p%2FS32K3%22%20class%3D%22lia-product-mention%22%20data-product%3D%221688-1%22%20target%3D%22_blank%22%3ES32K3%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32K31XEVB-Q100%2Fpd-p%2FS32K31XEVB-Q100%22%20class%3D%22lia-product-mention%22%20data-product%3D%223490-1%22%20target%3D%22_blank%22%3ES32K31XEVB-Q100%3C%2FA%3E%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F160001%22%20target%3D%22_blank%22%3E%40danielmartynek%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FC40-Flash-Erase-Write-from-Bootloader-in-S32K311-Same-Flash%2Fm-p%2F2349201%23U2349201%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3EC40%20Flash%20Erase%2FWrite%20from%20Bootloader%20in%20S32K311%20(Same%20Flash%20Block%20Execution)%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2378394%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Intermittent%20Bootloader%20%E2%86%92%20Application%20Jump%20Failure%20on%20S32K3%20(Not%20Reproducible%20on%20All%20Boards)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2378394%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3BYusup%2C%3C%2FP%3E%0A%3CP%3EWhat%20does%20it%20mean%20that%20the%20device%20remains%20stuck%20in%20the%20bootloader%3F%3CBR%20%2F%3ECan%20you%20attach%20a%20debugger%20and%20check%20where%20it%20is%20stuck%3F%3CBR%20%2F%3EIs%20it%20a%20fault%20exception%20or%20a%20software%20loop%3F%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EIs%20reflashing%20really%20necessary%2C%20or%20would%20a%20POR%20be%20sufficient%3F%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ERegarding%20MPU%20and%20cache%2C%20it%20is%20good%20practice%20to%20clean%20and%20disable%20the%20cache.%20The%20application%20reconfigures%20the%20MPU%20for%20its%20use%20case%2C%20so%20the%20cache%20should%20be%20cleaned%20and%20disabled%20anyway.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EYou%20can%20add%20memory%20barriers%20or%20refer%20to%20the%20S32K3xx%20Reference%20Manual%2C%20Section%203.8%20%E2%80%9CSerialization%20of%20Memory%20Operations%E2%80%9D%20and%20use%20the%20read-after-write%20sequence.%3C%2FP%3E%0A%3CP%3EAlso%2C%20check%20the%20DCM_GPR%20registers%20for%20faults.%20(RM%2C%20Table%20231.%20DCM%20controlled%20features%20and%20availability%20in%20product%20family.)%3C%2FP%3E%0A%3CP%3EMake%20sure%20that%20the%20clock%20configuration%20matched%20one%20of%20the%20clock%20options%20listed%20in%20the%20RM%2C%20e.g.%20Table%20157.%20Option%20A%20-%20High%20Performance%20mode%20(CORE_CLK%20%40%20160%20MHz).%3C%2FP%3E%0A%3CP%3EAnyway.%20the%20key%20point%20is%20to%20identify%20the%20loop%20where%20the%20bootloader%20is%20stuck.%20If%20there%20is%20a%20fault%20exception%2C%20you%20need%20to%20gather%20more%20information%20about%20the%20fault.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K312-HARDFAULT-Handling-Interrupt-DS3-5-RTD300%2Fta-p%2F1806259%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K312-HARDFAULT-Handling-Interrupt-DS3-5-RTD300%2Fta-p%2F1806259%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FHow-To-Debug-A-Fault-Exception-On-ARM-Cortex-M-V7M-MCU-S32K3XX%2Fta-p%2F1595570%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FHow-To-Debug-A-Fault-Exception-On-ARM-Cortex-M-V7M-MCU-S32K3XX%2Fta-p%2F1595570%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FFault-handling-on-S32K14x%2Fta-p%2F1114447%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FFault-handling-on-S32K14x%2Fta-p%2F1114447%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E