The Raspberry Pi as a frequency generator
I was experimenting with the Pifm code, and wanted to know what sort of frequencies I could get from the GIPO_4 pin 7.
So I wrote some test code, the program is very simple, and only outputs a square wave. No extra things needed... BUT the frequency range is from 130 kHz to 250 MHz. I have only tested to 250 MHz, I think this is the limit. Some defines in the code for the PLL frequency are likely wrong. Missing a factor 2, anyways the calculation of the fractional divider is really close.
A free signal generator from 130 kHz to 250 MHz when you have a Pi is nice thing to have.
Compile that code with: gcc -Wall -O4 -o freq_pi freq_pi.c -std=gnu99 -lm
Install it with: sudo cp freq_pi /usr/local/sbin/
Connect your frequency counter to GPIO header pin 7.
Run it like this for 130 kHz: freq_pi -f 130000 error on my frequency counter 3 Hz.
Run it like this for 107.2 MHz: freq_pi -f 107200000 dunno the error, but it wipes out my FM station at 107.2
Run it like this for 250 MHz: freq_pi -f 25000000
Error is a few kHz on xpsa spectrum analyzer, but that could as well be the 30 kHz LO offset from the Elonics 4000 tuner..
Nice to test LC circuits, filters, and the 3.3V amplitude is more than enough for most things, will even drive 3.3V and 5 V logic.