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.

TMS320F28335: Use Software Interrupt to Trip EPWM signals to Low in Simulink

Part Number: TMS320F28335


Hello,

I am trying to build a model in Simulink to trip the ePWM signals while comparing a value (threshold value) from ADC. Basically, I am trying to implement a protection logic for my circuit. The constraint is- I have to implement this trip logic in software and on a priority higher than the normal code.

Previously, I use to get the value from ADC and compare it with if logic and write the logic directly in the register using 'Memory Copy' block. 

I could not figure out how to implement it using the software interrupt or the Hardware interrupts. Please suggest.

 

  • I've reached out to MathWorks to alert them to your post. You may also want to consider contacting them directly though:

    https://www.mathworks.com/support/contact_us.html

    Whitney

  • Hi,

    Please refer this example:

    https://in.mathworks.com/help/supportpkg/texasinstrumentsc2000/examples/adc-pwm-synchronization-via-adc-interrupt.html

    Inside the interrupt triggered subsystem you can implement the trip logic.

    Double click on the C28x Hardware Interrupt block. 

    We provide an option to configure the priority of the interrupt here.

    The default priority for the model base rate which is triggered from a timer interrupt is 40.

    You can provide a value lesser than his for ADC this increasing it's priority.

    Please note, when using this implementation we need to enable the End of Conversion interrupt for ADC block.

    The example has it configured. 

    Hope this helps.

  • Thank you for your answer. But I have a few questions based on my requirement:

    1. In the code composer studio, if  we use any of the interrupt services, when DSP detects the interrupt request it forces our program to jump into the interrupt function loop where it gives service to this request, but the important thing is that the program inside the interrupt function only running when  we are in the  interrupt function loop,  and the function written inside that will become disabled. 

    So, why in Simulink examples all the model starts with the interrupt block? How does it function? How the interrupt block gets triggered? 

    2. In my model, I am not using the ADC with ePWM. My ADC blocks detect the current and require to trip the ePWM when the current detected crosses the threshold. 

    This Software interrupt will trigger the Hardware interrupts which will disable all the ePWM (1,2,and3) to low. The subsystem triggered by the hardware interrupt manually writes the low value to the OST register. 

    What type of interrupt number shall I use? 

    3. Also, in the condition mentioned above, I guess post interrupt at the EOC shall not be enabled. Am I correct?

    Please suggest. Thank You

  • Hi Soumava,

    If you do the code generation for the model

    https://in.mathworks.com/help/supportpkg/texasinstrumentsc2000/examples/adc-pwm-synchronization-via-adc-interrupt.html

    You will notice the following:

    In the file c2807x_2837xx_adcpwmasynctest_ert.c

    The function -> isr_int1pie1_task_fcn() represents the ADC-PWM Subsystem(in the model).

    This function is intern called from the ADC ISR when ADC interrupt generated.

    But in your approach, you are just firing the interrupt using software trigger. We need the C28x Hardware Interrupt block to generate the ISR and related logic that handles the interrupt.

    Having only software interrupt block does not generate the software required for interrupt handling.

    So you can still have the software based interrupt mechanism but add the C28x Hardware interrupt to handle the interrupt.

    You then make the trip logic part of subsystem that is tied to hardware interrupt block.

    HTH,

  • Hello,

    Thank You and sorry for the delayed response. I am still confused about this question which I mentioned earlier in my comment.

    In the code composer studio, if  we use any of the interrupt services, when DSP detects the interrupt request it forces our program to jump into the interrupt function loop where it gives service to this request, but the important thing is that the program inside the interrupt function only running when  we are in the interrupt function loop,  and the function written inside that will become disabled. 

    I will be glad if you could be more clear for my better understanding. 

    Regards,

    Soumava

  • Venkatesh, Soumava,

    Do you have any updates on this issue?

    Thanks,

    Whitney

  • Hi Whitney,

    I am still expecting a response from Venkatesh.

    Thanks,

    Soumava