RP2: Generating Sinewaves with PIO block - without the CPU involved... #16368
Replies: 2 comments 5 replies
-
Of course, what you really want is an inverting, virtual-ground input to an op-amp, so it is a true current-to-voltage converter (transresistance amplifier). Then, you have a nice, simple DAC, and can just use a series of power-of-two resistors to the pads. Although a real DAC would be better, this would certainly give a low component count for cases where you don't need high resolution or accuracy. |
Beta Was this translation helpful? Give feedback.
-
As well as FSK and PSK, you can futher abuse the low(er) level to do ASK... this was some experimentation with IRIG that I did today. |
Beta Was this translation helpful? Give feedback.
-
How it started:

How it ended:

So what am I doing?
Whilst looking at how I could remove some IC's from my project's custom board, I was looking how resistors could be connected in special/weird ways. I noticed that the OutputEnable can be written by the PIO blocks, and this combined with 'side-set' can mean that we can switch both the output and output enable at exactly the same way.
If you connect two resistors to two GPIO outputs and then connect the other ends together, you can (ab)use the pull-up and pull-down resistors to generate intermediate voltages; and those voltages can be 'sine like'.

In theory you can calculate the value for 'R', but brute forcing from the resistor store may be more effective... I got close with a limited supply.
Why...?
Now the PIO blocks can be used directly clocked from the division of the SYS clock, and this would also open the possibility of FSK or PSK from a bitstream sent in a FIFO.
You can have multiple PIOs 'communicating' through there out pins and IRQs, I have project where one PIO streams to a out pin, and another sync'ed PIO takes that and encodes it to (basically) manchester encoding... works really nicely AND no CPU involved. I can acutally put CPU into
lightsleep()
and have the PIOs continue their work - as long as the FIFO doesn't empty completely.Beta Was this translation helpful? Give feedback.
All reactions