PWM and Pins

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Mikado
Posts: 4
Joined: Thu Jul 14, 2016 12:44 am

PWM and Pins

Post by Mikado » Thu Jul 14, 2016 1:04 am

Please need help,

I'm new to Micropython, (although I have made python scripts some times, mostly for electronics) using the CC3200 port on a Ti LaunchXL board, my question is:
How is related the creation of a timer in PWM mode and the pin is supposed to be driven by this PWM output?

e.g.
pw_1=Pin('GP11',mode=Pin.ALT,alt=3)
pw_ltimer=Timer(2,mode=Timer.PWM)
a_channel=pw_timer.channel(Timer.B,freq=12,duty_cycle=15)

I can not see how is related the pin with the timer referenced in the channel definition.

any help or guidance will be greatly appreciated.

Junior Vargas.-

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PWM and Pins

Post by dhylands » Thu Jul 14, 2016 3:43 pm

Usually the relationship is defined in how the hardware is wired up. There often isn't any obvious relationship, and consulting the datasheet is the way to figure things out if it isn't documented elsewhere.

Mikado
Posts: 4
Joined: Thu Jul 14, 2016 12:44 am

Re: PWM and Pins

Post by Mikado » Thu Jul 14, 2016 6:08 pm

Hi Dave,

thanx a lot, your fast guidance got me to the answer (on the datasheet), I was not clear about.
May I have another question:
How can I disable the heartbeat for my cc3200-Launchxl board (and the thing can't come to live after a cold reset), cause I'm planning to tie an IR LED and driving circuitry there and a fixed logical 1 (or too long) surely will burn it, the manual from wipy or pyboard is not working in my case.
That is, I think is the only pin (tied to the red LED) that can be used with no worry (on the actual hardware) for my PWM, at least at the moment.
e.g.
wipy.heartbeat(False) # disable the heartbeat LED
# Not working for me.

Thanx in advance ..
Junior Vargas

Neil
Posts: 15
Joined: Tue Jul 14, 2015 8:51 pm

Re: PWM and Pins

Post by Neil » Fri Jul 15, 2016 7:52 am

Although your board isn;t a Wipy I beleive as it is the same chip that the wipy module is enabled in the build. In which case the command below maybe what you want.
wipy – WiPy specific features
The wipy module contains functions to control specific features of the WiPy, such as the heartbeat LED.

Functions
wipy.heartbeat([enable])
Get or set the state (enabled or disabled) of the heartbeat LED. Accepts and returns boolean values (True or False).

Mikado
Posts: 4
Joined: Thu Jul 14, 2016 12:44 am

Re: PWM and Pins

Post by Mikado » Fri Jul 15, 2016 1:33 pm

Thanx Neil,

really the image I have compiled came from a different tree than the Wipy, the former was from the CC3200, apparently not all things are in place at this development stage.
I will try the real Wipy (binary or source compiled) version, this could be a remedy.

Thanx a lot.

Junior Vargas.-

Post Reply