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.
Hello everybody,
I'm useing the Matlab Simulink Embedded Code support Package for C2000 with Matlab 2020b. The comperator of the SDFM Module is used to detect an over current situation and i want to use this to force an ePWM to low with the Trip Zone. I used Custom Code with the System Initialize block to configure the ePWm x-bar.
the Digital compare unit of the ePWM was configured like this:
and the Trip Zone like this :
Now i turned the current slowly up so that the Higher threshold of the SDFM comperator was triggerd. The ePWM signal was displayed by a Scope but it was not forced to low.
I also observed the ePWM TZFLG register in Code Composer Studio. The DCAEVT1 Bit was set when the over current happend. Maybe someone can help me with this Problem.
Thanks a lot.
Phillip
Phillip,
Thanks for reaching out to the E2E forum. I know MW team is also aware of this post, so they may reply as well.
I believe since we are seeing DCAEVT1 bit set then the TripMux portion and DC module are working correctly, so we can focus on the Trip Zone settings.
After you see DCAEVT1 high, can you chekc the TZFLG[OST] bit to see if it is also set? This would indicate that the TZ module has registered the one shot event. I would expect this to be low, since we don't see an action on the ePWM, but its good to make sure.
Also, I would try the code with the DCAEVT1 interrupt unselected. According to the documentation if we are using the DC as the one shot source there is no need to set this as the TZEINT source as well. The docs are not clear if this would cause an issue, but it would be good to try the setup with this change.
There is also a software force bit in the TZ module, I'm not sure where these reside in the simulink GUI, but you could try that to make sure you see the PWM go low(to confirm all the action bits are set correctly) This is called TZFRC[OSHT].
I'll keep an eye on this post for your results.
Best,
Matthew
Hi Matthew,
Thank you for your awnser. I unselected the DCAEVT1 Interrupt, but this was not the Problem. The ePWM was also not forced to low. I checked the Registers in CCS an found following (the over current sittuation happend) :
Interesting was that the TZFRC DCAEVT is 0. in accordance with the reffernce manuel i think it should be 10. Could this be the Problem ?
Phillip
Phillip,
When you get to this state of the device, can you use CCS watch window to write a "1" to the TZFRC - OST bit and see if your PWM goes low? This would help isolate where in the signal chain the signal is/is not getting to.
Best,
Matthew
Phillip,
Sorry for the delay here, I'm going to need another day to look into this. That the OSHT force didn't work, tells me there must be a missing connection in the path.
I'm not certain the software force in simulink is the same as the OSHT force; I think this might just be a force reload of the shadow to active registers in the main PWM regs(like would happen on a count match, etc). I'm going to ping some others on the team as well to help track this down.
Best,
Matthew
Phillip,
Thanks for your patience here, I spoke with some of my colleagues and the issue stems from that once the DCAEVT feeds into the TZ the action needs to come from the TZ to hold the one shot. So instead of selecting ePWM5A forced on DCAEVT, we should pick ePWM5A forced low on TZ(the top one of that group).
Let me know if this gives the correct behaivor.
Best,
Matthew
Hi Matthew,
now it works well. The ePWM is forced to Low. Thanks a lot for the support.
Phillip