This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NXP i.MXRT1064 Stack Corruption using FLEXCAN / LPUART / Systick Interrupts

I have encountered an issue with using the GNU Tools for ARM Embedded in combination with the NXP i.MXRT1064. When running a simple program, using the NXP MIMXRT1064-EVK board, the device will enter a hard fault for various reasons.

The program is set up as below:

  • Systick interrupt configured for 500ms.
  • FLEXCAN (not CAN FD) configured to send a simulated DM1 every 1 second.
  • LPUART configured to send a debug string (tick / tock) every 1 second.
  • Simulation of a J1939 TP message by sending 50 CAN messages back to back on key press.

The problems that have been encountered:

  • Corrupted function arguments when performing function calls inside interrupts resulting in misaligned memory access.
  • Corrupted return address resulting in erroneous program jumps (unable to trace where this occurs as timing is random and stack is obliterated)

It should be highlighted that we have only been experiencing this issue when CAN Tx is used, it has not been noticed when CAN Tx code is removed.

The following compilers were used:

  • 4.9 2015q1 (Used for all products with ST parts - no issues)
  • 8 2019-q3

This program has been built and debugged using the IAR toolchain with no issues so far.

Has this issue, or similar issues, been encountered before?

Are there any known issues with GCC and NXP devices? We have only used ST to this point.

Any errata for GCC and ARM M7 that might affect this that we might have missed (chip errata and NXP themselves have no info).