arduino / arduino/ArduinoCore-mbed

Low Power Examples for Pico - Reinit Serial and USB?

Open
#513 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
411
Forks
225
PR merge metrics
No merged PRs in 30d

Description

I've been trying to port some low power examples from the Pi Pico SDK so they will run using the Arduino Core. https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__clocks.html
So far I've got blink successfully working at a variety of clock speeds.

However, the USB and UART serial ports no longer seem to work at the changed clock speed.

Is there an API call in ArduinoCore to re-initialise these or is there some other way to tell the ports they have a new clock speed?

Example code demonstrating the issue
[Clock48Mhz.h](https://github.com/Workshopshed/PiPico/blob/main/Clock48Mhz/Clock48Mhz.h)

```
#include "Clock48Mhz.h"

void setup() {
// Configure for lower power usage
set_sys_clock_48mhz();

Serial.begin(9600); //USB Serial

while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial1.begin(115200); //UART0 on pins 0 and 1
Serial.println("Serial Tester");
}

void loop() {
if(Serial1.available()){
Serial.print((char) Serial1.read());
}
if(Serial.available()){
Serial1.print((char) Serial.read());
}
delay(1);
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Clock48Mhz.h example and reproduce the USB Serial and Serial1 failures after set_sys_clock_48mhz(). Read the ArduinoCore-mbed clock, USB, and UART initialization entry points to determine whether an existing reinitialization API is expected. Done means documenting or implementing a supported way for both ports to work after the clock change.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.