-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
The code here: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/blob/main/examples/pioasm_hello.py#L30 which is embedded in this guide page: https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython/using-pio-to-turn-an-led-on-and-off
Creates a StateMachine with frequency 2000
. When I run this code on a Pico w/ 10.0.0-beta.0 it raises this error: ValueError: frequency out of range
In testing a few values it seems that 4000
is the minimum accepted value.
I can update the example code to get it back to working if this change was intentional. But I'm not sure if this was intentional or not, so am opening the issue here to get more input on that.
I found information online (https://www.bisonacademy.com/ECE476/Lectures/29%20PIO%20State%20Machines.pdf) indicating the valid range is 2k - 125k which seems to match the lower end value of 2000
originally used by the basic example

I also noticed that if I use frequency=0
the code prints real frequency 252000000
which is basically 2x the 125k listed as the top of end of the valid range. So perhaps there is some multiplier taking effect on the valid range? Maybe this is the tied to RPi specifying the chip was usable at higher CPU frequencies earlier this year?
In any case, if this change is intentional we can close this and I'll update the learn code use 4000
so that it runs.