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.

USER11_ISR() called without TRAP instruction

Hi everyone,

I'm running an application on F28M36, where I use a file called config.h to choose values for a set of pre-defined names for the C28 core:

...

#define FONTE_MODO OnePS1Q // Topologia da fonte a ser controlada

#define MAX_SLEWRATE 9.0 // Slew-rate máximo [V/s]

#define PWM_MAX_DUTY 0.9 // Maximo ciclo de trabalho para o PWM (em p.u.)
#define PWM_MIN_DUTY 0.0 // Minimo ciclo de trabalho para o PWM (em p.u.)
#define PWM_MAX_DUTY_OL 0.8 // Maximo ciclo de trabalho para o PWM em malha aberta (em p.u.)
#define PWM_MIN_DUTY_OL 0.0 // Minimo ciclo de trabalho para o PWM em malha aberta (em p.u.)

...

My main code uses values from config.h for initialization of the whole application. My problem is that depending on the value of MAX_SLEWRATE, the C28 core is calling the default user defined trap # 11 (USER11_ISR(), from F28M36x_DefaultISR). For example, if MAX_SLEWRATE = 9.0, there is no problem, but if I set to 100000.0, I get the error.What is even stranger is the fact that the ISR is called before my main code uses this MAX_SLEWRATE. I'm not even using the TRAP instruction anywhere in my code.

 

Any suggestions?

  • Hi Gabriel,

    This look strange. Did you check if there is any warning during compile? Also is the issue is only with value 100000.0 or any big number? Could you try value 65534 and 65536 and see what happens in both case.

    Regards,

    Vivek Singh

  • Hi Vivek,

    There's only two warnings, one concerning a "temp" variable defined by TI header files, and one that states I'm using a newer compiler version. Nothing to worry about, I guess.

    I tried your suggestion and the problem occurs for MAX_SLEWRATE values greater than 1000.0 (o_O?).

    I don't have further experience debugging things in IDE's, apart of  using breakpoints and manipulating variables.

    Just to give more insights, this is the halt state when entering the user ISR #11:

    CheckStatus_HRADC() is a function called within InitPeripherals. It seems to me CheckStatus should appear above InitPeripherals, am I right?

    As I said before, MAX_SLEWRATE is not used within InitPeripherals(), but in a function called after it. 

    Is there any other useful information I should give or tests to perform?

    Thanks for attention!

  • Some further information: I'm using CCS v6.1.1.00022, complier version 6.4.9, and optimization level 2.

  • Hi Gabriel,

    As I said it's strange that issue occurs for some specific value. In this case you need to step through the code to see when it's jumping to USER11 ISR. It look like some how the instruction fetch is getting corrupted which makes the execution to branch to this ISR. You should check the status of CNMIFLG register as well (Figure 1-68. C28 NMI Flag (CNMIFLG) Register in TRM) to see if there is any error happening during execution.

    About order of the functions in CCS debug view, I don't think there is any specific order there so that should be ok.

    Regards,

    Vivek Singh

     

  • Hi Vivek,

    I've checked the status of CNMIFLG, and none of the flags are active.

    It seems that MAX_SLEWRATE has nothing to do with the problem, because I was working on another project, which uses the same libraries from that InitPeripherals() and CheckStatus() functions, and after I included some new functionalities, the problem also happened. These new functionalities have nothing to do with MAX_SLEWRATE, neither with the mentioned functions.

    I gets even stranger. I stepped through the code (using the Step Into (F5) button), where the problem seems to occurs, and the user trap wasn't called anywhere! The code flows normally when I step through it manually.

    Then I placed a breakpoint inside the CheckStatus() function, and after it's executed, I get a ILLEGAL_ISR() call instead :O !

    One last information, I tried changing the optimization level to 1, and for some obscure reason, it worked! I still would like to use level 2, due to the improved execution time.

    Best Regards,

    Gabriel

  • Hi Gabriel,
    Code is executing from RAM or Flash. If from Flash, please try running it from RAM and see if it still fails. Also do you have some interrupt routines inside which you are enabling global interrupts?

    Regards,
    Vivek Singh
  • Hi Gabriel, Is this issue resolved?

    Vivek Singh
  • Closing the thread. If issue still not resolved, please re-open this one or start a new post.
  • Hi Vivek,

    Thanks for the messages. I'm really sorry for the delay, but we've been running behind schedule here, and I decided to prioritize different things.

    Actually I was able to solve this problem fixing some other stuff which were executed nearby. There were errors like overflows during calculations due to improper variable type (using Uint16 for value greater than 2^16-1, for example), lack of compilation directives (like volatile, static, etc), and a call of some global pointers before they were instantiated.

    Again, I apologize for the inconvenience. I see TI foruns as a great plataform for application developers, and hope to keep a good quality in the discussions.

    Best regards,

    Gabriel

  • Thanks Gabriel. Good to know you were able to resolve the issue.