Using PTC (Peripheral Touch Controller)

The QTouch Peripheral Touch Controller (PTC) subsystem offers built-in hardware for capacitive touch measurement on sensors that function as buttons, sliders and wheels. The PTC subsystem supports both mutual and self-capacitance measurement without the need for any external component. It offers sensitivity and noise tolerance, as well as self-calibration, and minimizes the sensitivity tuning effort by the user.

For more details regarding the PTC please check the SAMA5D2 Datasheet.

Probing

ALERT! Starting with release Linux4sam 6.0, the ptc overlay (#ptc) must be applied, in order to enable the PTC. For more details on how to apply device-tree overlays, please see DT-Overlay.

Play with the demo

First of all, don't be worried by the following logs:

atmel_ptc 800000.ptc: Loading configuration: microchip/ptc_cfg.bin
atmel_ptc 800000.ptc: Direct firmware load for microchip/ptc_cfg.bin failed with error -2
atmel_ptc 800000.ptc: Can't load configuration microchip/ptc_cfg.bin
atmel_ptc: probe of 800000.ptc failed with error -2

It happens only because the ptc_cfg.bin file is missing. It is the configuration file loaded by default. As we don't know which wing you are going to use there is no default configuration file provided. If you want to use a specific configuration file, you can use the PTC driver parameter configuration_file.

Helper scripts are provided in the home directory to remove the atmel_ptc module as it has not been probed successfully during the boot time and to insert the module with the appropriate configuration file:

# ls
start_ptc_qt1_mutual_demo  start_ptc_qt2_mutual_demo
start_ptc_qt1_self_demo    start_ptc_qt6_mutual_demo

Launch the script matching the QT wing you are using. For instance, for the QT1 Mutual Capacitance, do:

# ./start_ptc_qt1_mutual_demo
remove atmel_ptc driver...
load atmel_ptc module with ptc_cfg_qt1_mutual configuration...
atmel_ptc 800000.ptc: Loading configuration: microchip/ptc_cfg_qt1_mutual.bin
atmel_ptc 800000.ptc: firmware version: PPP_VER_006.004, tool version: MQC_VER_102
atmel_ptc 800000.ptc: date: 201802221828, description: qt1mc parameters
input: atmel_ptc_buttons as /devices/platform/ahb/ahb:apb/800000.ptc/input/input3
input: atmel_ptc_slider as /devices/platform/ahb/ahb:apb/800000.ptc/input/input1
input: atmel_ptc_wheel as /devices/platform/ahb/ahb:apb/800000.ptc/input/input2
start ptc_qt1_mutual_demo...
demo running...

Then you can play with the wing. Hit Ctrl-C to stop the demo.

ALERT! If you want to switch to another wing, please reboot the board.

ALERT! Because of pinmuxing constraints, some LEDs or sensors are not working, it's not a bug!

You can find the source code of the PTC examples here: ptc_examples page.

r6 - 16 May 2023 - 09:44:45 - VarshiniRajendran
 
Linux & Open Source for AT91 Microchip Microprocessors

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Microchip® and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries. This site is powered by the TWiki collaboration platform

Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM