Welcome! Log In Create A New Profile

Advanced

Let's get this LCM1602 working [help me]

Posted by sagtf1 
Let's get this LCM1602 working [help me]
April 22, 2019 04:23PM
Hello,
I've a old 3d printer I build in 2012 with a sanguinololu board (644P 16Mhz chip) and I'm trying to add an i2c display using the LMC1602 generic adapter in configuration.h of marlin 1.1.9.
I know that the 644P has very little RAM for LCD applications, indeed the LCM1602 is the only adapter that Arduino IDE manages to compile without memory errors. This is the reason why I choose an adapter with such little documentation. Of course I could have replaced the 644P with a 1284P which has more ram, or the whole board with a more powerful one, but I've already other two printers, both FDMA and Resin, so today's topic is more about a thechnical challenge.
So, I've this LCM1602 adapter, I've tested it with both 1602 and 2004 displays through a basic sketch on arduino. This is why i post this topic as a firmware issue. lcds and the adapter are perfectly working. In a first time I tought the issue may be related to pins, so I made a further test: I overwrote marlin with the same sketch I used on arduino and it worked again. But I couldn't manage to get it working on marlin. Than I thought to libraries. In order for this adapter to works, libraries to include are wire.h and LiquidCrystal_I2C.h. The latter in the version modified by Malpartida. I checked again and both were included under ultralcd_impl_HD44780.h tab. Then I thought to screen resolution. In my test sketch I used two methods: lcd.begin(16,2); and lcd.clean(), where 16 are the chars per row and 2 are the rows, while clean() cleans the screen and puts the cursor in top left position. Actually, I culd find these methods in no tab. So I tried inserting them in the setup of marlin_main.cpp, then in configuration.h, then in conditionals_lcd.h and finally in the same ultralcd_impl_HD44780.h. The Arduino IDE compiles without errors, but when i burn the firmware on sanguino nothing happens. I have the first row with 16 white squares and nothing else. Nor am I sure that these two methods are really what's missing. I've attached some pictures. Don't pay attention to unused pins of my wiring. I'm using only four GND, 5V, SDA and SCL (pins 16 and 17 on sanguino). Hope that someone have already managed this adapter and may help me to get it working. I can feel that the solution will be very silly, but in spite of all my efforts and researches I'm not yet able to find it.






TronXY P802ma, a self-built Prusa mendel i2 and an Anycubic Photon
Re: Let's get this LCM1602 working [help me]
April 23, 2019 04:13AM
been fooling around with this most of the afternoon (I was curious, and had the hardware not doing anything)

Now I don't have an identical LCD, but I do have what looks to be the same i2c to lcd. The demo i2c for this using the library LiquidCrystal_I2C you mention works as a test sketch.


In Marlin I tried a bunch of things and eventually noticed "LCD_I2C_TYPE_PCA8574" which is the chip on the i2c device.

so I looked threw marlin for something that set this define and found #define RA_CONTROL_PANEL in configuration.h
Enabling this and you get a working LCD!!!

BUT!!! enabling this blows out the flash size (Sketch uses 93360 bytes (144%) of program storage space)
I had to switch to a 1284p

Now your sizes may vary a little, depends on what bootloader you have installed and what you enable/disable in configuration.h
I haven't tried to reduce the program space... that's a crap job... And not worth it when you can get 1284p in dip40 for quite cheap

Edited 3 time(s). Last edit at 04/23/2019 12:38PM by Dust.
Sorry, only registered users may post in this forum.

Click here to login