[Solved] UsageFault or HardFault when connect to target Cortex M4F

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [Solved] UsageFault or HardFault when connect to target Cortex M4F

    I am having a small demo project and a real project.

    With the small demo project, the SystemView works like a charm with FreeRTOS and XMC4500.

    However, when I use SystemView for my real project, at the moment I connect the SystemView PC Application to MCU, the system underwent a reset and after that the trace works again like a charm. When the 1000,000 limit is reached, the trace stops itself.

    My FreeRTOS ram is in PSRAM 0x10000000 - 0x10000. The .data and .bss is in 0x20000000 - 0x10000

    I then did try to see what kind of reset it was by giving each of the Cortex M4 exceptions a number from 1,2,3,4,5 and trap the fault by calling test(i) inside the exception handler with its own number as parameter.
    Debugger was connected then to the running target.

    static void test(int i)
    int j = i;

    This way I can tell that it is mostly UsageFault (and occasionally HardFault). These faults does not happen otherwise in my firmware.

    Indeed the source of fault is INVPC. Alternatively, it was Hardfault, where INVPC is also set.

    How can I avoid these two kind of resets when using SystemView?
    • UsageFault_Sysview.PNG

      22.42 kB, 628×364, viewed 461 times

      20.01 kB, 570×204, viewed 404 times
    • hardfault.PNG

      46.83 kB, 1,223×690, viewed 432 times

    The post was edited 5 times, last by shenj ().