MSPM0G1505: MSPM0G1505 Intermittent FLASH_DED NMI / HardFault Resets Related to HFXTRSEL Setting

Part Number: MSPM0G1505

Hi TI Gurus,

I am troubleshooting an intermittent runtime reset issue on an MSPM0G1505 (silicon revision 2).

Observed Failure:
During normal operation, the device occasionally resets. After instrumenting the fault handlers, I determined the sequence is:

 - NMI occurs with source DL_SYSCTL_NMI_IIDX_FLASH_DED
 - NMI exits
 - A subsequent HardFault occurs
 - Device resets

We do not perform runtime flash programming.

Investigation Performed:
Based on previous guidance and errata review, I verified:

 - No DMA reads from flash are occurring.
 - No apparent DMA/flash bus collisions.
 - Flash wait states are configured correctly for operating frequency.
 - I have reviewed code for stack corruption and pointer corruption issues and have not found evidence of either.
 - Application image is not located near the end of flash, and avoiding the last flash bytes does not appear relevant to our memory layout.
 - I have captured and correlated SYSCTL->DEDERRADDR and it is somewhat random but always near to a __WFI() instruction.

Findings:
While reviewing errata SLAZ742G, I noticed CLK_ERR_01, which discusses operation with a 4 MHz crystal and debugger connected.

Our design uses a 4 MHz HFXT crystal, but the failures occur without a debugger connected.

As an experiment, I changed the HFXTRSEL from:

    DL_SYSCTL_HFXT_RANGE_4_8_MHZ

to

    DL_SYSCTL_HFXT_RANGE_8_16_MHZ

This completely eliminates the FLASH_DED/HardFault/reset issue.

More importantly, I can reliably make the problem appear and disappear simply by switching between these two HFXTRSEL settings.

Results:

HFXTRSEL = 4-8 MHz

 - Intermittent FLASH_DED NMI
 - HardFault follows
 - System resets

HFXTRSEL = 8-16 MHz

 - Failure disappears

However, using the 8-16 MHz setting has side effects:

 - Approximately 10% increase in core current (~1470 µA baseline)
 - About 3 ppm reduction in measured crystal frequency accuracy
 
Questions:
 1. For a 4 MHz crystal operating without a debugger attached, should there ever be FLASH_DED, NMI, or HardFault events related to the HFXT range setting, specifically the 4-8MHz setting?

 2. Is CLK_ERR_01 (slaz742g) strictly caused by active debugger interaction, or can certain debug-related MCU settings, programming/debug operations, or clock configurations trigger the same behavior in standalone operation?

 3. Are there any known mechanisms by which an incorrect HFXTRSEL setting could result in FLASH_DED / NMI events?

 4. Has anyone observed similar behavior where changing HFXTRSEL from 4-8 MHz to 8-16 MHz eliminates intermittent FLASH_DED / NMI errors?

 5. Are there additional clock-system or flash-controller settings that should be reviewed?

Any insight would be appreciated. The ability to command the failure in and out solely by changing HFXTRSEL makes it appear that the clock configuration may be closely related to the root cause.

  • Hi Mark,

    Your HFXTRSEL experiment is a significant clue. For a 4 MHz crystal, DL_SYSCTL_HFXT_RANGE_4_8_MHZ is the nominal datasheet setting. The MSPM0G1505 electrical characteristics specify HFXTRSEL=00 for 4–8 MHz and HFXTRSEL=01 for 8.01–16 MHz. Therefore, using the 8–16 MHz range with a 4 MHz crystal should be considered an errata workaround/diagnostic condition rather than the normal production configuration. The increase in current and change in measured frequency that you observed are also reasons I would not recommend simply adopting the 8–16 MHz setting as the final solution without further confirmation.

    The current MSPM0G150x/G350x errata, Rev. H, still contains CLK_ERR_01. It states that when MCLK is sourced directly from a 4 MHz HFXT and HFXTRSEL=0, random HardFault or NMI behavior can occur with the debugger connected; the documented workaround is to select HFXTRSEL=1 or higher while debugging. Your observation is particularly interesting because you can make the failure appear with the nominal 4–8 MHz setting and disappear with the same workaround even when the debugger is disconnected.

    Based on the currently published errata, I would not consider intermittent FLASH_DED/NMI operation expected in a standalone system simply because a 4 MHz crystal is configured with the correct 4–8 MHz range. The published scope of CLK_ERR_01 is specifically the debugger-connected case. I also do not see a documented mechanism stating that a valid HFXTRSEL=0 setting at 4 MHz should directly create a Flash ECC double-error event. Because your result reproduces the CLK_ERR_01 workaround outside its documented condition, I think this needs to be escalated internally rather than assuming the 8–16 MHz setting is the production fix.

    There is another erratum I would test before changing hardware: CPU_ERR_03. It states that when entering a low-power mode with a pending flash prefetch, the prefetcher can capture incorrect data. After wakeup, the CPU can then execute incorrect instructions if the prefetch/cache has not been flushed. The documented workaround is to disable the prefetcher before __WFI()/__WFE(), perform the shutdown-memory access needed to ensure the prefetch disable has taken effect, enter the low-power mode, and then re-enable prefetch after wakeup. This is especially relevant because you have already correlated DEDERRADDR with locations around __WFI().

    I would suggest the following next test sequence:

    1. Return HFXTRSEL to the correct DL_SYSCTL_HFXT_RANGE_4_8_MHZ setting.
    2. Apply the CPU_ERR_03 prefetch workaround around every __WFI()/__WFE() and rerun the same stress test.
    3. In the NMI handler, capture DEDERRADDR, NMI source, CPUSS->CTL, HFXTRSEL, clock status, and MCLK source before returning from the NMI.
    4. In the HardFault handler, capture the stacked PC and LR so we can determine whether the HardFault is occurring on the same flash fetch that generated the DED event.
    5. Repeat with the debugger physically disconnected and with any automated reconnect/reset behavior disabled.

    One other point when interpreting DEDERRADDR: FLASH_ERR_04 documents an incorrect address representation when the DED occurs outside Main Flash, and FLASH_ERR_05 allows a specific nonzero reset value in DEDERRADDR. If your captured addresses are genuinely within the Main Flash code region around __WFI(), those two errata would not explain the result.

    You have already eliminated several of the more common causes—no runtime flash programming, no DMA reads from flash, correct flash wait states, and no evidence of stack/pointer corruption. Given that changing only HFXTRSEL reliably commands the failure in and out, I agree that the clock configuration is strongly correlated with the issue. I would therefore test the CPU_ERR_03 workaround first and, in parallel, escalate this as a potential extension or related manifestation of CLK_ERR_01 under standalone operation. I would not recommend using HFXTRSEL=8–16 MHz permanently with a 4 MHz crystal until that behavior is confirmed as an approved workaround for the non-debug case.

  • Thanks Brian for your in depth response.

    I will work on getting CPU_ERR_03 tested. I have tried the disable and flush code around the __WFI() code earlier and still had failure, but I will run that formally to verify behavior with a controlled change and test. That way we can move forward with confidence or find out that it solves the issue.

    As an aside, I have been extracting data by bit-banging addresses out on some pins, after trapping the interrupts, as our debugger has been unable to remain connected during runtime. 

    During my failures I have seen no occurrence of FLASH_ERR_04.  

**Attention** This is a public forum