top | item 25182837

(no title)

dirtypersian | 5 years ago

Curious question, is it just I2S that is used for this purpose? I'd assume you could use any serial protocol for bit banging purposes right?

discuss

order

jws|5 years ago

I use the RMT (Remote Control) devices of the ESP32 from FreeRTOS for this. They were intended for generating on-off-keying of carrier modulated wave forms to blink an IR LED for a remote control.

If you leave off the carrier modulation you end up just specifying a list of on and off times and get absolutely rock solid waveforms in hardware.

There's a bunch of them, I forget, maybe 8? So you can drive a bunch of chains at once.

You can also use these for rock solid reading of input signals too. Say you have a weather station that sends some god awful protocol up a wire at you… you just collect a list of the high and low times and get notified when it stops wiggling the signal. Then you sort out the data from the transmission. The timing might be way off because it's cold and the sender's electronics are really cheap, but you can analyze the signal and see what they meant.

elcritch|5 years ago

That’s handy sounding. There’s some use cases I was thinking about needing to read in high speed IO lines, above 1Mhz. SPI has odd timing requirements. Can you point to example code for this technique, or is it just a matter of using(abusing) the i2s library? And the horrible wire protocol is all too common.

janekm|5 years ago

I hadn't looked at the RMT peripheral before... Based on what you describe and from a quick skim of the documentation this also seems perfect for a simple logic analyzer!

andrewshadura|5 years ago

I used SPI to generate analog video signal (with extra hardware, of course).