How to remove PWM signal from the pin?

Dystman
Posts: 3
Joined: Wed Apr 17, 2019 12:29 pm

How to remove PWM signal from the pin?

Postby Dystman » Wed Apr 17, 2019 12:44 pm

Hello! I'm working with several digital servomotors and I need to deal with overload situation. In case when my servomotor stays in overload state for too long I need to turn off the servomotor. I don't want to power off them so I'm looking for a function to turn off PWM signal.

Currently, I'm using mcpwm_gpio_init() and mcpwm_init() functions. But i cant find deinit functions.

I've searched deeper and find out, that there are functions gpio_matrix_out and gpio_matrix_in which, on my thoughts, do the mapping of MCPWM unit to certain GPIO. But I've bumped into some signalIdx parameter which I do not understand.

Can you help me please not to burn all my servomotors? ))

username
Posts: 539
Joined: Thu May 03, 2018 1:18 pm

Re: How to remove PWM signal from the pin?

Postby username » Thu Apr 18, 2019 2:16 am

you dont need to de-init the pin. just set the PWM to 0.

Dystman
Posts: 3
Joined: Wed Apr 17, 2019 12:29 pm

Re: How to remove PWM signal from the pin?

Postby Dystman » Thu Apr 18, 2019 10:57 am

username wrote:
Thu Apr 18, 2019 2:16 am
you dont need to de-init the pin. just set the PWM to 0.
Thanks for answering, username!

I was trying to do this also, but functions mcpwm_set_duty_in_us, mcpwm_set_signal_low and several others do not work properly. PWM signal still present on GPIO. Can you show me the function to switch it off?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: How to remove PWM signal from the pin?

Postby ESP_Sprite » Fri Apr 19, 2019 2:38 am

It may be useful to figure out why the mcpwm functions don't do what you expect, but to answer your initial question: you can use gpio_reset_pin() to disconnect a GPIO from a peripheral.

Dystman
Posts: 3
Joined: Wed Apr 17, 2019 12:29 pm

Re: How to remove PWM signal from the pin?

Postby Dystman » Mon Apr 22, 2019 3:14 pm

Thanx for helping!

Who is online

Users browsing this forum: No registered users and 124 guests