1

I'm working on a raspberry pi (2B) project that is using a Waveshare 7" LCD Capacitive touchscreen that interfaces with the raspberry pi through HDMI (display) and USB (touchscreen).

The installation of the drivers for the touchscreen make the touchscreen and the display work perfectly. However, when I run my python program, which I use to both control GPIO and SPI (used on a 16x2 character display), the GPIO doesn't work any more. Python displays no errors, and the RPi.GPIO and RPLCD modules simply don't do anything.

I can control the GPIOs using the terminal however (although I don't know how to use the SPI pins through the terminal), so I know that fundamentally it should still work. (I am able to light the backlight of the character LCD by using the GPIO output in the terminal).

The installation of the touchscreen drivers uses a script that replaces the following files and folders:

  1. /boot/kernel.img
  2. /boot/kernel7.img
  3. /boot/config.txt
  4. /lib/modules/

The config.txt file only enables the display to work as far as I can gather. The driver script also replaces /lib/modules with a folder named '3.18.6-v7+' instead of what I normally have in there, which is '4.1.6-v7+' and '4.1.6+'.

I've tried enabling the device tree and SPI in using raspi-config in the terminal, but this doesn't seem to change anything unless I am in my initial configuration without the touchscreen drivers. I should note that if I replace the kernels with the original files, the touchscreen stops working (display still works), but the GPIOs start working again.

The main problem is that I can't get the touchscreen and the GPIO's through python working at the same time. Is there something fundamental that I am missing here? Are the modules in 3.18.6-v7+ not compatible with RPi.GPIO and RPLCD? Applying updates like rpi-update, or sudo apt-get update/upgrade will revert things to a state with the touchscreen disabled and the GPIOs working.

Edit: I'm not allowed to comment yet on this site, so I'll state here that I have tried using WiringPi and WiringPi2 GPIO libraries in Python with no effect. I know that there are many others out there, so I'll try some others to see if there is another solution.

  • RPi.GPIO had a bug where it would not work on a Pi2 if device tree was disabled. I thought that was fixed but it may be what you are seeing. There are other Python modules to manipulate the GPIOs. – joan Sep 8 '15 at 8:23
1

After some research, I found someone else who had the same problem and was able to write a custom touchscreen driver to solve it (Note: They wrote the driver, not me). Now the touchscreen works with the GPIO pins working in python as well. This is because I did not need to replace the original kernels when installing this driver. The package can be found here with installation instructions if anyone else has this problem:

https://github.com/derekhe/wavesahre-7inch-touchscreen-driver

The typo in the 'wavesahre' part is intentional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.