Brad Ormand Moon Painting Base with Plaster

10.28.2014 – SSD1306 & Moon Painting

Last night, I fixed a few more flaws with my SSD1306 driver. Before, the setPixel function found the active bit in the page row and just used SPI to write that single updated byte straight to the front buffer. Welllll.. As I suspected, before, I’d have to make my back buffer more active for that functionality when things got more complex, because I did get major flicker at 30fps, even just updating about 1/3 of the screen that way. It was sending data as fast as possible (~10kHz?), and it was just the wrong way – the system struggled. So… I just worked the back buffer in, in whole, and took the approach of throwing the display RAM the whole frame, but in slower intervals – 30 Hz. That worked so well – the system sings like that. Sooo nice. …That display is nice.

I found a critical RAM page-updating bug in my buffer code as well. It took me a million years to find it. But, by testing and actually using the display itself for debug info (awesome, that’s one of the reasons I’m developing on it, aside from animation), I found a pointer that was setting it’s contents and decrementing like:
*ptr- – = x;
when it shoulda have been decrementing first like:
*- -ptr = x;
Those are hard to find, and I can see how it could be an easy thing to misconfigure.

Sooo, after a few bug fixes and improvements, I wrote all kinds of animations! Finally! I enjoyed it. That’s what my first goal was with the display. I made it rain, bounced particles off the display bounds, made a snake trail – ahhh – I finally feel like a specific project has been started.

Screen Shot 2014-10-31 at 7.51.56 PM Screen Shot 2014-10-31 at 7.51.30 PM

Another difficulty: I pushed the ATMega328 to the limits several times. A few times, I overflowed the stack, or I assume so, since the whole system and peripherals went haywire LOL. I was trying to do particle animations with as many particles as possible, and I maxed at 128 (as opposed to the next step, 256, which crashed it).  Went back to something lower, and it would perform fine again. Each particle has an associated struct of pretty good size for an MCU, with signed ints and a float or 2 (each), for physics calculations, updating every frame.

And, there’s only 2k of SRAM to work with.  I don’t want to store all that in ProgMem, really. I wanna store it in SRAM – wahh, waah for me, cry, cry, I’m crying facetiously… Ha. I do want the “luxury” of 8k of RAM, though, at least – haha.  I like generating certain data by algorithm at runtime instead storing it in tables, and I like 16-bit ints and floats, but it’s a luxury for this type of stuff, I guess… Oh well. If I were really concerned and had to tighten up, I’d make it lean and make it work, get hardcore and just make it happen. But, actually… I’m just going to get an MCU with a bit more RAM and speed for my future animation and audio projects. I’m looking at the TI MSP430 (especially the MSP430 F6659), and a few more that I have had my eye on, like the ARM Cortex M4’s @ 60MHz+ and plenty RAM, and I researched the AD Blackfin (yummy, but overkill for now).

I have that color TFT and another RGB display that will need a lot more power/speed/Mem to drive as well – plus I gotta have CPU cycles and room for the DSP audio stuff, as well for those projects. And, plus, I wanted to implement some 3D stuff too – at least with wireframe or flat shading.  Gosh, and I kind of wanna stick with one toolchain for a while… So, I’m investigating… However, I’ll use what I have been using for a while, as well, until I have some other drivers written and have taken care of the current projects.


In other news, I got that moon crater painting started! It looks dope! Right now, it’s just plaster and canvas, and after it dries and when I have some time and inspiration, I’ll start painting it up. I have no idea what I’m going to do. A lot of it is just improv – I’m just making it up as I grab more plaster, and putting it down and molding it. And, I’ll do the same with the paint. All I know now is that I want desaturated grey/blue/green, and that I’m gonna highlight with bright green or blue – and that I want to mold or paint some ridges in there between the craters. Fun stuff. No deadlines, no pressure, just inspiration, action, more inspiration comes… The engine goes.

One thought on “10.28.2014 – SSD1306 & Moon Painting”

Comments are closed.