2025-01-09 12:53 AM
i have written a driver code to run 4 wire resistive touch panel. I use only 1 adc and change its adc channel during runtime. Like i set X+ and Y+ as output high by default and X- and Y- set as low by default and set X- and y- pull down to make ADC read 0 when not pressed. Basically, I have few functions that change the configuration such as X+ and X- to output, set Y+ to analog and Y- to input to set Y+ and Y- as an output, set X+ to analog and X- to input. read x voltage in previous case and read y voltage in later case. ADC is only one to switch the configuration during runtime and its resolution is 16 bit with 810.5 cycles sampling time.
ISSUES:
1- gpio output 3.3v and ground but its adc measuring voltage is from (0.7 to 1.15 for x axis) and (0.55 to 2.8 for y axis)
2- if i move the wires then its voltage ranges change.
Is this issue related with the firmware developed for running the 4-wire touch panel or hardware issue?
I have connected decoupling capacitors of 0.33uF across X+ AND X- and Y+ and Y- as well to stablize the 3.3v source from the mcu gpios.
Looking for your precious advice and solution!!!!
2025-01-17 08:54 AM
The capacitance of those wires shouldn't make a significant difference. I suspect the delay between switching and sampling is too low. Please plot scope data.
2025-01-18 05:42 AM
Hi there,
Hope you are doing well.
I understood that we need to give some delay after reconfiguring the ADC channels and gpio, stop sampling, and start it just after switching before adc_start_conversion() for the initial channel and gpio configuration.
This is what I got.
Thanks for the precious advice.
Waiting for your response as well
2025-01-18 11:00 AM
Exactly. The foil has resistance and capacitance, so there is a delay. Not much, but if you sample right away the voltage hasn't stabilized yet.