CatoLynx / pyLCD

A library for controlling LCDs on various hardware backends (successor of HD44780)
Other
26 stars 14 forks source link

KS0108 GLCD with 3 chip select pins is not working #7

Open Synergyst opened 7 years ago

Synergyst commented 7 years ago

Hello.

I am having an issue with a KS0108 (192x64 with 3 chip select pins) and pyLCD.

I am using the 'glcd_system_monitor_threaded.py' and 'glcd_system_monitor.py' example scripts. The scripts run fine, however the image on the GLCD is not working as I'd assume it might.. I had to disable the UART inside of my '/boot/config.txt' with the directive 'enable_uart=0' due to the lack of output pins on the Raspberry Pi Zero unit. I am using the 'gpio readall' command to compare my wiring from the BCM pins to the pins inside of my pinmap configuration section of each script.

Am I perhaps missing something, or doing something incorrectly to cause this? Or is there a limitation to pyLCD which only allows support for GLCD's with only 2 chip select pins? If so how simple would it be to possibly implement a patch so that it can support a 3 chip KS0108 device?

My pin configuration is as follows: PINMAP = { 'RW': 14, 'RS': 7, 'E': 8, 'D0': 25, 'D1': 24, 'D2': 11, 'D3': 9, 'D4': 10, 'D5': 22, 'D6': 27, 'D7': 17, 'CS1': 3, 'CS2': 4, 'CS3': 15, 'RST': 2, 'LED': 18, }

Kind regards

CatoLynx commented 7 years ago

Hello! I'm afraid this issue is due to a lack of support for 3-chip GLCDs. To be honest, I didn't even know these existed. So yeah, it only accepts CS1 and CS2 parameters. I would have to look into the whole library again to find out how easy this would be to fix... been a while since I used or modified it. This would take a while since I am generally a bit busy recently.

Kind regards Julian

Synergyst commented 7 years ago

Hello! Thanks for the quick reply. And it's fine if you're unable to work on this often.

I do know that openGLCD(an Arduino and Teensy library) supports 3-chip devices. If that serves as a possible resource for porting 3-chip support to pyLCD I can let you know which GLCD configuration file I used within that library for my 3-chip display so we can do further testing(assuming the port is possible, and assuming you have no 3-chip displays to test with). I'd like to help if possible, however I am not very familiar with Python so I can take a shot at editing your 'ks0108.py' file so that it follows suit with how openGLCD utilizes 3-chip devices.

Kind regards

CatoLynx commented 7 years ago

Hi, I don't have any 3-chip displays here. But if you want, just go ahead and give it a shot. I think you just need to include CS3 in the pin map and mess with the current_chip property in set_column() a bit.

Synergyst commented 7 years ago

Hello.

I have been messing around with the Python code with no avail to the problem.. However I can share some GitHub repo links from another openGLCD contributer so that I can easily share the library files I used with success in my Arduino project which I'm attempting to port over to the Raspberry Pi Zero.

This is the file which should shed some light on the issue as far as I am aware: https://github.com/thegeek82000/openGLCD/blob/master/config/ks0108/AutoConfig_ks0108-HJ19264A_Panel.h

This is another file for a display I cannot test with as I do not own one, however it seems that it just has inverted pin logic for the chip select pins: https://github.com/thegeek82000/openGLCD/blob/master/config/ks0108/AutoConfig_ks0108-JHD19264A_Panel.h

Whereas this last file seems to do some 'smart math' for the display chip dimensions(possibly useful for a potential port?): https://github.com/thegeek82000/openGLCD/blob/master/device/ks0108_Device.h

I'm currently stuck with my attempts at helping port 3-chip devices to pyLCD. However before I made some minor edits to the 'set_column()' block inside of the 'ks0108.py' file the program would crash if I set the 'self.columns' value in the same file to '192' So I apologize for not being able to help more due to my lack of knowledge with Python..

Kind regards

CatoLynx commented 7 years ago

Okay then, I will check it out when I have time (and hopefully not forget it).