Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting cpu frequency below 80 Mhz messes up the serial console. #9975

Open
0wwafa opened this issue Jan 18, 2025 · 5 comments
Open

Setting cpu frequency below 80 Mhz messes up the serial console. #9975

0wwafa opened this issue Jan 18, 2025 · 5 comments
Labels
Milestone

Comments

@0wwafa
Copy link

0wwafa commented Jan 18, 2025

At first I thought it crashed.. instead it's just the serial console messed up.

Adafruit CircuitPython 9.2.2-14-gab5c17d864 on 2025-01-16; Ai Thinker ESP32-CAM with ESP32
Board ID:ai-thinker-esp32-cam

>>> import microcontroller
>>> microcontroller.cpu.frequency
240000000
>>> microcontroller.cpu.frequency=120000000
>>> microcontroller.cpu.frequency=80000000
>>>
>>> microcontroller.cpu.frequency=20000000
▒▒▒▒▒▒▒

Same happens if you set 40 Mhz

>>> import microcontroller
>>> microcontroller.cpu.frequency
240000000
>>> microcontroller.cpu.frequency=120000000
>>> microcontroller.cpu.frequency=80000000
>>>
>>> microcontroller.cpu.frequency=40000000
▒

@dhalbert dhalbert added this to the Support milestone Jan 18, 2025
@dhalbert
Copy link
Collaborator

This is a "beware of the consequences" thing. As mentioned in https://docs.circuitpython.org/en/latest/shared-bindings/microcontroller/index.html#microcontroller.Processor.frequency:

Warning

Changing the frequency may cause issues with other subsystems, such as USB, PWM, and PIO. To minimize issues, set the CPU frequency before initializing other systems.

Also discussed in the original PR, #9342.

@0wwafa
Copy link
Author

0wwafa commented Jan 18, 2025

This is a "beware of the consequences" thing.

Consequences of installing circuitpython?

Because this does not happen in micropython :P

@dhalbert dhalbert modified the milestones: Support, Long term Jan 18, 2025
@dhalbert dhalbert added the esp32 label Jan 18, 2025
@dhalbert
Copy link
Collaborator

MicroPython, even the latest preview build does work with 20 MHz on an identical ESP32 board (I tested with Feather ESP32 V2 and HUZZAH32.

The frequency setting logic is functionally identical in MicroPython and CircuitPython, so it may have to do with how the UART is set up.

@dhalbert
Copy link
Collaborator

Consequences of installing circuitpython?

Because this does not happen in micropython :P

Please don´t be snarky. If you have information that it does work in MicroPython, please post that up front.

@0wwafa
Copy link
Author

0wwafa commented Jan 19, 2025

Consequences of installing circuitpython?
Because this does not happen in micropython :P

Please don´t be snarky. If you have information that it does work in MicroPython, please post that up front.

I did not mean to be. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants