As others have pointed out PWM is a poor idea, it is not designed to switch frequencies.
In face this could simply be implemented using timed bit banging.
In the 1970s a colleague and I used software FSK to implement 110, 300 & 1200 baud modems on a rather slow microprocessor. These worked better than the hardware FSK most users were using, and the bit changes were synchronised with the generated frequency generating fewer harmonics.
We used a CMOS buffer (with a simple RC filter) as output and as a Schmidt trigger for input.
Using the same technique (but with 4 frequencies) we achieved a reliable cassette interface at 3000 baud.
If I wanted to do on a Pico I would use PIO (this is used for NeoPixel @800kHz) although the Pico clock may be too fast for such a slow interface, but timed bit banging would be simple.
In face this could simply be implemented using timed bit banging.
In the 1970s a colleague and I used software FSK to implement 110, 300 & 1200 baud modems on a rather slow microprocessor. These worked better than the hardware FSK most users were using, and the bit changes were synchronised with the generated frequency generating fewer harmonics.
We used a CMOS buffer (with a simple RC filter) as output and as a Schmidt trigger for input.
Using the same technique (but with 4 frequencies) we achieved a reliable cassette interface at 3000 baud.
If I wanted to do on a Pico I would use PIO (this is used for NeoPixel @800kHz) although the Pico clock may be too fast for such a slow interface, but timed bit banging would be simple.
Statistics: Posted by Milliways — Fri Sep 27, 2024 12:33 am