8 Replies Latest reply on Nov 11, 2014 11:22 PM by dmiya

    How to properly disengage PWM ?

      I would like to disengage PWM and use the pin as a GPIO - input/output.

      How do I do that ?


           void pwm_disableChannel(UINT32 mask);

           void pwm_setReset(UINT32 mask, BOOL32 resetEnable);


      only stop the PWM locking the output on high or low level.

      The pwm_tones sample app conveniently disables the gpio output with:

           // In state 4, disable output and the PWM entirely and insert an internal pull-down on the GPIO.

           gpio_configurePin((TONES_LED1_GPIO) / 16, (TONES_LED1_GPIO) % 16, GPIO_OUTPUT_DISABLE | GPIO_PULL_DOWN, 0);


      but that is not what I want. I want to reuse this GPIO, not disable it.


      You can try to configure the pin back as gpio output with:


      but then when you try to set the level the output may get inverted depending on what level the PWM stopped at.

      So if PWM stopped at high level later when you set 0 you will get 1, when you set 1 you will get 0.

      When PWM stops at low level everything is normal.


      Any idea how to properly reconfigure the pin from PWM to gpio ?