[SOLVED] Unhandled exception(?) when using 20x4 display, component lcd_pcf8574, relay board

I’m trying to set up a 20x4 character display (2004-A) with a built-in 8574T I2C on a 4 relay 8266 board. However, when/if I set up its address (0x27), the device gets into something that looks like a boot loop - becomes unresponsive, and have to be reset and reprogrammed to work again.

The relevant part of the config is:

esphome:
  name: relayboard
  platform: ESP8266
  board: esp12e

i2c:
  sda: 4
  scl: 5
  id: i2c0
  scan: true

display:
  - platform: lcd_pcf8574
    dimensions: 20x4
    i2c_id: i2c0
    update_interval: 30s
    id: mydisplay

If I run this like this, the device boots, connects to the wifi, all is well, but cannot communicate with the display as the address is 0x3F (default), which is wrong:

[01:01:52][I][i2c.arduino:054]: Results from i2c bus scan:
[01:01:52][I][i2c.arduino:060]: Found i2c device at address 0x27
[01:01:52][C][lcd_pcf8574:024]: PCF8574 LCD Display:
[01:01:52][C][lcd_pcf8574:025]:   Columns: 20, Rows: 4
[01:01:52][C][lcd_pcf8574:026]:   Address: 0x3F
[01:01:52][C][lcd_pcf8574:027]:   Update Interval: 1.0s
[01:01:52][E][lcd_pcf8574:029]: Communication with LCD Display failed!

If I set up the correct address (0x27), after running the programming, the board becomes unresponsive.
I could get the following log:

[00:54:51]User exception (panic/abort/assert)
[00:54:51]--------------- CUT HERE FOR EXCEPTION DECODER ---------------
[00:54:51]
[00:54:51]Abort called
[00:54:51]
[00:54:51]>>>stack>>>
WARNING Found stack trace! Trying to decode it
[00:54:51]
[00:54:51]ctx: cont
[00:54:51]sp: 3ffffd90 end: 3fffffc0 offset: 0000
[00:54:51]3ffffd90:  00000000 00000000 00000000 00000000  
[00:54:51]3ffffda0:  000000fe 00000000 00000000 00000000  
[00:54:51]3ffffdb0:  00000000 00000000 00000000 00000020  
[00:54:51]3ffffdc0:  00000014 4020cc58 4fdf3b64 3fff0544  
WARNING Decoded 0x4020cc58: esphome::Scheduler::SchedulerItem::cmp(std::unique_ptr<esphome::Scheduler::SchedulerItem, std::default_delete<esphome::Scheduler::SchedulerItem> > const&, std::unique_ptr<esphome::Scheduler::SchedulerItem, std::default_delete<esphome::Scheduler::SchedulerItem> > const&)
[00:54:51]3ffffdd0:  00000000 3ffeebb4 3fff0454 40215a32  
WARNING Decoded 0x40215a32: raise_exception at core_esp8266_postmortem.cpp
[00:54:51]3ffffde0:  00000000 3fff0400 40100809 40215a44  
WARNING Decoded 0x40100809: millis
WARNING Decoded 0x40215a44: __unhandled_exception
[00:54:51]3ffffdf0:  000000b3 3fff03f4 3fff02e4 40220280  
WARNING Decoded 0x40220280: __gnu_cxx::__throw_insufficient_space(char const*, char const*) at /workdir/repo/gcc-gnu/libstdc++-v3/src/c++11/snprintf_lite.cc:50
[00:54:51]3ffffe00:  3fff0584 3ffeebb4 3fff0588 40205af1  
WARNING Decoded 0x40205af1: esphome::lcd_pcf8574::PCF8574LCDDisplay::call_writer()
[00:54:51]3ffffe10:  00000000 3fff0454 3ffffe50 402059cd  
WARNING Decoded 0x402059cd: esphome::lcd_base::LCDDisplay::update()
[00:54:51]3ffffe20:  00000000 3ffeebb4 3fff0584 4021841a  
WARNING Decoded 0x4021841a: std::_Function_handler<void (), esphome::PollingComponent::call_setup()::{lambda()#1}>::_M_invoke(std::_Any_data const&) at component.cpp
[00:54:51]3ffffe30:  00000000 3ffeebb4 3fff0584 4020d461  
WARNING Decoded 0x4020d461: esphome::Scheduler::call()
[00:54:51]3ffffe40:  0000001e 0000001e 3ffe85e4 40100d83  
WARNING Decoded 0x40100d83: umm_free_core at umm_malloc.cpp
[00:54:51]3ffffe50:  000000b3 3fff0454 3fff03ec 00000000  
[00:54:51]3ffffe60:  3fff0144 00000020 3ffef964 40100f62  
WARNING Decoded 0x40100f62: free
[00:54:51]3ffffe70:  000000b3 00000004 fffeecc2 40220cc0  
WARNING Decoded 0x40220cc0: operator delete(void*) at /workdir/repo/gcc-gnu/libstdc++-v3/libsupc++/del_op.cc:50
[00:54:51]3ffffe80:  3fff0408 3ffffea0 00000005 00000100  
[00:54:51]3ffffe90:  3fff0144 00000004 3ffeebb4 4020c4ad  
WARNING Decoded 0x4020c4ad: esphome::Application::setup()
[00:54:51]3ffffea0:  00000005 00000005 3ffef964 00000000  
[00:54:51]3ffffeb0:  00000014 3ffef964 00000020 4020b402  
WARNING Decoded 0x4020b402: esphome::Application::register_component_(esphome::Component*)
[00:54:51]3ffffec0:  3fff0454 3ffeec58 00000050 3ffeec4c  
[00:54:51]3ffffed0:  3ffeec54 3fff0454 3ffeebb4 4020dac7  
WARNING Decoded 0x4020dac7: setup
[00:54:51]3ffffee0:  01a8c001 01a8c0a6 ffffff01 00000000  
[00:54:51]3ffffef0:  00000000 feefef00 feefeffe feefeffe  
[00:54:51]3fffff00:  3fffff08 00000007 7a646f42 00473261  
[00:54:51]3fffff10:  36312e31 feef0036 feefef00 00000000  
[00:54:51]3fffff20:  3fffff28 00000008 6963616d 6963616c  
[00:54:51]3fffff30:  00000000 00000000 00000000 00000000  
[00:54:51]3fffff40:  01a8c001 01a8c0a6 ffffff01 00000000  
[00:54:51]3fffff50:  00000000 00000000 3fffff60 00000000 <
[00:54:51]3fffff60:  ffffff00 00000000 00000000 feefef00  
[00:54:51]3fffff70:  feefeffe feefeffe feefeffe feefeffe  
[00:54:51]3fffff80:  3fff038c 00000001 feefeffe feefeffe  
[00:54:51]3fffff90:  feefeffe feefeffe feefeffe 3ffef058  
[00:54:51]3fffffa0:  3fffdad0 00000000 3ffef044 4021556c  
WARNING Decoded 0x4021556c: loop_wrapper() at core_esp8266_main.cpp
[00:54:51]3fffffb0:  feefeffe feefeffe 3ffe85e0 401003f1  
WARNING Decoded 0x401003f1: cont_wrapper
[00:54:51]<<<stack<<<

I think this part is relevant:

  1. WARNING Decoded 0x40220280: __gnu_cxx::__throw_insufficient_space(char const*, char const*) at /workdir/repo/gcc-gnu/libstdc+±v3/src/c++11/snprintf_lite.cc:50
  2. WARNING Decoded 0x40205af1: esphome::lcd_pcf8574::PCF8574LCDDisplay::call_writer()
  3. WARNING Decoded 0x402059cd: esphome::lcd_base::LCDDisplay::update()

Looks like an exception from the update loop of the display…

Any ideas? :slight_smile:

Well, turns out it was a bunch of overlapping errors by me :slight_smile:

  • Update interval 1s for the screen conflicts with the WiFi setup; if set to 2s, the wifi comes up
  • The module on my board is a esp01_1m not esp12e
  • Initializing of the display takes more time than expected
  • The potmeter on the board must be turned all the way down to show any characters (probably due to 3.3V VCC instead of 5V)
  • I also had an error in one of the lambda-s

I leave this topic here for reference :slight_smile:

2 Likes

Hi,

I can’t make mine work, the display turns on; but I can’t get any text

###################################################################################################
#####  I/O expander hub definition
###################################################################################################
mcp23017:
  - id: 'mcp23017_hub'
    address: 0x20
#nodemcu devkit v4.0
i2c:
  sda: 21
  scl: 22
  scan: True
###################################################################################################
# 20x4 LCD config
display:
  - platform: lcd_pcf8574
    dimensions: 20x4
    address: 0x27
    #update_interval: 2s
    lambda: |-
      it.print("Hello World!");

[19:21:51][C][i2c.arduino:038]: I2C Bus:
[19:21:51][C][i2c.arduino:039]:   SDA Pin: GPIO21
[19:21:51][C][i2c.arduino:040]:   SCL Pin: GPIO22
[19:21:51][C][i2c.arduino:041]:   Frequency: 50000 Hz
[19:21:51][C][i2c.arduino:044]:   Recovery: bus successfully recovered
[19:21:51][I][i2c.arduino:054]: Results from i2c bus scan:
[19:21:51][I][i2c.arduino:060]: Found i2c device at address 0x20
[19:21:51][I][i2c.arduino:060]: Found i2c device at address 0x27
[19:21:51][C][mcp23017:028]: MCP23017:
[19:21:53][C][lcd_pcf8574:024]: PCF8574 LCD Display:
[19:21:53][C][lcd_pcf8574:025]:   Columns: 20, Rows: 4
[19:21:53][C][lcd_pcf8574:026]:   Address: 0x27
[19:21:53][C][lcd_pcf8574:027]:   Update Interval: 1.0s

I’m using this one

any idea?

The biggest oops in my case was the potentiometer, which I had to turn all the way up.

Here is the relevant part from my .yml file:

display:
  - platform: lcd_pcf8574
    dimensions: 20x4
    i2c_id: i2c0
    update_interval: 5s
    address: 0x27
    id: mydisplay
    lambda: |-
      char str[17];
      time_t currTime = id(my_time).now().timestamp;
      strftime(str, sizeof(str), "%H:%M:%S", localtime(&currTime));
1 Like

thank you @fagzal , changing the interval to 5 and turning up/down until I got the desired “intensity” made the magic.
:clap: AWSOME

I think the update interval can be smaller, like 2s. You might even go down to 1s, if you also increase the I2C frequency, but I did not try that.

it works!!!

i2c:
  sda: 21
  scl: 22
  scan: True
  frequency: 100kHz

reference

  • frequency (Optional, float): Set the frequency the I²C bus should operate on. Defaults to 50kHz. Values are 10kHz, 50kHz, 100kHz, 200kHz, … 800kHz

I²C Bus — ESPHome