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

cross mob
User16898
Level 4
Level 4
Hi,
is this possible to deinit particular modules ?
In my application there is demand for single pin to work in 2 modes, digital output and PWM (changeable in runtime).
I found that when I configure PWM signal on this pin and then I want to use digital output I cannot do this.
PWM set to mode_off hold constantly hold the line at one level that cannot be changed by Set/reset pin state functions.
Is there possibility to completely turn off PWM module, not only stop it ?
I couldn't find any iLLD functions for deiniting modules.

I work with Tc222L.
0 Likes
2 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
If you want to change an output back to GPIO, you can set its IOCR register from an alternate output function (>=1) back to GPIO (0).

For example, for pin 65 / P15.5:
P15_IOCR4.B.PC5 = 0x11;   // see datasheet: O1 = TOM0_0, push pull
// ...do PWM stuff

P15_IOCR4.B.PC5 = 0x10; // see datasheet: O0 = P15.5 general purpose output, push pull
// ...do GPIO stuff


That way, the PWM module can keep running, but its output is not connected to an output port.

If instead you deinitialize whichever peripheral is driving the PWM output, the output will go low and stay low. You'd still have to switch it to a GPIO to be able to control it.
0 Likes
User16898
Level 4
Level 4
Uc_wragner thanks for quick response.
That helps a lot.
0 Likes