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.

I need help to get Overrun detection technique

Dear friends from e2e.ti.com,

I would like to get a way to detect overruns in C2000 MCU, in particular for delfino 28335. I use matlab/simulink to generates *.out file. In simulink/cogde_generation there is an option to create a "call custom fucntion" which is called when an averrun is detected. I would like to switch on a led when an overrun is detected. Could you give some tips to create that "custom functio"  (for exampple where I have to declarate the fucntion in matlqab/simulink or if there is any simulink/block to do it)?

Is there other way (switch on a led when overrun is detected) to do the same from CCSv5?

How can I detect overruns in general (not necessarily switching on a led) from CCSv5 or matlab/simulink? (perhaps this must be the first query)

Thanks in advance, 

Manuel Nieves

  • Hi Manuel,

    How can I detect overruns in general (not necessarily switching on a led) from CCSv5 or matlab/simulink? (perhaps this must be the first query)


    Can you describe as in what overruns are you looking for? This seems like a general term, are you looking for any specific one?

    Regards,
    Gautam
  • Hi Gautam,

    Thanks for your reply. I am going to clear up: I am executing a set of instructions (basicly several PID controllers, analog inputs and PWM outputs) in discrete time with fixed-step (50 microsecons). I would would like to get a flag (switch on a led) if the microcontroller could not executate all the instruction in 50 us. I would like to do it from simulink firstly and from CCSv5 secondly. Simulink give the option to create a "custom_function" that is executed is a overrun of this type happens (but i don not know how and where).

    Thanks in advance
  • Thanks for the detailed description. My routines follow the same steps and I generally toggle GPIOs to get the data for execution time vs cpu_timer time. Again, simulink support is very very bleak in this forum and only support for core coding can be given.
    This is the algorithm that I follow:

    interrupt cputimer0()
    {
    set_gpio;
    all the routines here...
    clear_gpio
    }

    This GPIO toggling will give you how much time your PID controllers and other peripherals are consuming wrt cputimer0.

    Regards,
    Gautam
  • Hi Gautam,

    Thank for your reply. I think this tip is beyond me, could you give more information or an example please?

    Regards,

    Manuel
  • I think this tip is beyond me, could you give more information or an example please?


    Let me explain in simple words:

    You've a 50us timer running in which all your PID controller, PWMs have to respond, right? During this you need to check whether these routines have overrun the timer or not. To ensure this, if you simply set a GPIO at the start of timer routine and clear it after the whole computation, you'll get your computation time (observe the toggle duration on the DSO) ie PID, PWM etc. Now, if computation time is more than CPU timer... the overrun has occurred else not.
    To implement this you need to code using CCS; also I'm not sure how this can be done using simulink.

    Regards,
    Gautam
  • Hi Gautam,

    I have just understood it. I am going to get the ball tolling.
    Thank a whole lot for your reply and time.

    Regards,

    Manuel
  • No problem at all, Manuel! Just keep us informed on how the things go at your side.

    Goodluck & Regards,
    Gautam