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

LiquidCrystal causing ESP32-S2-Wrover-I to crash. #41

Open
ammartahircheema opened this issue Dec 21, 2020 · 3 comments
Open

LiquidCrystal causing ESP32-S2-Wrover-I to crash. #41

ammartahircheema opened this issue Dec 21, 2020 · 3 comments
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ammartahircheema
Copy link

ammartahircheema commented Dec 21, 2020

ESP32-s2 is crashing on LCD initialization. Code is 'Hello World' from examples.

Debug Logs is as follow.

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x10 (RTCWDT_RTC_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x8
load:0x3ffe6108,len:0x620
load:0x4004c000,len:0xa38
load:0x40050000,len:0x2848
entry 0x4004c190
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}
@ammartahircheema
Copy link
Author

Update. Crash only occurs when I initialize LCD on global scope.
"LiquidCrystal lcd(7, 6, 5, 4, 3, 8);" keeping this statement inside a function somehow resolves this issue. but i need lcd variable accessible in both setup and loop function...

@proboscide99
Copy link

I'm having the same issue on a WROOM after updating the esp32 core to current version.
Looking at the library file, I see that the constructor calls 'begin(16,1)'.

Calling 'begin(16,1)' at the end of the constructor leads to an endless delay because -it seems that- the 'delayMicroseconds()' function does not work yet at that point of the initialization. For some reason, it used to work with an older core (V3.3).

The program gets halted even before being able to output anything on the Serial.

Commenting out the 'begin(16,1)' call from the 'LiquidCrystal::init' function in 'LiquidCrystal.cpp' and placing it in the sketch (where it should be already, with proper display size) solves the issue, because the 'delayMicroseconds()' function will work.

Alessandro, Italy

@per1234
Copy link
Contributor

per1234 commented Nov 9, 2021

The problem with the constructor was previously reported at #11

#11 is odd in that it was originally a pull request arduino/Arduino#87, but was somehow converted to an issue during the transfer of the library from its original home bundled with the Arduino IDE repository to this dedicated repository. The proposed changes are in this branch:
https://github.com/arduino-libraries/LiquidCrystal/tree/pr_87
with the constructor fix in this commit:
arduino/Arduino@f82ec65

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants