TinyTapeout / tt-commander-app

Web app to control the Tiny Tapeout Demo board
https://commander.tinytapeout.com
Other
0 stars 3 forks source link

Clock settings: too low, turn off #11

Closed psychogenic closed 2 hours ago

psychogenic commented 1 month ago

_get_best_rp2040_freq dies badly at small frequencies

>OKfreq_req=2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 99, in set_clock_hz
File "<stdin>", line 162, in _get_best_rp2040_freq
ValueError: Requested frequency too low
> set_clock_hz(10)

Could hide that, or trap it and display.

More importantly, turning the clock off works fine by setting the frequency to 0 but this isn't overly obvious. A button, or just an "OFF" preset.

urish commented 1 month ago

Yeah, if we add a way to disable the clock, we can set the minimum frequency to "3", so you are not able to input a too-low value.

An alternative would be to use a micropython timer instead of PWM to generate the slower clock - or - maybe to slow down the system clock even further to allow PWM to go down to 1 Hz?

urish commented 1 month ago

Quick experimentation shows that slowing the system clock down to 33 MHz (which is needed for 2 Hz PWM frequency) makes the USB connection unreliable. That leaves us with either timers, or disallowing slower (< 3 Hz) frequencies altogether.

psychogenic commented 1 month ago

Oh, is the lower limit 4Hz? Frankly I think down there we can say: hey yo, press the button.

urish commented 1 month ago

The lower limit is 2.86 Hz (which we market as 3 Hz). That is 48 MHz clock divided by (2²⁴-1)

urish commented 2 hours ago

Fixed by 71ec63d422ec2aae9b3277594c2e23b51874a09e - we can now set the clock to lower frequencies, such as 1 or 2 Hz.