TeamOpenFIRE / OpenFIRE-Firmware

Reference firmware for the OpenFIRE project, built for the RP2040 microcontroller
GNU Lesser General Public License v2.1
53 stars 15 forks source link

[REQUEST] Enable 24MHz clock output for clocking a Wiimote camera #35

Closed Kalrkloss closed 2 weeks ago

Kalrkloss commented 2 weeks ago

In case the builder wants to use a bare Wiimote camera instead of the DF Robot camera, they need a separate 24MHz oscillator to clock the camera. The RP2040 can output a square wave on pins 21, 23, 24, and 25. See https://lorenz-ruprecht.at/docu/pico-sdk/1.4.0/html/group__hardware__clocks.html#gacc2b6fcdf0b38daf931b4ac821e1bf16

To enable a 24MHz output on pin 21, the USB clock (48MHz) can be divided by 2, using the following code: #include "hardware/clocks.h" clock_gpio_init(21, CLOCKS_CLK_GPOUT1_CTRL_AUXSRC_VALUE_CLK_USB, 2);

This is a hardware function, it only has to be initialized, no further code is necessary.

Unfortunately, pins 23, 24, and 25 are already used for internal purposes on the original Rapsi PICO board, and 21 is used for the I2C, but the Waveshare Pico Zero has them all available.

I think that this'll be useful for DIY builds, but this is on you to decide. I didn't test it, because I don't have a bare camera yet.

SeongGino commented 2 weeks ago

Duplicate of #32