Best way to disable PWm output pins

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User13948
Level 2
Level 2
First like received
Hello,
I'm using the PWM_SVM app and I would like to set the outputs to passive state.
The app does not seem to support this supposedly easy function.
Is it necessary to generate a TRAP signal in software? And how to do it?

Best regards

Alberto
0 Likes
4 Replies
User14799
Level 2
Level 2
First like received
In the "Manual Pin Allocator" (right click on an App in the App Depedency Tab) You can set the Pins to "Not Selected". Maybe this deactivates the Pins.
0 Likes
User13948
Level 2
Level 2
First like received
Thanks, I need to do this by calling a function in my program, for example when an emergency condition arises and power should be cut off..
Unfortunately it seems I can't get understand the logic behind all of this DAVE thing. I have been using code generators or libraries from other suppliers and found them helpul., DAVE seems to be limited, not so reliable and not flexible.
Also, Infineon does not seem to care about this forum, many questions never get replied.
0 Likes
User10538
Level 3
Level 3
I amended the HardFault Handler and the abort()-Function with

PWM_SetDutyCycle(&M1A, 0);
PWM_SetDutyCycle(&M1B, 0);
PWM_SetDutyCycle(&M2A, 0);
PWM_SetDutyCycle(&M2B, 0);
PWM_SetDutyCycle(&M3A, 0);
PWM_SetDutyCycle(&M3B, 0);
PWM_SetDutyCycle(&M4A, 0);
PWM_SetDutyCycle(&M4B, 0);
PWM_SetDutyCycle(&M5A, 0);
PWM_SetDutyCycle(&M5B, 0);
PWM_SetDutyCycle(&M6A, 0);
PWM_SetDutyCycle(&M6B, 0);

Seems to do the trick, but i concur it's should be an easy hardware function.
M1A ... are my labels for the PWM instances
0 Likes
User13948
Level 2
Level 2
First like received
Thanks, I'm testing something like this, so far so good.
It works by changing the active state of the Trap pin. Ugly, but it was the quickest way.
Of course it would be nice if it were possible to change programmatically the default parameters set by the DAVE user interface..
But you can't, for some reason they are declared const.

XMC_CCU8_SLICE_EVENT_CONFIG_t Mytrapconfig;

if (MotorStatus.PWMDisabled) return;
MotorStatus.PWMDisabled = 1;
Mytrapconfig.mapped_input = XMC_CCU8_SLICE_INPUT_A;
Mytrapconfig.edge = XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_NONE;
Mytrapconfig.level = XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW;
Mytrapconfig.duration = XMC_CCU8_SLICE_EVENT_FILTER_DISABLED;
XMC_CCU8_SLICE_ConfigureEvent(PWM_SVM_0.phase_ptr[0]->slice_ptr, XMC_CCU8_SLICE_EVENT_2,
&Mytrapconfig);
XMC_CCU8_SLICE_ConfigureEvent(PWM_SVM_0.phase_ptr[1]->slice_ptr, XMC_CCU8_SLICE_EVENT_2,
&Mytrapconfig);
XMC_CCU8_SLICE_ConfigureEvent(PWM_SVM_0.phase_ptr[2]->slice_ptr, XMC_CCU8_SLICE_EVENT_2,
&Mytrapconfig);
0 Likes