iMX8X Cortex-M4: CM4__WDOG hardfault on startup?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your detailed description. I can help you work through this issue on your Colibri iMX8X running the hello_world M4 application via JTAG.

1. JTAG Debug Startup Checklist

  • Ensure you’re using the proper device identifier when invoking the JLinkGDBServer:
    JLinkGDBServer -if JTAG -device MIMX8QX6_M4 -vd -xc mekmimx8qx_gdbsrv.cfg
    
    Make sure you have the mekmimx8qx_gdbsrv.cfg file in the correct location, as per the guide:
    Cortex-M JTAG Debugging | Toradex Developer Center

2. Linux Resource Ownership

The most common cause of HardFaults in the early stages of SystemInit for i.MX SoCs is that the A-core (running Linux or TorizonCore) has not relinquished hardware resources, so the M4 is not able to access them. Particularly, the watchdog peripheral may still be under Linux control, and so M4 attempts to access it will generate a fault.

To test this, try:

  • Booting just to U-Boot, without booting into Linux.
  • Performing your JTAG debug session with the Linux system not running, letting only U-Boot initialize the hardware.

If you do not get a HardFault in this scenario, the issue is with Linux’s early resource usage.
Reference: No serial output of hello world

3. Pin Usage and UART Output

You mentioned using pins 146/144 (according to Pin Planner). On the Colibri iMX8X, these correspond to QuadSPI (QSPI) signals by default, not a UART. For M4 UART communication, it’s vital that:

  • You use the correct pins, and
  • The UART you select is properly configured and muxed for the M4 core in your device tree overlay.

Consult the datasheet pinout table and use a UART resource that is free and accessible by the M4. Refer to your device tree to confirm the mapping.

4. JTAG Debug Connection

Double-check all points in the JTAG debug guide to ensure everything is configured as expected:

5. Watchdog Resource & SystemInit

Your diagnosis—failing on a write to the watchdog—is likely correct. Ensure no other system core is holding the WDOG peripheral. Try disabling the watchdog code temporarily to see if you progress farther in SystemInit. If so, this confirms the resource contention.

6. Boards.h and Pin Indexing

Pin references in boards.h often correlate to NXP signal names and module documentation, not directly to SOM-edge connector pins. To remap UART signals to a more convenient pin:

  • Refer to the Colibri iMX8X datasheet and your specific carrier board’s schematics.
  • Update your device tree overlay so desired pins (that are UART-capable) are routed to the M4’s UART instance.
  • Verify with the Linux cat /proc/pinmux (if available) and/or NXP reference manual.

Summary Recommendation

  • Try running the hello_world application with only U-Boot running, not Linux.
  • Double-check device tree overlays and that your UART pins are correctly configured for use with the M4.
  • Use the prescribed JLinkGDBServer command with the right device and config file.
  • Temporarily comment out the watchdog register writes to check if your program gets further in the initialization.

If you make these adjustments and see improvements or encounter new issues, please let me know what happens next!

Best regards,
Toradex AI Assistant

Helpful links: