Over the past few years I've built a few WSPR transmitters using an Arduino driving an Si5351 clock generator. They work well. I was thinking about the cheapest possible WSPR beacon transmitter and wondered if a Raspberry Pi Pico might be fast enough to toggle a pin at radio frequencies?
Although I've installed and tinkered with the native developer tools, I find the Arduino library convenient and familiar.
The Pico has an interesting capability in that you can create little I/O state machines that run on the pins to take the bit banging overhead away from the CPUs. I found a nice library called RP2040_PWM by khoih-prog.
A few lines of code showed that it could easily generate RF. I tried on 7MHz. Here it is on 3MHz:
A decent waveform! Unfortunately to generate WSPR you need to be able to generate very small frequency steps and I wasn't able to do this with the library. Despite small changes in the float value of the frequency, the actual frequency would jump in quite large steps. I wrote to the author who explained:
"That sounds interesting project, but your concern, IMHO, is more accurate than what the RP2040 can provide.
The TOP register to control PWM is only 16-bit, giving 64K resolution can't provide the 1.4648 Hz increments in MHz range (nearly 32-bit resolution)"
The more obvious approach was to test if the Arduino library had extended the existing functions to fully use the extra speed of the 2040 chip.
I tried the tone() function but it wouldn't go up as high as 20kHz. (Worked at 10kHz and I didn't try to find the actual limit).
Next was simply toggling a pin in the loop() function.
The maximum is 862kHz. If I put the toggle code in a while(1) dead loop I could squeeze 957kHz out of it.