Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] I2C OLED display build error with Silicon Labs xG24 Explorer Kit #97

Closed
lboue opened this issue Nov 3, 2024 · 11 comments
Closed
Labels
bug Something isn't working

Comments

@lboue
Copy link

lboue commented Nov 3, 2024

Hardware

Silicon Labs xG24 Explorer Kit

Core version

2.1.0

Arduino IDE version

2.3.3

Operating system

Windows 11

Radio stack variant

Matter

OpenThread Border Router device (if using Matter)

No response

Issue description

Detailed description of the issue

Hello,

I would use I2C OLED display example to print pairing QRcode with my Silicon Labs xG24 Explorer Kit.
I am using the Adafruit_SSD1306 library

c:\Users\ludov\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp: In member function 'bool Adafruit_SSD1306::begin(uint8_t, uint8_t, bool, bool)':
c:\Users\ludov\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:530:44: error: 'digitalPinToPort' was not declared in this scope; did you mean 'digitalPinToInterrupt'?
  530 |     dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
      |                                            ^~~~~~~~~~~~~~~~
      |                                            digitalPinToInterrupt
c:\Users\ludov\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:530:25: error: 'portOutputRegister' was not declared in this scope
  530 |     dcPort = (PortReg *)portOutputRegister(digitalPinToPort(dcPin));
      |                         ^~~~~~~~~~~~~~~~~~
c:\Users\ludov\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:531:17: error: 'digitalPinToBitMask' was not declared in this scope
  531 |     dcPinMask = digitalPinToBitMask(dcPin);
      |                 ^~~~~~~~~~~~~~~~~~~

Using library SPI at version 2.1.0 in folder: C:\Users\ludov\AppData\Local\Arduino15\packages\SiliconLabs\hardware\silabs\2.1.0\libraries\SPI 
Using library Wire at version 2.1.0 in folder: C:\Users\ludov\AppData\Local\Arduino15\packages\SiliconLabs\hardware\silabs\2.1.0\libraries\Wire 
Using library Adafruit GFX Library at version 1.11.11 in folder: C:\Users\ludov\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit BusIO at version 1.16.2 in folder: C:\Users\ludov\Documents\Arduino\libraries\Adafruit_BusIO 
Using library Adafruit SSD1306 at version 2.5.13 in folder: C:\Users\ludov\Documents\Arduino\libraries\Adafruit_SSD1306 
exit status 1

I'm trying to decide whether to correct it in the code or in the screen library.

Regards

Serial output

No response

RTT output (if using Matter)

No response

Minimal reproducer code

https://github.com/adafruit/Adafruit_SSD1306/blob/master/examples/ssd1306_128x64_i2c/ssd1306_128x64_i2c.ino

@lboue lboue added the bug Something isn't working label Nov 3, 2024
@lboue lboue changed the title [bug] I2C OLED display build error [bug] I2C OLED display build error with Silicon Labs xG24 Explorer Kit Nov 3, 2024
@lboue
Copy link
Author

lboue commented Nov 15, 2024

I found another Library:
https://github.com/olikraus/U8g2_Arduino

@leonardocavagnis
Copy link
Contributor

Hi @lboue,
It seems that the issue is related to the screen library.

Please modify this line
https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.h#L57
to:
!defined(ARDUINO_ARCH_MBED) && !defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_SILABS)
and give it a try.

Let me know if it works! It should compile, but I'm not sure about the screen functionality (unfortunately, I don't have this screen to test 😢 ).

Thanks!

@lboue
Copy link
Author

lboue commented Nov 15, 2024

Thanks, it works

image

@leonardocavagnis
Copy link
Contributor

Thank u too!
I opened a PR on Adafruit library to fix it adafruit/Adafruit_SSD1306#279

@lyusupov
Copy link

lyusupov commented Dec 2, 2024

@leonardocavagnis

Please modify this line
https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.h#L57
to:
!defined(ARDUINO_ARCH_MBED) && !defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_SILABS)

I believe that you mean ARDUINO_ARCH_SILABS , right ?

ARDUINO_SILABS contains a string that introduces version numbers of this Core.
https://github.com/SiliconLabs/arduino/blob/main/platform.txt#L35

@leonardocavagnis
Copy link
Contributor

@lyusupov Good catch! thanks!
Please modify and let me know if it works.

@lyusupov
Copy link

lyusupov commented Dec 3, 2024

@leonardocavagnis
would you mind to update your PR to Adafruit with ARDUINO_ARCH_SILABS symbol ?

@leonardocavagnis
Copy link
Contributor

@lyusupov sure!

@silabs-bozont
Copy link
Collaborator

@leonardocavagnis

Please modify this line
https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.h#L57
to:
!defined(ARDUINO_ARCH_MBED) && !defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_SILABS)

I believe that you mean ARDUINO_ARCH_SILABS , right ?

ARDUINO_SILABS contains a string that introduces version numbers of this Core. https://github.com/SiliconLabs/arduino/blob/main/platform.txt#L35

I don't think it needs to be modified - it's correct as it is.
We use ARDUINO_SILABS as the platform discriminator - ARDUINO_ARCH_SILABS is not defined.
While the ARDUINO_SILABS macro has the value of the current core version #ifdef will definietly find it defined.
Here's my patch in Adafruit's BusIO library which added compatibility for example: https://github.com/adafruit/Adafruit_BusIO/pull/124/files

@lyusupov
Copy link

lyusupov commented Dec 3, 2024

@silabs-bozont

ARDUINO_ARCH_SILABS is not defined.

This does not look like 100% accurate statement

image

@silabs-bozont
Copy link
Collaborator

@lyusupov Thanks, I stand corrected! Indeed we define it - my search just missed it in platform.txt because it's like this: -DARDUINO_ARCH_{build.arch}.
This way either macro can be used to platform discrimination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants