Inverting 2.42inch oled screen for diy arduboy

Hi all,

Is it possible through code to invert the screen on the following OLED display:

Basically, the case I am designing would work better if I was able to mount the screen upside down.

Also, I am wondering if using this module as a flash for a DIY arduboy?

Module:
https://abra-electronics.com/wireless/gps/modules/mod-w25q128-norflash-128mbit-flash-memory-spi-interface-control-storage-module.html

Thanks

:slight_smile:

As you will be using a custom library - or at the least Mr.Blinky’s libraries - you can simply change the rendering code to render from the bottom up instead of top down.

1 Like

While that would technically work, the screen linked to claims to be a regular SSD1309,
and if that’s the case then there’s actually a much simpler way to invert it.

Looking at the datasheet:

Based on the diagrams on page 42 and 43, it seems that the “Set COM Output Scan Direction” command (either 0xC0 or 0xC8) will invert the order in which the data is displayed on the screen.

So all you’d have to do, @ewhizz, is to insert that command into the screen boot sequence (Arduboy2Core::lcdBootProgram), or if either 0xC0 or 0xC8 is already present, simply replace it with the command you need.

Do you know which port of the Arduboy2 library you’ll need to use yet?


I know that with an SSD1306 it’s possible to invert both the vertical and horizontal axis because a long time ago when I was writing a port of Arduboy2 for a different console I discovered that Arduboy2 does actually provide flipVertical and flipHorizontal functions, so I had to work out how those function so I could port them.

I can’t remember which way around it is, but one works based on the data already sent to the screen and the other actually won’t do anything until you send another frame of data to the display. That’s unlikely to matter in 99% of circumstances, but it’s worth noting just because it’s somewhat surprising.

Note that the source for flipVertical reveals that OLED_VERTICAL_FLIPPED is 0xC0 and OLED_VERTICAL_NORMAL is 0xC8, so SSD1306 clearly shares those two commands with SSD1309.

Since 0xC8 is included in the screen boot sequence, I’m not sure whether that means that the Arduboy’s screen is actually ‘upside down’ as well.

2 Likes

Hi okay its good to know that it is possible!

I am unsure which ArduBoy2 port I will be using at this stage.

I was wondering if you had any idea about the serial flash module I linked? Could it be wired as a flash cart?

Thanks :))

1 Like

It should work fine.

1 Like

Great! I am unsure how to wire it up though. This module has 6 pins out:
D1
CLK
GND
D0
CS
VCC

If you could point me in the right direction that would be greatly apprecited.

Thanks :slight_smile:

Hi,

I read through this forum post and am still unsure how to wire it up. Looking to prototype it on a breadboard. Do I need to purchase another part despite the one I just linked or can I wire this chip to a Pro Micro and have it work?

Thank you

:slight_smile:

If you’re going to be running the Pro Micro at 5V, then you should probably include the level shifting circuitry described. Or, if you want to risk running the flash chip directly from 5V, even thought the specifications give an absolute maximum voltage rating of 4.6V, you can use the lite version wiring.

1 Like

How about if I use a 3.3V version of a Pro Micro?

For the breadboarding test ill power the flash module from a separate power source.
My understanding of the wiring between the module and the pro micro would be this:

Is that correct?
Thanks!!

The 3.3V Pro Micro runs at 8MHz instead of the 5V version’s (and Arduboy’s) 16MHz. Some games will run too slow at that speed.

You could run a 5V Pro Micro at a lower voltage. The Arduboy runs at the raw battery voltage, between about 3.2 and 4.2V. This would be safer for a directly wired flash chip.

If you power the flash chip from 3.3V, you can’t have 5V outputs from the Pro Micro going directly to flash chip inputs (DI, CLK, CS). That’s what the level shifter circuitry is for.

1 Like

Hi okay,
So is there a way I can do it without the level shifter?
I found this example which seems to not include one.
https://www.pcbway.com/project/shareproject/Quagguino__arduboy_clone_with_flash_memory_support_.html

Thanks

Without a schematic, it’s hard to say what it’s doing. My guess is it’s wiring directly between the Pro Mico and the flash chip, like the lite version wiring. As I said previously, if you’re comfortable running a 3.3V flash chip at 5V, which is above its 4.6V absolute maximum, then go for it.

1 Like

Hi,
There is a 10K resistor between VCC 5V and the CS pins of the flash module.
I am a little lost about the wiring when burning the bootloader, I am using another Arduino (nano) as the programmer and am not sure how to hook it up exactly.

Any assistance would be appreciated,

Thanks

If you’re breadboarding just leave the flash chip out of the circuit when burning the bootloader. However, having the flash chip wired in shouldn’t cause any problems.

The 10k resistor is to pull up chip select in case the signal that controls it (RX or SDA) is set as an input. Since both these pins will be inputs when burning a bootloader, the resistor will pull up CS, thus disabling the flash chip so it won’t interfere with the burning process.

With the flash chip either in or out, just follow the normal instructions for wiring the programmer and burning a bootloader.

1 Like

Hi Yes,

but I am unsure where to find the normal instructions for wiring the programmer and burning the bootloader.
Could you share them with me?

Thanks,

https://schou.dk/linux/arduino/isp/

Except choose the board type for the bootloader you want to burn.

1 Like