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

Getting Garbage Display #70

Closed
vbisbest opened this issue Sep 29, 2017 · 20 comments · Fixed by #91

Comments

@vbisbest
Copy link

commented Sep 29, 2017

WHen doing several updates in a row, the output on the LCD becomes corrupted. Garbage characters and the only way out is a full reset. This is the relevant code:

        lcd.clear()
        lcd.cursor_pos = (0, lineStartPos(lcdLine1))
        lcd.write_string(str(lcdLine1))
        lcd.cursor_pos = (1, lineStartPos(lcdLine2))
        lcd.write_string(str(lcdLine2))
        lcd.cursor_pos = (2, lineStartPos(lcdLine3))
        lcd.write_string(str(lcdLine3))
        lcd.cursor_pos = (3, 0)
        lcd.write_string("Target:")
        lcd.write_string(str(targetTemp))
        lcd.write_string(chr(223) + " ")
        lcd.write_string("Temp:")
        lcd.write_string(str(currentTemp))
        lcd.write_string(chr(223))

lineStartPos is a function to determine center point of the text. I can update the same content perhaps 6 times in a row but after that it becomes corrupt. Thanks.

@ageir

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2017

Are you using GPIO directly or an I2C backpack?

@wa4557

This comment has been minimized.

Copy link

commented Nov 21, 2017

@ageir Having the same problem. I'm using

lcd = CharLCD(pin_e=38, pin_rs=40, pin_rw=None,
              pins_data=[37, 35, 33, 31], numbering_mode=GPIO.BOARD,
              cols=16, rows=2)

Is that ok, or should I use something else?

@dbrgn dbrgn added the bug label Mar 25, 2018

@thijstriemstra

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2018

I'm also seeing this on 20x4 with GPIO using v1.1.0..

app.lcd = CharLCD(
            pin_rs=pin_rs, pin_e=pin_e, pins_data=pins_data,
            numbering_mode=GPIO.BCM, cols=cols, rows=rows,
            auto_linebreaks=False
)
app.lcd.write_string('SSID: {}'.format(app.ssid))
app.lcd.cursor_pos = (1, 0)
app.lcd.write_string('WLAN: {}'.format(app.wireless[0].address))
app.lcd.cursor_pos = (3, 0)
app.lcd.write_string('Connections: {}'.format(connections))

Reverting to 1.0.0 fixed it. spoke too soon, it didn't fix it.

pip install RPLCD==1.0.0
@dbrgn

This comment has been minimized.

Copy link
Owner

commented Apr 16, 2018

@thijstriemstra is this reproducable?

@thijstriemstra

This comment has been minimized.

Copy link
Contributor

commented Apr 16, 2018

Yes, see my previous comment. Unfortunately 1.0.0 does not have another important fix (but who knows, it could also be the cause of this issue): Limit GPIO cleanup to active pins (#72)

@spellbin

This comment has been minimized.

Copy link

commented Apr 17, 2018

I also am having the same issue. First several displays work then it becomes garbled. I'll try reverting back to an older version and see if that helps.

@dbrgn

This comment has been minimized.

Copy link
Owner

commented Apr 17, 2018

Maybe a timing issue. Would be great to know if reverting to an older version helps or not.

@thijstriemstra

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2018

Yeah, I spoke too soon, reverting to 1.0.0 didn't fix it, maybe < 1.0.0 does though. It's an issue that does not happen all the time..

@aagontuk

This comment has been minimized.

Copy link

commented Apr 24, 2018

I have encountered the same problem. Tried with different versions from 1.1.0 to 0.9.0. Got same results. For version 0.9.0 LCD backlight didn't work. Here is my code:

from RPLCD.gpio import CharLCD
from RPi import GPIO
from time import sleep

lcd = CharLCD(pin_rs = 15, pin_e = 16, \
                pins_data = [21, 22, 23, 24], \
                numbering_mode = GPIO.BOARD, \
                cols = 20, rows = 4, dotsize = 8, \
                charmap = 'A00', auto_linebreaks = True, \
                pin_backlight = 18, \
                backlight_mode = 'active_high')

try:
    while True:
        lcd.clear()
        lcd.write_string('hello, world...')
        sleep(5)
except KeyboardInterrupt:
    lcd.close(clear = True)
@dbrgn

This comment has been minimized.

Copy link
Owner

commented Apr 24, 2018

Ok, good to know, that means it's probably not a new issue. I'll try to have a look once I find some free time for it :)

@aagontuk @thijstriemstra @spellbin do you by chance use very long cables from the LCD to the Raspi?

@aagontuk

This comment has been minimized.

Copy link

commented Apr 24, 2018

I am using short cables. May be this is not a h/w or wiring issue. Adafruit CharLCD is working fine without any issue yet.

@dbrgn

This comment has been minimized.

Copy link
Owner

commented Apr 24, 2018

Adafruit's library uses busy looping as timing function while RPLCD uses time.sleep. Maybe that's the problem.

@spellbin

This comment has been minimized.

Copy link

commented Apr 24, 2018

I'm using short cables as well.

@albedozero

This comment has been minimized.

Copy link

commented Dec 20, 2018

I know this issue is a bit stale, but FYI I've been having the same problem and tried forking and replacing time.sleep in the msleep and usleep functions with a busy loop as in the Adafruit CharLCD library. The garbage display problem still crops up for me, so maybe that's not it.

@lcfyi

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

Could anybody give my PR a try to see if it solves their issues? I've had it running on a RPi 3 with my fix for about two weeks now and have yet to see any scrambled characters.

@dbrgn dbrgn closed this in #91 Feb 13, 2019

@dbrgn dbrgn reopened this Feb 13, 2019

@dbrgn

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

The pull request #91 was merged to master. It adds a compatibility mode with longer wait times. This might help when an LCD requires timings that are out of spec for the HD44780, or if the clock isn't correct.

It would be great if one of the affected people could test the current master branch of this library, to see if it fixes the issue. You also need to pass in the compat_mode=True parameter when initializing the CharLCD class in order to enable this compatibility mode.

@albedozero

This comment has been minimized.

Copy link

commented Feb 13, 2019

The master branch fixes the problem for me, when I use compat_mode=True. Works in python2 and python3.

@dbrgn

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2019

Great, in that case I'll make a release today!

Thanks @lcheng1 for tracking this down.

@dbrgn dbrgn closed this Feb 14, 2019

@dbrgn

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2019

v1.2.1 is out.

@DolceVii

This comment has been minimized.

Copy link

commented Jun 6, 2019

I still have that issue on v.1.2.2
compat_mode=True ....nothing change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.