Warning - overclocked CPU and I2C
This sketch pushes the hardware beyond typical defaults:
- CPU: 200 MHz via
set_sys_clock_khz(200000, true)insetup1()on core 1 (above the default system clock). - I2C: 2 MHz via
#define I2C_CLOCK_HZ 2000000andi2c_init(OLED_I2C, I2C_CLOCK_HZ). Many SSD1306 modules and wiring setups are rated for 400 kHz (I2C Fast mode) or lower. Running I2C faster can cause garbled displays, missed updates, or bus errors, especially with long wires or weak pull-ups.
Use at your own risk. If anything looks unstable, revert one or both settings below.
To run at default/safer settings
- Open
Hello-world-plus-3D.ino. - CPU - find
setup1()(near the top of the file, after the display driver class). Delete or comment out:set_sys_clock_khz(200000, true); - I2C - near the top
#defineblock, change the bus speed to a standard rate, for example:
(#define I2C_CLOCK_HZ 400000400000= 400 kHz Fast mode;100000= 100 kHz Standard mode if your module still misbehaves.) - Optional cleanup: if you also remove the commented
vreg_set_voltage(...)line, you can delete these includes if nothing else needs them:#include "hardware/vreg.h" #include "hardware/clocks.h" - Leave
setup1()/loop1()in place - core 1 still updateslissa_phasefor the Lissajous animation.
Re-upload the sketch after editing. Animations may run slower at the default CPU clock; that is expected. Lower I2C speed may also reduce frame rate but should improve reliability.
Hardware
| Item | Detail |
|---|---|
| MCU | RP2350 |
| Display | SSD1306, 128×64, I2C address 0x3C |
| I2C port | i2c0 |
| SDA | GPIO 0 |
| SCL | GPIO 1 |
Software
- Arduino-Pico board support (RP2350)
- Adafruit GFX Library
- Adafruit SSD1306 Library
Open Hello-world-plus-3D.ino in the Arduino IDE (folder name must match the .ino filename).
GitHub Actions compiles this sketch on every push to master (compile check only; does not upload to the board).