Timer frequency minimum is 5 Hz?

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
Saran
Posts: 17
Joined: Thu May 28, 2015 6:52 pm

Timer frequency minimum is 5 Hz?

Post by Saran » Fri Oct 16, 2015 8:26 am

Hi,

>>> from machine import Pin
>>> from machine import Timer
>>>
>>> tim = Timer(1, mode=Timer.PERIODIC)
>>> tim_a = tim.channel(Timer.A, freq=4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid argument(s) value

>>> tim_a = tim.channel(Timer.A, freq=5)
>>>

So, it's impossible to set frequency to a number lower than 5 (Hz). Is that really a feature?


Docs:
https://github.com/micropython/micropyt ... imer-class

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

Re: Timer frequency minimum is 5 Hz?

Post by dhylands » Fri Oct 16, 2015 8:36 am

I'm not familiar with the HW, but it may just be a limitation due to the source frequency, prescaler, and timer width.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Timer frequency minimum is 5 Hz?

Post by danicampora » Fri Oct 16, 2015 11:03 am

Probably the timer width need to be set to 32 bit. I am working on the docs, will push later today. BTW, timers, are not fully tested because that part of the API wasn't clear yet, so don't expect everything to work there. It sucks, I know, hope to address it soon.

Saran
Posts: 17
Joined: Thu May 28, 2015 6:52 pm

Re: Timer frequency minimum is 5 Hz?

Post by Saran » Fri Oct 16, 2015 7:31 pm

No prob. I'll use sleep in the meantime...

Post Reply