Oled sh1106 128x64 and Ethernet Shield w5100 issue

Dear all,
I'm developing a small digital osc mixer control.
I use an Ethernet shield with w5100 chip and an Arduino Mega 2560 to send OSC messages with ArduinoOSC library.
Now I'm using an 16x2 i2c lcd with LiquidCrystal_I2C library and all works great.

I decided to upgrade the display with an Oled 128x64 with sh1106.
The display works with own examples with the Adafruit_SH1106 and u8g2 libraries.
But when I put it in my project the all stop to works.

I strip down all the code and I discovered that just the declariation of lcd display cause issues in my project.

#define OLED_RESET 0
Adafruit_SH1106 display(OLED_RESET);

I use Arduino Osc library to decode incoming udp messages.

This is the error code enum form source.

typedef enum { OSC_OK = 0,
} OSCErrorCode;

My error code is 3, so seems ALLOCFAILED.

The compilation was fine, this is the details of memory usage at compile time

Sketch uses 44982 bytes (17%) of program storage space. Maximum is 253952 bytes.
Global variables use 4666 bytes (56%) of dynamic memory, leaving 3526 bytes for local variables. Maximum is 8192 bytes.

So seems something about Arduino memory full?
What can I do?
Thanks a lot

Probably is the first time that I realized a so complex project. The dynamic memory at compile time seems to be half free, but at runtime it is full.
I adopt F macro for all strings and force them to Flash.
The issue is gone and I can pilot 2 oled with my project now.

This topic was automatically closed after 120 days. New replies are no longer allowed.