Skip to content

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

Open
@ammartahircheema

Description

@ammartahircheema

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);
}

Activity

ammartahircheema

ammartahircheema commented on Dec 21, 2020

@ammartahircheema
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

proboscide99 commented on Aug 5, 2021

@proboscide99

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

per1234 commented on Nov 9, 2021

@per1234
Contributor

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

added
type: imperfectionPerceived defect in any part of project
topic: codeRelated to content of the project itself
on Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @per1234@ammartahircheema@proboscide99

        Issue actions

          LiquidCrystal causing ESP32-S2-Wrover-I to crash. · Issue #41 · arduino-libraries/LiquidCrystal