by TaylorAlexander · 2y ago · 0 comments
But this isn’t about running doom. Any beginner that tries to use this system runs the risk of importing a library that carelessly consumes half their ram. If they want to use an I2C sensor with a specialized library, the random person on GitHub who wrote that library might not have optimized their code. If someone sees this board and wants to try it because it looks cute, it’s worth warning them that they’re buying a chip with a 20 year old architecture and extremely limited capabilities.
The flew astronauts to the moon on machines with hand wired magnetic RAM. But if you can get a modern architecture with 264k of RAM for $5, it’s worth warning people that they’re looking at something that is extremely limited compared to other options.
I also have some Twitter followers that seem to love micropython. You can’t even run micropython on attiny because of insufficient RAM. https://forum.micropython.org/viewtopic.php?t=9102
Or let’s say someone wants to run a rainbow pattern on an LED strip. Let’s say they’re using the SK6812 LEDs which are 21 bits per pixel. Let’s also say the rest of their code uses zero bytes of ram and the library is perfectly efficient. Well I hope they don’t try to control a light strip with more than 83 LEDs on it! That would consume all the RAM. If they get a high density LED strip with 244 LEDs per meter, then 83 LEDs represents a 34 centimeter long section of that strip. That’s 13 inches.
People do lots of things with microcontrollers these days, and RAM is cheap and plentiful on modern chips.
They aren’t trying to create something better or more capable, they are just making a riff/tribute of what is almost certainly the worlds most popular embedded learning tool.
Why do you need to store the pattern in RAM at all?
I would compute the next RGB and shift it out one LED at a time. Maybe you were thinking of using DMA for some async work?
Of course a skilled engineer could write a tight output loop that computes and outputs every value on the fly with a guarantee that the time budget won't be exceeded, but your average Arduino user probably doesn't have the knowledge to do this. So all the control libraries that I know allocate a memory buffer for the whole output stream and let the user update it whenever they want.
That’s how the popular libraries do it. Not strictly necessary but the whole point of my warning was to make sure any beginners who saw this understood that this board has serious limitations compared to other options.