OpenWrt Forum Archive

Topic: Tp-link MR3020 + lcdproc + lcd i2c

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

Today i'm trying to connect lcd 16x2 using i2c.
On router i have installed OpenWrt 12.09, and everything should be ok, but...
Device is recognized i set up correctly LCDd.config, but when i start server, the LCD is start blinking.

Of course between SDA i SCL i put 10k resistors to 3V3, and remove two 4,7k SMD resistors from PCB.
On router i connected to GPIO 7 and 29 - this point i found on R15 and R17 (I removed both resistors from PCB)

Is there anybody how have similar problem whit lcdproc?

Does i2cdetect from the package i2c-tools detect your device properly?

Yes, see:

root@OpenWrt:~# insmod i2c-gpio-custom bus0=0,7,29
root@OpenWrt:~# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# dmesg | grep gpio
[    0.090000] gpiochip_add: registered GPIOs 0 to 29 on device: ath79
[   51.420000] i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 29 (SCL)
root@OpenWrt:~# /etc/init.d/LCDd start

And there is some part of LCDd.conf:

## Hitachi HD44780 driver ##
[hd44780]

# Select what type of connection. See documentation for types.
ConnectionType=i2c

# Device of the serial interface [default: /dev/lcd]
Device=/dev/i2c-0
Port=0x3f


# Bitrate of the serial port (0 for interface default)
Speed=0

It's a bit strange, because LCD is only start blinking after start LCDd server...

It seems you have got the same problem as mentioned here: lines 1-4 and 5-8 of the I2C-adapter are swapped. So you can either apply this patch and build a new lcdproc package or rewire your display.

Thanks for replay.
So i should rewire D0-D3 to D4-D7? I have not enough skill to build packages, so options whit rewire is easiest for me smile

Yes, that is what I read there. Move all the 8 data lines by 4 lines: D0->D4, D1->D5, D2->D6, D3->D7, D4->D0, D5->D1, D6->D2, D7->D3.

So, i made this this modification - but there is still this same problem...
I have read that post, and now i change totally connection to LCD.

 * The connections are:
 * PCF8574AP  Bit    LCD
 * P0 (4)      0x01  D4 (11)
 * P1 (5)      0x02  D5 (12)
 * P2 (6)      0x04  D6 (13)
 * P3 (7)      0x08  D7 (14)
 * P4 (9)      0x10  RS (4)
 * P5 (10)      0x20  RW (5)
 * P6 (11)      0x40  EN (6)
 * P7 (12)      0x80  /backlight (optional, active-low)
 *

And add this part to LCDd.conf:

   i2c_line_RS=0x01
    i2c_line_RW=0x02
    i2c_line_EN=0x04
    i2c_line_BL=0x80
    i2c_line_D4=0x10
    i2c_line_D5=0x20
    i2c_line_D6=0x40
    i2c_line_D7=0x80
    Backlight=yes
    BacklightInvert=yes

And copy new hd44780.so file to /usr/lib/lcdproc, but now when i try to start server, i have this error:

root@OpenWrt:~# /etc/init.d/LCDd start
LCDd: '/usr/lib/lcdproc/hd44780.so' is not an ELF executable for MIPS
Could not open driver module /usr/lib/lcdproc/hd44780.so: File not found
Driver [hd44780] binding failed
Could not load driver hd44780
There is no output driver
Critical error while initializing, abort.

EDIT:

I'm absoluty sure, about connections - please see:

http://lcdproc.sourceforge.net/docs/sta … d44780-i2c

But now i have a question - how i need to change driver?

(Last edited by mcz on 8 Jan 2018, 19:57)

Well, at least you can not use the hd44780.so file, which is offered on that website. I don't know for what CPU type it was compiled, but it is very unlikely to be your type.
i2c_line_ options are also not supported in official lcdproc versions. You would need to compile a patched version using the OpenWrt toolchain. But I believe this is pretty off-topic for Hardware Hacking.

Uh, that sad...i checked that driver, and it's compiled for ARM...
Last question, in manual for lcdproc i found another way to connect lcd to device - 4bit - it is possible to connect lcd in this way to router using only GPIO without I2C? What do You think about that? I know manual is only for LPT, but i'm looking for solution smile

Of course - i can use lcd2usb - but it's very easy, and i used that in other project, so this is reason why i'm trying to use different  connection...

The discussion might have continued from here.