i2c OLED with only 128 bytes of RAM? No problem!

A project log for 65uino

6502 based learning in a familiar form factor

anders-nielsenAnders Nielsen 04/17/2023 at 08:400 Comments

I've had about a week and a half to play with the board, and wow have I played!

Overall I'm super happy with the design, the limitations, and also that I've managed to pick up steam on the project. 

Luckily I had the camera running when I put together the first board, so that turned into a nice little short on YouTube. 

I also had some time over the recent holidays to play a bit with my i2c bitbanging routine from my #ABN6502 SBC R1 project. For some reason I had to turn up the display clock to get a reasonable refresh rate.
Of course the 128 bytes of RAM in the 6532 RIOT won't fit the 128x64 pixel framebuffer for an OLED but thankfully the SSD1306 comes with a builtin framebuffer, so all I need to display text is to have the font in ROM and ship out the individual characters. 

Since the available ROM size of 4096 might be a limiting factor in a lot of projects too, I decided to optimize for size, so I used a 5x7 font, and limited it to characters 0x20-0x7f = 5*95 bytes = 475 out of 4096 bytes used for the font. 

Speaking of i2c, bitbanging the display on a 1MHz CPU clock isn't exactly groundbreaking speeds, but it's plenty fast for text display. After a bit of assembly optimization I managed to get it up to around 32kHz i2c clock. I'm pretty sure the 6507 can handle 2 MHz, which would double how fast the display can be written, but for now I think it's decent. 

I have a bit of cleaning up to do in the code before I publish to Github but it should get there in the next 24 hours. Soon I'll also be making a video about how bitbanging i2c from a 6502 (*6507) running at 5V to a 3v3 device works, but that might take a bit to make.