GithubHelp home page GithubHelp logo

Comments (5)

leonard-voss avatar leonard-voss commented on August 21, 2024 2

I'll try it out and get back to you...

Alright, so I downloaded the gt911.py again to ensure all changes I previously made were undone.

Afterwards I checked my wiring and guess what: I found an wiring issue.
So i fixed my wiring and also changed the call of the GT911 object (removing rst_pin, adding i2c_address).

I executed the code and it now works fine!

Here is my final working code:

import time
import board
import gt911
import digitalio

interrupt_pin = digitalio.DigitalInOut(board.D24)

i2c = board.I2C()

gt = gt911.GT911(i2c=i2c, int_pin=interrupt_pin, i2c_address=0x5d)

while True:
    # Wait for a touch on the display
    for i, touch in enumerate(gt.touches):
        x, y, a = touch
        print(f"[{i+1}]({x},{y}) size:{a}")
    time.sleep(0.2)

Display I used: Phoenix Contact BC 107,6 DKL R D2,4 TCG KMGY VPE1 - Housing cover with touch display

And here you can see my wiring:

SDA (Display) - GPIO2 (Pin3) Raspberry Pi
SCL (Display) - GPIO3 (Pin5) Raspberry Pi
INT (Display) - GPIO24 (Pin18) Raspberry Pi

I also wired the RST pin, but not used it in the code, so you can remove it:
RST (Display - GPIO23 (Pin16) Raspberry Pi)

Thank for your great and fast support! :)

from circuitpython_gt911.

rgrizzell avatar rgrizzell commented on August 21, 2024

I don't have another GT911 screen to test with, but there shouldn't be any reason why this couldn't also work for Blinka.

If the Raspberry Pi doesn't support the OPEN_DRAIN mode, then leaving out the interrupt pin might be necessary. The I2C address can also be manually passed if the default doesn't work. In your case it would look like: gt = gt911.GT911(i2c, i2c_address=0x5d, rst_pin=reset_pin)

If that's not an issue and you continue to receive the Input/output errors from CircuitPython, then it might be worth checking to see if another I2C device will work. Alternative you can try to read the register manually using Adafruit BusDevice library. I suspect the problem might be Linux-related, but don't know for certain. The results of those tests would help.

from circuitpython_gt911.

leonard-voss avatar leonard-voss commented on August 21, 2024

If the Raspberry Pi doesn't support the OPEN_DRAIN mode, then leaving out the interrupt pin might be necessary. The I2C address can also be manually passed if the default doesn't work. In your case it would look like: gt = gt911.GT911(i2c, i2c_address=0x5d, rst_pin=reset_pin)

Adjusting the I2C address as a parameter sounds good, I'll try that out. However, I don't think simply omitting the INT and possibly the RST function is a good solution to the problem. This could possibly waste a lot of computing time and does not guarantee that the display is in a defined initial state. I'll try it out and get back to you...

from circuitpython_gt911.

rgrizzell avatar rgrizzell commented on August 21, 2024

However, I don't think simply omitting the INT and possibly the RST function is a good solution to the problem.

On the GT911, the INT pin is an optional feature. It's used to control the addressing of the device. Depending on the state of the pin, the address is either 0x14 or 0x5d. Once the chip is initialized the pin is then used to signal when a touch is available. If memory is correct, it essentially requires the GPIO input pin to act as a ground, hence the OPEN_DRAIN mode.

Most microcontrollers have issues with handling those interrupts in software, and some board makers haven't bothered to wire it up. On some of those boards, the RST pin is also just wired up to power.

In order to allow this driver to work on those boards, the INT and RST pins needed to be optional. In your case it might even help get you up and running. You can keep the RST pin, but try initializing without the INT pin.

If that works for you, I'll patch in an extra parameter that'll disable the touch interrupt support (disable OPEN_DRAIN) and we can go from there.

from circuitpython_gt911.

rgrizzell avatar rgrizzell commented on August 21, 2024

If memory is correct, it essentially requires the GPIO input pin to act as a ground, hence the OPEN_DRAIN mode.

I'll be real here, I think this is where I messed up. It might work if it's in a PUSH_PULL drive mode with the line pulled Down.

from circuitpython_gt911.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.