Open whogarden opened 3 years ago
Hi whogarden, I'm having the same issue now, has yours resolved yet?
Hi speedlao, I can't remember how it was solved. I just try it now and it's working with : ESP32 arduino core 2.0.2 ESP8266 and ESP32 OLED driver for SSD1306 displays version=4.2.1 Wire version 2.0.0( coming with the esp32 arduino core 2.0.2)
Hi speedlao, I can't remember how it was solved. I just try it now and it's working with : ESP32 arduino core 2.0.2 ESP8266 and ESP32 OLED driver for SSD1306 displays version=4.2.1 Wire version 2.0.0( coming with the esp32 arduino core 2.0.2)
Thanks for the reply. my problem solved just now. In my case is using u8g2 lib for SSD1306 OLED.
The problem is when constructing u8g2 instance with hardwre I2C pin configuration, it won't work.
A pre-called Wire.setPins
saved my day.
So, have a nice day, cheers!
I have the same problem on Heltec LoRa32 v2.
[ 28][E][Wire.cpp:283] setClock(): Bus is in Slave Mode [ 33][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 39][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 45][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 51][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 57][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 63][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 68][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode
Hi Logos7 Did you solved the pb? If not can you post your code And the first 2 lines before [ 28][E][Wire.cpp:283] setClock(): Bus is in Slave Mode
I used u8g2 lib for SSD1306 OLED.
I used the following type:
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(SCL_OLED, SDA_OLED, RST_OLED);
setClock()
looked like:
bool TwoWire::setClock(uint32_t frequency)
{
esp_err_t err = ESP_OK;
#if !CONFIG_DISABLE_HAL_LOCKS
//acquire lock
if(lock == NULL || xSemaphoreTake(lock, portMAX_DELAY) != pdTRUE){
log_e("could not acquire lock");
return false;
}
#endif
if(is_slave){
log_e("Bus is in Slave Mode");
err = ESP_FAIL;
} else {
err = i2cSetClock(num, frequency);
}
#if !CONFIG_DISABLE_HAL_LOCKS
//release lock
xSemaphoreGive(lock);
#endif
return (err == ESP_OK);
}
Sorry, something went wrong with line endings...
In your Heltec LoRa32 v2, I can see that oled sda is hard wired to gpio 4 And oled scl is hard wired to gpio 15 can you insure that your code correctly define that pins?
Yes. I have the same pins.
And did you set the correct level on gpio16 (oled rst)?
Yes.
Even reset it manually...
without your code, I am unable to help you further...
see Wire.begin()
overload issue: https://github.com/espressif/arduino-esp32/issues/6616#issuecomment-1184167285
see
Wire.begin()
overload issue: espressif/arduino-esp32#6616 (comment)
Thank you he played a role for me.
A variant for the begin method has been included in the ESP32 Wire library. Now we have the following syntax:
Wire.begin(int sda=-1,int scl=-1,uint32_t frequency=0U);
Wire.begin(uint8_t slaveAddr,int sda=-1,int scl=-1,uint32_t frequency=0U);
If we try to make the following call:
byte pinSDA=4;
byte pinSCL=15;
Wire.begin(pinSDA,pinSCL);
The compiler will find that the call to the begin method will detect that its first parameter is of type byte (uint8_t), therefore it will consider that the variant to call is the second...ERROR. To solve the problem, it is enough to force the type of the first parameter to int:
byte pinSDA=4;
byte pinSCL=15;
Wire.begin((int)pinSDA,pinSCL);
Cheers
Bonjour et merci pour l'astuce. Le fait d'insérer (int) a débloqué ma situation en erreur. J'utilise un ESP32 DevKitC v4. Sous l'IDE Arduino, avec un PC, cela fonctionnait. Je viens de passer sous VScode + PlatformIO, sur Mac OS X, qui m'avait affiché cette erreur. Merci à vous tous.
Describe the bug Nothing is displayed on an oled sh1106 with ESP32 dev board SSD1306SimpleDemo.ino (it's your example code)
To Reproduce I use ESP32 dev board An SH1106 Wire sda to gpio21, scl to gpio22 Flash SSD1306SimpleDemo.ino with Arduino core for the ESP32 release v2.0.1 an nothing is displayed on the oled screen. If I go back to Arduino core for the ESP32 release v2.0.0, it's working
Sample code Provide a MCVE below.
Expected behavior Debug level "Debug" [ 10][I][esp32-hal-i2c-slave.c:234] i2cSlaveInit(): Initialising I2C Slave: sda=22 scl=22 freq=100000, addr=0x15 [ 11][D][esp32-hal-i2c-slave.c:494] i2c_slave_set_frequency(): Fifo thresholds: rx_fifo_full = 28, tx_fifo_empty = 4 [ 28][E][Wire.cpp:283] setClock(): Bus is in Slave Mode [ 33][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 39][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 45][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 51][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 57][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 63][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 68][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode [ 74][E][Wire.cpp:331] endTransmission(): Bus is in Slave Mode [ 80][E][Wire.cpp:308] beginTransmission(): Bus is in Slave Mode
Additional context Compile wire used : Wire version 2.0.0 dans le dossier: C:\Users\me\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\libraries\Wire