Debugging Interrupts in FreeRTOS

Good day

Intermittently, one of my functions takes longer than expected to finish executing.
The calling task has the highest priority of all tasks, so I know it is not being blocked by other tasks.

I believe that the function is delayed when an interrupt (or two) occurs while it is executing, causing a delay in its completion.

  1. What is the best way to get a summary of a system’s interrupts?

  2. Does anyone have advice for how I can debug a problem like this?

Additional information: I am using NXP’s RT1176 processor (Dual core ARM M7 & M4), and have been using NXP’s MCUXpresso IDE for development. The built-in FreeRTOS “Tasks” view has proven very useful.

your tool of choice is percepio’s tracealyzer or compatible.

Thanks @RAc !

After speaking to Percepio’s support team, I discovered that they don’t support the debugger I am using (NXP’s MCU-Link).
However, I was able to get NXP’s MCUXpresso’s SWO Tracing tool to work, which is giving me the information I need.

If anyone wants to use MCUXpresso’s SWO Tracing for the RT1176 processor, follow these steps:

  1. Configure the CSTRACE clock in the “Clocks” ConfigTool view:
    image
  2. In the “Pins” ConfigTool view, enable the SWO pin and route it to one of the two given options:
    image
    image
  3. In the “Routing details” view in the “Pins” ConfigTool view, the default setup for the pin is given in italics. Click the dropdown menu for each accessible option and re-select the default value. This will change the setup parameters to normal text (not italics). This ensures that the code is generated for these settings. I have previously found that using these ‘default’ (italics) values as is can cause a pin not to work as expected.
  4. Click “Update Code” in the ConfigTools view.
  5. Start a debugging session
  6. In the “SWO Trace Config” window, configure the “Clock speed” to 132MHz.
  7. Use the various SWO Trace views’ start/stop controls to trace
1 Like

Thank you for taking time to report your solution.

1 Like

Update: Although my previous post describes how to get information out of SWO tracing, this information is distorted in some fashion.
More information about the problem can be found in my post on NXP community.

I will update both posts once I have it working.

Thank you again for updating!

1 Like

Good day community

There was a problem in NXP’s MCUXpresso IDE.
After they fixed this bug, the above process worked perfectly (results were no longer distorted).
Note that this process is specifically for the M7 core on the RT1176.

Should you wish to use this for the RT1176’s M4 core, there is no dedicated trace clock (no step 1), and the SWO clock speed should be equal to the core’s clock speed of 392MHz (step 6).
You can use the ‘detect’ clock speed function for this.

D_TTSA

1 Like

Thank you again for reporting back!