DIY Arduboy - problem with SH1106 screen


#22

The games that don’t work for you must be updating the screen in some ‘non-standard’ way, Dark and Under for example is packaged with its own copy of the library:

…and so is not calling @Mr.Blinky’s customised library, but bypassing it!

What your image below shows is typical of using SSD1306 code to try and run a SH1106 - you can see that the first ‘page’ of the screen (first 8 rows) is the only one being updated.

This happens because the SH1106 will not increment to the following ‘page’ unless it is explicitly told to. Whereas the SSD1306 does it automagically…


#23

Setting in the HMP(HomeMadePackage) screenshot are ok. In your previous version you had a wire soldered on top of the display module form GND to CS. This wire is now gone. Did you rewire the CS to GND at the bottom or wired to another pin ? If left open it will float and cause unexpected behaviour (sometimes it seems to work, sometimes not).

IN case of Dark and Under you must replace the Arduboy2 library included with the Dark and Under source with the one from the HMP.

The original display is a SSD1306 OLED display they have become more pricey nowadays.


(Pavlov Roman) #24

Thank you all very much for your wonderful answers!
Now it is clear why the display did not work correctly.
The photos show the same device, the connection of the display has not changed.

OLED pin GND and CS -> GND pin of arduino

OLED pin VDD -> VCC of arduino

OLED pin SCK -> Digital pin 15 of arduino

OLED pin SDA -> Digital pin 16 of arduino

OLED pin RES -> Digital pin 6 of arduino

OLED pin DC -> Digital pin 4 of arduino

It’s all good! I almost wet myself for joy! What you said is very useful!


(Pharap) #25

That change ocurred here.

We do actually have an issue open about whether to change back to using the actual Arduboy2 library but we haven’t touched the code in ages.

Dang, I went to the trouble of writing some instructions, replacing the files and uploading to a new repo and even contemplating a Blue Peter joke.

But at least it works. Go slay the dragon!


For anyone who cares:

  1. Go to Mr.Blinky’s Arduboy repo
  2. Clone or download
  3. Download ZIP
  4. Extract Arduboy-master.zip
  5. Go to /Arduboy-master/Arduboy-master/board-support/
  6. Extract arduboy-variants-1.1.1.zip
  7. Go to /arduboy-variants-1.1.1/1.1.1/libraries/Arduboy2/src/
  8. Go to Dark&Under’s repo
  9. Clone or download
  10. Download ZIP
  11. Extract Dark-And-Under-master.zip
  12. Go to /Dark-And-Under-master/Dark-And-Under-master/Dark-And-Under/src/Arduboy
  13. Copy the contents of Arduboy-master/Arduboy-master/board-support/arduboy-variants-1.1.1/1.1.1/libraries/Arduboy2/src/ into /Dark-And-Under-master/Dark-And-Under-master/Dark-And-Under/src/Arduboy/

…Or alternatively download the one I just uploaded


(Pavlov Roman) #26

Did I understand correctly? This technique will work only with games that have their own library.

With CastleBoy and EVADE2 so do not work. Is there a way to repeat this trick with them? We can kill a couple more dragons?


(Pharap) #27

CastleBoy uses ArgLib.h, which is a really old library.
It would need some modification.

It would be easier with a diff of @Mr.Blinky’s version of the library and the version he forked it off of.

Evade2 uses a git submodule to refer to a very specific version of the Arduboy2 library.

The library should be replacable.
You need to be looking around this area.
Theoretically the files you should be replacing should end up in Evade2/src/Arduboy2/src, but I won’t know for definite until Evade2 finishes downloading.


@Mr.Blinky This commit tells me parts of your version of Arduboy2 are a bit out-of-date.


#28

Yes Sorry It’s outdated. I forgot to update it. The one in the HMP is up to date.But I’ll update it tonight to an even newer version. supporting multiple resolutions for SSD1327/29

I’ll have a look at the two other games using SH1106 too then.

EDIT:

Oh wait! you’ve picked my first but obselete variants package. I’ve started a new repositiory for the HomeMade Package

I also forked @MLXXXp Arduboy2 library here which is used in the HMP. This is the one I mentioned that is an update behind.

I thought I better split some parts up so they can be downloaded seperately.


(Pharap) #29

Ah, I just grabbed one from earlier in the thread (which happened to be from December last year :P).

Shame about that git ‘no rebasing on public repos’ rule or keeping it up to date would be a lot easier.

I’ve just updated the secondary D&U version.


Evade2 is finally downloaded and extracted a good 15-30 minutes after clicking the download button.

Only to find out that the Arduboy2 folder is empty there…
So I have no clue how to handle it ¯\_(ツ)_/¯.


#30

I’ve wired my Pro Micro like you with CS to GND, downloaded Evade 2 from github and opened evade2\evade2.ino without making any changes.

With using:

  • HMP version 1.2.4.
  • Board:HomeMade Arduboy
  • (Bootloader don’t care)
  • Based on: Arduino Leonardo (or Sparkfun Pro Micro 5V)
  • Core: Standard Arduino core
  • Display: SH1106

There are no problems with using a SH1106 display

To use the Arduboy optimized core you need to delete the file Evade2\src\ArduinoCore\wiring.c otherwise compiling will fail.

removing this file and compiling with core set to Arduboy optimized core will also show a proper display.

Please note that after you’ve uploaded Evade 2. There is no USB support when the game is running (USB code was removed by the developers to free space). To upload a new sketch you need to reset the Pro Micro or hold down LEFT+UP+A+B for 3 seconds after you’ve clicked the upload button.

EDIT:

I’ve adapted CastleBoy to use Arduboy2 library and it works fine on SH1106 displays too now when using HMP.

Note. Currently doesn’t compile with standard Arduino IDE / Arduboy2 library because of insufficient PROGMEM


(Pavlov Roman) #31

I continue to thank for the support, I could not imagine that I will be so much help :slight_smile:

CastleBoy started without errors, I am very happy.
Evade2 will not start, no way. I think I can live without this game.

If I still have something that will not start, I will try your Troubleshooting methods.


#32

Strange. Can you can try this Evade 2 hex file for SH1106 ?


(Pharap) #33

Now that it’s all working, maybe you should post a thread about it on #arduboy:homemade?


(Pavlov Roman) #34

Greetings to all!
Didn’t know what to write, that’s kind of already discussed this issue.
I will begin with gratitude for the help, thank you very much, until today everything works for me, but there was a game MiniRogue does not start on SH1106.

Is this the point where I need to switch to SSD1306 or is there a way to make it work?


(Simon) #35

Is you device built on top of a Leonardo?

In order to get my game to fit into the memory constraints of the Arduboy I did a couple of things:

  • I used a slightly modified version of ArdBitmap. My guess is this is not the culprit as it uses the standard screen buffer and display() function which is responsibile for writing the buffer to the screen

  • I used the ‘NO-USB’ macro. Again I do not think this is the culprit as this doesn’t affect screen handling - it simply removes the USB stack.

  • I used a hacked version of “wiring.c” which saved a few bytes, This was contributed by @Mr.Blinky and I cannot tell you what it does. I would look to remove this library and see if it compiles into the memory constraints of the Arduboy. It should do as we freed up some other memory.

  • The sound is created by attaching timers and interrupts. Maybe these are different to those needed by your board (assuming yours is not a Leonardo). You could remove this code by commenting out the #define SOUND and #define SOUND_ON_OFF in the Enums.h file.

Tell me how you go.


#36

Compiling OK for SH1106 for me - what do you mean exactly when you say “does not start” ?


(Simon) #37

Did you modify anything? I wonder what @Pavlov_Roman is using as a base - a Leonardo or something else.


(Pavlov Roman) #38

My arduboy clone is made using Arduino Leonardo copy, soldered as indicated in the thread on the forum Arduboy homemade.

I came to the conclusion that the problem is in my computer, because at work I downloaded everything you need and download problems were no more. I try to remove the compiler from my home PC and try again. If there are any more problems, I’ll ask.

Again I am very happy to be part of your community. Thank you for your attention and quick answers! :grin:


(Pavlov Roman) #39

I spent a very long time trying to get my Arduclone to work again and it doesn’t work.
I’ve already ordered myself some SSD1306 displays to end the suffering. At the same time I have five pieces of SH1106 displays and do not want them to disappear.

I will build a test Arduclone from the new display and Board, if the problem is resolved, I will assume that ProMicro is broken.

I reinstalled Windows.
Downloaded the latest version of Arduino IDE
I use the instructions: Quick Start Guide
Then I add to the Arduino IDE : https://github.com/MrBlinky/Arduboy-homemade-package

Everything goes without errors but in the end the display does not work correctly.
Can someone describe the points that are necessary for correct work with Homemade Arduboy?


#40

@Pavlov_Roman Just out of curiosity are you running the atmega32u4 and sh1106 at 5V or 3V? I ask because while most commercially available sh1106 modules have a built in 3V regulator the I/O from the datasheet isn’t technically 5V tolerant and thus could kill the display after prolonged operation so I’ve always wondered if it would be a problem for custom builds. I’ve used the sh1106 before but I designed a custom board for the atmega32u4 with an onboard 3v regulator to run the entire system at 3V to get around this problem.


#41

How did you wire-up the display?