This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What can cause exceptions when running MSP432 RTOS?

Other Parts Discussed in Thread: SYSBIOS

Hello, everyone!

I am using MSP432 RTOS(tirtos_msp43x_2_16_01_14) to develop my application in CCSv6.1.3.

When running my code of RTOS, a exception must occur. Who can tell me what cause a exception and how I should do to handle the exception?

Best Regard,

Gilbert

  • Hi Gilbert, your request is a bit vague.

    How do you know you have an exception? The MCU resets? If so you can trap the reset interrupt and check the reset cause. This will narrow down your research.

    Another good thing to do is to trap all the unused interrupts, just in case something is triggering one.

  • Hi Claudio, thank you for your kindness!

    In my code, I redefine the excHandlerFunc. When running the code, it will enter myExcHandlerFunc. Can you tell me how to check the exception cause?

    Best Regards,
    Gilbert
  • This video/pdf has some details about exception handling: training.ti.com/debugging-common-application-issues-ti-rtos

    Also, you can look Hwi_excHandlerMin and/or Hwi_excHandlerMax in <ti-rtos_install_dir>/products/<bios_install_dir>\packages\ti\sysbios\family\arm\m3\Hwi.c. You can use them as a reference.

    Todd
  • Hi Gilbert,

    I would try setting this in your .cfg file:

    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    m3Hwi.enableException = true;

    and not set the excHandlerFunc to your own or any other value.   This lets it go to the default when exceptions are enabled, which should be Hwi_excHandlerMax().

    So try commenting out any lines in your .cfg file that set m3Hwi.excHandleFunc, e.g.:

    //m3Hwi.excHandlerFunc = null;

    Now when you build and run your program and it causes an exception, in CCS, bring up the ROV tool (under CCS Tools menu).  Look at Hwi in ROV and open the "Exception" tab.  There you should see a dump of register contents at the time the exception occurred.  For example, I caused an unaligned access exception and this is what I get in ROV:

    Look at the link return register value, which tells you the approximate location in your code that caused the exception.  In my case, it is showing as 0x27dd.  Then I open a disassembly window in CCS, and look for the nearest function to that address.  In my case, it is the function initHw():

    I can then set a breakpoint on initHw(), re-load and re-run my program to see who called initHw().

    Best regards,

    Janet

  • Hi Janet,

    According to what you said, I capture these two pictures showing the exception details.

    The link return value is not valid. And the Hwi_excHandlerMax() tells me that this is caused by Hard Fault.

    What do Hard faults include?

    Best Regards,

    Gilbert

        

  • Hi Gilbert,

    The hard fault could be caused by executing an illegal instruction.  I don't know why your lr register does not have a valid address.  Was there no valid code at 0x117eb?

    Can you check the task stacks in ROV and make sure they have not overrun?

    Best regards,

    Janet