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.

  • Martin, the Y position value is somehow not right. The pin handler disables the event to release the x plus from GPIOTE module and make it work like a plain GPIO. It's pulled high as digital input and if the user has touched the screen, it configures the x plus to digital out and drives high to calculate x position and then configures the x plus pin as analog input AIN1 to calculate the Y direction. When it does so the Y position value is not as we expect it to be. Could you think of any possible reason as to why the value is not right ? We tried increasing the settling delay for the pins, yet it did not make any difference.

Reply
  • Martin, the Y position value is somehow not right. The pin handler disables the event to release the x plus from GPIOTE module and make it work like a plain GPIO. It's pulled high as digital input and if the user has touched the screen, it configures the x plus to digital out and drives high to calculate x position and then configures the x plus pin as analog input AIN1 to calculate the Y direction. When it does so the Y position value is not as we expect it to be. Could you think of any possible reason as to why the value is not right ? We tried increasing the settling delay for the pins, yet it did not make any difference.

Children
No Data
Related