PWMSP002 : Output pins do not return to passive level when the App is stopped

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

cross mob
Not applicable
Before starting the PWMSP002 App with API call 'PWMSP002_Start', the direct and inverted output pins sit in the 'Passive Level state (in my case low).

When I stop the PWMSP002 App with API call 'PWMSP002_Stop' the direct and inverted output pins remain in their last known state which I believe is dependent on the timer value and compare register. In my case the outputs remain high which is not desirable.

Is there a method for stopping the PWM and ensuring the outputs return to their 'Passive level' states ?

I am considering making and breaking the signal connections in code instead of fixing them using the App configuration tab so I can reset the output pins directly from code once I have stopped the Apps but I would rather use API calls if possible.

Any help would be greatly appreciated.

Best regards
Aaron
0 Likes
9 Replies
Not applicable
I have found that the 'PWMSP002_Stop()' function resets the PWM timer to zero. This has the effect of leaving the output pin in the Non passive level if the passive state is configured to occur 'After Compare match' (assuming the compare register is greater than zero which is the case for anything but 0% DutyCycle).

My feeling is the 'PWMSP002_Stop()' function should not reset the PWM timer to zero as this can be done with the 'PWMSP002_SetTimerVal() function before starting the timer with the 'PWMSP002_Start()' function.

If anyone knows of a workaround I would really appreciate it.

Best regards
Aaron
0 Likes
Not applicable
Hi Aaron, I'm concerned with this kind of problem too. I use CCUST01_Start() and CCUST01_Stop() to start and stop synchronously 4 pwm, but some outputs stay in the active level after being stopped, and that's not nice!...I started last week with Infineon XMC4500, so I'm completely new to this kind of processor...I'm waiting for some suggestion, since my FAE is on holiday!...
I agree with you, the stop function resets the timer to zero, so we do not have control on the outputs levels, but a way must exist to force the outputs low. With Texas DSPs I stop the pwm by putting them in high impedence state, like a sw-forced trap feature, is there something similar with XMC4000?
I hope some suggestions come soon 🙂

samuele
0 Likes
Not applicable
Hi Samuele,

After 2 days of trying all possible combinations of API function calls I believe I have found a workaround using the GPIO_144.h macros to configure and control I/O pins. You will find GPIO_144.h in some DAVE examples.

  • My PWMSP002 'direct output' signal is configured to be connected to pin P0.6 from the 'Signal Connection' dialog.
  • At the point I want the output pin to be left in a particular state, I re-configure the I/O pin to be a general purpose output pin and set it's output state using a GPIO_144.h macro call.
  • Then I stop the PWMSP002 app
  • Immediately after re-starting the PWMSP002 app I re-configure the pin to be connected to the PWMSP002 direct output signal again
Have a look at table 25.10.1 in the xmc4500_rm_v1+2_2012_12_.pdf manual. You will see pin P0.6 has an alternative (ALT3) function which allows it to be connected to CCU8 OUT30 (which is what PWMSP002 uses as it's direct output).

I have partially tested this workaround and it is looking good so far. Here is my code...

Stopping PWM

    // Set output pin low and disconnect from PWMSP002 app.
// This is essential as stopping PWM apps leaves pins in undefined state, typically high
P0_6_reset();


// Disconnect output pin from PWMSP002 app
P0_6_set_mode(OUTPUT_PP_GP);


// Stop PWM
PWMSP002_Stop(&PWMSP002_Handle3);


Starting PWM


    // Start PWM
PWMSP002_Start(&PWMSP002_Handle3);


// Connect output pin to PWMSP002 app
P0_6_set_mode(OUTPUT_PP_AF3); // Alternative function 3 (ALT3) configuration




I hope this helps
Best regards
Aaron
0 Likes
Not applicable
Hi Samuele,

I have carried out further tests. The workaround works well. I would however like to see a solution within the APP's.

Best regards
Aaron
0 Likes
Not applicable
thanks Aaron,
I've never considered doing like this, but I think I'll try as you suggest. Anyway, I cannot find GPIO_144.h in the projects, can you tell me where it is located?
thank U
samuele
0 Likes
Not applicable
Hi Samuele,

File attached for the xmc4500. I am using the 100 pin device but I use the 144 pin header file so I can also run my code on the Infineon hexagon kit which has a 144 pin device.



Best regards
Aaron
0 Likes
Not applicable
thanks again Aaron, this afternoon I'm going to try...

Should I find other solutions I'll share them in the forum 🙂

samuele
0 Likes
Not applicable
it works good 🙂
thank you!
samuele
0 Likes
Yalcin_Haksoz
Level 2
Level 2
First like received 10 replies posted 10 questions asked
I am new to XMC and DAVE. I came across to this problem when working on some examples.
I would like to know if there is a solution to this problem within the app now. Or, is the method offered here still the only solution after 7 years?
Thank you.
0 Likes