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.

  • Hi Martin - I am working with Maddy and our readings are as below. As you can see, if the touch was along x axis the readings were reasonable whereas if the touch was along y axis the readings were going up and down whereas the expected reading was for it to just increase.

    Also, at the edges of the touch panel, we were expecting readings close to zero for both x axis and y axis but they were around 200 for x axis and 400 for y axis.

    Testing along X axis X Y 220 400 225 403 243 398 288 410 325 398

    Results as expected - small variations in Y readings are due to variations in finger touching the pad

    Testing along Y axis X Y 220 425 215 435 223 398 217 470 210 436

    Results NOT as expected - as Y readings are going up and down even though the touch was only in direction of increasing Y

Reply
  • Hi Martin - I am working with Maddy and our readings are as below. As you can see, if the touch was along x axis the readings were reasonable whereas if the touch was along y axis the readings were going up and down whereas the expected reading was for it to just increase.

    Also, at the edges of the touch panel, we were expecting readings close to zero for both x axis and y axis but they were around 200 for x axis and 400 for y axis.

    Testing along X axis X Y 220 400 225 403 243 398 288 410 325 398

    Results as expected - small variations in Y readings are due to variations in finger touching the pad

    Testing along Y axis X Y 220 425 215 435 223 398 217 470 210 436

    Results NOT as expected - as Y readings are going up and down even though the touch was only in direction of increasing Y

Children
No Data
Related