This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52DK + 4 wire resistive touch interface

main.c

We have interfaced 4 pins of touch screen to nRF52DK pins P0.04, P0.05,P0.06, P0.07 and pulled the pin P0.04 high to detect the touch by configuring the pin to sense high to low transistion and it detects the touch first time. No issues there and the IN register confirms the bit P0.04 set to 1 when pulled high. And when a touch is detected, the handler function calculates the x and y position by configuring the pins P0.04 as analog AIN2 and P0.05 as AIN3. The handler function does this calculation as long as it detects touch and when there is no touch it exits and waits for another touch event. However in our case when it configures the pin again to detect touch by pulling the P0.04 high, the corresponding bit in the IN register is not set to 1 and is 0 and always return's true.This is causing the handler to loop forever. Should we ought to disable the analog pin's P0.04 and P0.05 explicitly to NRF_SAADC_INPUT_DISABLED by using function before we configure it as digital input with pull up. Attached is the source code with enough comments.

Cheers, Maddy

PS: I don't own the DK and the touch interface at the moment to test it and the testing was done remotely by setting the Eclipse to debug. Would really appreciate any help.

Parents
  • Hi,

    This sounds somewhat related to this issue that we are still investigating. But as you suggest, you should explicitly disable the input. Otherwise the SAADC will still be "attached" to the GPIO pad internally which may affect the logic levels. Can you try and see what happens?

    Note that by default, P0.05 on the nRF52 DK is used for UART communication with the onboard Segger MCU. Unless you have cut solder bridge SB13 this could also interfere with your measurements.

  • I have never used a resistive touch screen before, so I don't really know what to expect.

    1. Would it be possible to use a pot meter instead of the touch screen to measure that the ADC readings actually work? That way we could rule out the ADC and blame the touch screen (or some other external factor).
    2. Is it somehow possible to measure the resistance and/or voltage across the resistive touch screen with a multimeter and compare the results with the ADC readings?
Reply
  • I have never used a resistive touch screen before, so I don't really know what to expect.

    1. Would it be possible to use a pot meter instead of the touch screen to measure that the ADC readings actually work? That way we could rule out the ADC and blame the touch screen (or some other external factor).
    2. Is it somehow possible to measure the resistance and/or voltage across the resistive touch screen with a multimeter and compare the results with the ADC readings?
Children
No Data
Related