Clock around the GPIOs

No need for an external crystal, one can use the GPIOs of the Raspberry Pi to generate a clock signal. The library wiring makes it easy and accessible.

Wiring for the Raspberry Pi was written by Gordon Henderson.

Install Wiring

In the terminal:

 $ sudo apt-get install wiringpi

For the Raspberry Pi 4 one needs to update the WiringPi to version 2.52:

 $ cd /tmp
 $ wget
 $ sudo dpkg -i wiringpi-latest.deb

Clock the Pin

The clock frequency is derived from the 19.2MHz Raspberry Pi clock. One can use GPIO 4 (pin7), GPIO 5 and GPIO 6.
2.4Mhz would be 2400000

Terminal example:

 $ gpio mode 7 clock
 $ gpio clock 7 2400000

Or in C:

 pinMode (pin, GPIO_CLOCK) ;
 gpioClockSet (pin, frequency) ;


graphic by
License: CC BY-NC-SA 3.0 DE