Open Baptou88 opened 3 years ago
Please format your code properly. Not 1 ` but 3, before and after the code. Like this:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
thanks @Kongduino for the the reply
First thing I can is this: SDA_OLED
and SCL_OLED
are not defined anywhere, and the error message is complaining about Can't init sda=1, scl=1
. Can you try the init code with actual values?
SSD1306Wire display(0x3c, <PIN NUMBER>, <PIN NUMBER>, GEOMETRY_128_64);
Effectively I've forgot to mention sda_oled and scl_oled
I use this board so this 2pin are declared in the arduino.pin (pin 15 and 4)
Indeed I have the same boards, bought them a long time ago. So I went dumpster diving and found some old code. I init the OLED like this:
SSD1306 display(0x3c, 4, 15);
void setup() {
[...]
digitalWrite(16, HIGH);
// while OLED is running, must set GPIO16 in high
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, "\n\nOLED Inited");
Serial.println("\n\nOLED Inited\nReceiver");
SPI.begin(5, 19, 27, 18);
LoRa.setPins(18, 14, 23);
if (!LoRa.begin(433e6)) {
Serial.println("Starting LoRa failed!");
display.drawString(0, 20, "LoRa Init Fail");
display.display();
while (1);
}
Try this init code, with numbers and not defines, see if it works first.
thanks for your reply !
I've try:
replaced SSD1306Wire display(0x3c,SDA_OLED,SCL_OLED,GEOMETRY_128_64);
by SSD1306Wire display(0x3c,4,15,GEOMETRY_128_64,I2C_TWO);
replaced LoRa.setPins(18, 14, 26);
by LoRa.setPins(18, 14, 23);
results are the same:
screen display correctly during ~30/60sec, after i've this msg on the serial monitor [E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=1, scl=1
and randomly a reboot
#0 0x4008587c:0x3ffbea70 in invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
#1 0x40085af1:0x3ffbea90 in abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
#2 0x40086867:0x3ffbeab0 in xQueueGenericReceive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:2038
#3 0x400d4059:0x3ffbeaf0 in spiTransaction at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.c:283
#4 0x400d157d:0x3ffbeb10 in SPIClass::beginTransaction(SPISettings) at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.cpp:269
#5 0x400d16b0:0x3ffbeb40 in LoRaClass::singleTransfer(unsigned char, unsigned char) at .pio\libdeps\heltec_wifi_lora_32\LoRa\src/LoRa.cpp:730
#6 0x400d16e4:0x3ffbeb60 in LoRaClass::readRegister(unsigned char) at .pio\libdeps\heltec_wifi_lora_32\LoRa\src/LoRa.cpp:730
#7 0x400d1aa1:0x3ffbeb80 in LoRaClass::handleDio0Rise() at .pio\libdeps\heltec_wifi_lora_32\LoRa\src/LoRa.cpp:694
#8 0x40080f1e:0x3ffbeba0 in LoRaClass::onDio0Rise() at .pio\libdeps\heltec_wifi_lora_32\LoRa\src/LoRa.cpp:730
#9 0x40080f69:0x3ffbebc0 in __onPinInterrupt at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-gpio.c:274
#10 0x40084139:0x3ffbebe0 in _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S:1154
#11 0x40088423:0x3ffb1e20 in xTaskResumeAll at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
#12 0x400870ff:0x3ffb1e40 in xEventGroupWaitBits at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/event_groups.c:338
#13 0x400d374e:0x3ffb1e70 in i2cProcQueue at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-i2c.c:1287
#14 0x400d3af3:0x3ffb1ea0 in i2cWrite at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-i2c.c:1629
#15 0x400d1c71:0x3ffb1ec0 in TwoWire::writeTransmission(unsigned short, unsigned char*, unsigned short, bool) at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.cpp:161
#16 0x400d1ca5:0x3ffb1ee0 in TwoWire::endTransmission(bool) at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.cpp:161
#17 0x400d1d01:0x3ffb1f00 in TwoWire::endTransmission() at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.cpp:161
#18 0x400d0e53:0x3ffb1f20 in SSD1306Wire::sendCommand(unsigned char) at src/main.cpp:106
#19 0x400d1002:0x3ffb1f40 in SSD1306Wire::display() at src/main.cpp:106
#20 0x400d131d:0x3ffb1f70 in loop() at src/main.cpp:122
#21 0x400d4ce9:0x3ffb1fb0 in loopTask(void*) at C:\Users\Baptou\.platformio\packages\framework-arduinoespressif32\cores\esp32/main.cpp:23
#22 0x40086b01:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)```
It seems that you are trying to display something on OLED (error line 18) while receiving data in LoRa (error line 8). If yes, then don't do so.
In on the onReceive(), can try to set a flag or a string only. Then inside the loop, try to detect the flag and display a string in OLED.
onReceive() is an ISR, not a normal method. Try to avoid doing stuffs inside an ISR.
Hello Everyone !
I just noticed a problem with this library and some libraries for the use of an ssd1306 and I would like to understand where this problem comes from and how it is possible to fix it
here is my situation:
At this point all is Ok my project work correctly
However when I want to use the screen through these libs (Adafruit_SSD1306 or this one ) I'have an error on The Serial Monitor
[E][esp32-hal-i2c.c:1434] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=1, scl=1
which occurs just after passing the function 'onTxDone'I hope I have been understandable enough