-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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] SSD1306 I2C display does not work #26389
Comments
MKS_12864OLED_SSD1306 is not a I2C display by default, it is a SPI display. Yes the SSD1306 does i2c, if its wired that way. and the firmware is setup for it. MKS_12864OLED_SSD1306 needs to the appropriate SPI pins |
If your playing with a generic i2c SSD1306 module, you need #define U8GLIB_SSD1306 not MKS_12864OLED_SSD1306 |
Hello thanks for replying, Ive tried #define U8GLIB_SSD1306 but still no luck, no output at the pins as proven by an oscilloscope. |
Update: my case was unrelated. The skr3 uses software i2c and that isn't supported by u8glib |
having a play using a creality 4.2.2.controller and a 0.96" SSD1306 I2C module I wired it up
I added this code to Marlin/src/MarlinCore.cpp after SERIAL_ECHOLN("I2C scanner. Scanning ...");
Wire.setSDA(PB11);
Wire.setSCL(PB10);
Wire.begin();
for (byte i = 1; i < 120; i++)
{
hal.watchdog_refresh();
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
SERIAL_ECHOLN("Found address: ",i);
delay (1);
}
}
SERIAL_ECHOLN ("Done."); And Marlin boots and says
60 is 3C, the expected address of the LCD, so this confirms the address and the wiring is OK |
Good idea with the i2c scan. I tried the same but with Software i2c and get this: Screen disconnected
That should be the onboard EEPROM Screen connected
So my wiring should be correct. |
Odd, removing my I2C scanner code you dont get any output, as reported but just add adding Wire.setSDA(PB11);
Wire.setSCL(PB10);
Wire.begin(); above SETUP_RUN(ui.init()); in Marlin/src/MarlinCore.cpp and you get a display!! Ignore the power bank, its just a weight to hold the wires in place. |
I purpose this as a fix. (basically it rearranges marlinui.cpp to setup the i2c pins before setting up the display, and changes the pin variable type) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp
index 463d406110..fa511b4882 100644
--- a/Marlin/src/lcd/marlinui.cpp
+++ b/Marlin/src/lcd/marlinui.cpp
@@ -218,6 +218,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
void MarlinUI::init() {
+ #if HAS_U8GLIB_I2C_OLED && PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
+ Wire.begin(uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN));
+ #endif
+
init_lcd();
#if HAS_DIGITAL_BUTTONS
@@ -274,10 +278,6 @@ void MarlinUI::init() {
slow_buttons = 0;
#endif
- #if HAS_U8GLIB_I2C_OLED && PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
- Wire.begin(int(I2C_SDA_PIN), int(I2C_SCL_PIN));
- #endif
-
update_buttons();
TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
|
Ive created a PR to fix this, so closing this issue |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
I uncommented #define MKS_12864OLED_SSD1306 in configuration.h
Added pin definitions in the board file, pins_CREALITY_V4.h
#define I2C_SCL_PIN PB10
#define I2C_SDA_PIN PB11
Compiled and flahsed fine,
Blank display.
Bug Timeline
Not sure
Expected behavior
Expected the display to show the marlin interface
Actual behavior
Nothing happens.
Steps to Reproduce
I uncommented #define MKS_12864OLED_SSD1306 in configuration.h
Added pin definitions in the board file, pins_CREALITY_V4.h
#define I2C_SCL_PIN PB10
#define I2C_SDA_PIN PB11
Version of Marlin Firmware
02010300
Printer model
Creality ender 3 with custom display wired to exp3 cable
Electronics
Creality v4.2.2 stm32 pcb
Add-ons
No response
Bed Leveling
None
Your Slicer
None
Host Software
None
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
Configuration.zip
The text was updated successfully, but these errors were encountered: