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.

  • main.c

    We changed the pins to P0.03 (x plus), P0.04(y plus) to act as digital I/O and analog pins and P0.28(x minus) and P0.29(y minus) and this seems not to cause the loop forever. Also I have disabled the analog input's explicitly like we discussed. Thanks for the valuable suggestion Martin. We owe you one!

Reply Children
No Data
Related