Hacker News new | ask | show | jobs
by nigrioid 1404 days ago
cnlohr did something similar with an ATTiny85:

https://www.youtube.com/watch?v=mwcvElQS-hM https://www.youtube.com/watch?v=m4f4OzEyueg&t=0s

Pretty amazing!

2 comments

Igor Cesko did probably the first widely-known implementation of bit-banged 10BASE-T, in 2004:

https://web.archive.org/web/20110312185808/http://members.ch...

Although, one should note that both Igor & Charles did that purely in software, while OP's project is using PIO machinery, so it's strictly speaking not the same thing.

Back in 1999 we built a 100% bit-banged software implementation of 10BASE-T including all of the stack up to UDP & TCP. It was a demonstration project to show off the performance of the 50MHz/50MIPS Scenix microcontroller.

By the time it was commercialized in 2001 the PHY had moved into hardware, but the Ethernet MAC functionality was still software.

https://www.ic72.com/pdf_file/i/428749.pdf

It is funny to see now that we named the chip IP2022 ... IIRC I don't think we were thinking that it was so futuristic it represented what the year 2022 would look like.

Doing it on a ATTiny85 is a lot more impressing than doing it on a "larger" microcontroller :)
In some ways it is less though, as the larger CPU on the pi has things like cache that mess with your timing, while with the smaller CPUs you can lookup exactly how long each instruction will take and thus get the timing right. In the end though, both are very impressive, the hardware just gives different challenges to work with.

edit, reading more I realized the pi pico isn't doing this on the main cpu, but on the PIC (which isn't on a normal pi I think). I have no idea what that is able to do, but it changes the above.

> with the smaller CPUs you can lookup exactly how long each instruction will take and thus get the timing right

Reminds me of the good old demo scene hack to get 18-bit color[1] back in the VGA days (and probably earlier) by changing the color palette per pixel through careful timing of the instructions.

IIRC you ignore the pixel values entirely, writing effectively a single "color", ie palette index, and then just change that single palette entry per pixel, timed so it's ready just when the output DAC is clocked to the next pixel.

edit: I forgot which demos I've seen this effect in, but searching for it led me down a marvelous rabbit hole where I stumbled over someone[2] managed[3] to get 1k colors over CGA[4], apparently discussed here[5] a couple of years ago.

[1]: https://en.wikipedia.org/wiki/Video_Graphics_Array#Color_pal...

[2]: https://int10h.org/blog/2015/04/cga-in-1024-colors-new-mode-...

[3]: https://www.reenigne.org/blog/1k-colours-on-cga-how-its-done...

[4]: https://en.wikipedia.org/wiki/Color_Graphics_Adapter

[5]: https://news.ycombinator.com/item?id=21992870

I think you're confused. This is on a Raspberry Pi Pico, which is a microcontroller and has no cache.
It's still a hell of a lot more powerful than an attiny85 though which is only an 8 pin micro for the smallest stuff. I love those little things and I used them all the time until most stuff became connected and the esp8266 was more useful because of its wi-fi.