Captouch Test Tool

Introduction

Cap Test Tool is the official Cap-Touch calibration tool developed by Realtek for Ameba series SoC. By communication with corresponding Cap-Touch test daemon on device via UART port, Cap Test Tool can calibrate the general and channel-specific Cap-Touch configurations.

The UI of Cap Test Tool is shown below.

../../_images/cap_tool_test_ui.png

Cap Test Tool UI

Environment Setup

Hardware Setup

The hardware setup is shown below.

../../_images/cap_tool_hardware_setup.svg

Hardware setup

The default UART pins of different ICs for Cap-Touch are listed below:

Default UART pins of different ICs

Ameba SoC

Default UART pins

RTL8730E

  • CAP_UART_RX = PB10

  • CAP_UART_TX = PB11

RTL8726EA
RTL8713EC
RTL8720EA
RTL8710EC
  • CAP_UART_RX = PA0

  • CAP_UART_TX = PA1

RTL8721Dx
RTL8711Dx
  • CAP_UART_RX = PB30

  • CAP_UART_TX = PB31

Software Setup

  • Host:

    • Environment requirements: EX. WinXP, Win 7 or later, Microsoft .NET Framework 4.0.

    • Software location: {SDK}/tools/ameba/CapTestTool/CapTestTool.exe

  • Device:

    • Build images with cap_test_daemon example, refer to {SDK}/component/example/cap_test_daemon/readme.txt for details.

Principle

The capacitance capture circuit adopts constant current source charging and ADC sampling voltage, the simple diagram is shown below.

  • The constant current source I_mbias can be configured to charge the Vt net periodically, and there are parasitic capacitance Cp and touch capacitance Ctouch on the Vt net.

  • Usually for a well-designed PCB, the ratio of Ctouch to Cp is about 1:10 to 1:20, so in fact, the proportion of useful signals is very small.

  • The ADC synchronized with the charge and discharge controller samples the voltage of the Vt net and collects the maximum voltage at the end of the charge.

  • ADC converts analog voltage into digital code identified by MCU for subsequent processing.

../../_images/cap_tool_simple_diagram.svg

Simple diagram

../../_images/cap_tool_waveform_of_vt.svg

Waveform of Vt

As shown below, the Cap-Touch Controller (CTC) scan period consists of active time and sleep time, which can be configured individually for different applications.

../../_images/cap_tool_scan_period_diagram.svg

Scan period diagram

With the disturbance of the surrounding environment, such as temperature, moisture, overlay, or other slight environmental noise, sensor capacitance change is caused. ETC module is designed to track environmental changes and make calibrations.

ETC system tracks the capacitance change and updates the baseline and touch-threshold parameters based on the ETC algorithm periodically. ETC scan interval can be configured by ETC Interval parameter. Users can decide how many intervals of scan periods they need to update the baseline in order to save power consumption.

Manual tuning of ETC parameters is also supported to meet different environments or special applications. Increasing the baseline update step can accelerate the speed of baseline updating. Weighting factor is used as the baseline update principle in the judgment logic module. For each ETC scan period, if the noise difference (baseline - signal) is larger than the factor, the baseline will increase. If the noise difference (baselinesignal) is smaller than the factor, the baseline will decrease.

Configuration

Parameters

General configuration

Parameter

Value

Comment

Scan Interval

0~4095ms

The sleep time of channel after the sensor scanning and data processing. Recommended sleep time is

20~500ms for better response time.

Average Samples

4/8/16/32/64/128/256/512

The sample number of raw data which is used to capture ADC for best accuracy and noise immunity.

Debounce Enable

0/1

The debounce feature avoids false triggering of sensors caused by noise spikes or system glitches.

  • 0: Disabled

  • 1: Enabled

Debounce Count

2/3/4/5

The shorter debounce times, the faster device responds to a sensor touch events.

ETC Enable

0/1

Environment tracking and calibration.

  • 0: Disabled

  • 1: Enabled

ETC Interval

0~127

The count of scan intervals to do ETC update.

Scan period contains active time and scan interval.

ETC_update_interval=(scan_inteval+1)*scan_period

Baseline Update Step

0~15

Baseline update step (2^n) in ETC update principle. Use this parameter to configure baseline update step.

ETC Factor

0~15

Factor weight (2^n) for baseline update principle.

For each ETC scan period, if the noise difference (baseline-signal) is larger than Factor, the baseline

increases. If the noise difference (baseline-signal) is less than Factor, the baseline decreases.

Clock Source

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: OSC

  • RTL8721Dx/RTL8711Dx:

    • OSC

    • XTAL

Sample clock:

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: OSC 131kHz

  • RTL8721Dx/RTL8711Dx:

    • OSC 131kHz

    • XTAL 2MHz Divider

Divider

1MHz/500KHz/250KHz/167KHz/125KHz/62.5KHz/31.25KHz

Sample clock for XTAL 2MHz Divider: max. sample clock is 1MHz, charge time t = 0.us.

Proofing Enable

Disabled

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: Enabled not supported now

Filter Enable

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: 0

  • RTL8721Dx/RTL8711Dx:

    • 0

    • 1

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx:

    • 0: Filter disabled

    • 1: Filter enabled

Average Enable

  • RTL8721Dx/RTL8711Dx:

    • 0

    • 1

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: Average filter for periodic noise (50Hz or 60Hz), active when filter enabled

    • 0: Disabled

    • 1: Enabled

Average MDEC

RTL8721Dx/RTL8711Dx: 0~32767

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: Active when average filter enabled

    • 0: Disable average filter

Median Filter

  • RTL8721Dx/RTL8711Dx:

    • 0

    • 1

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: active when filter enabled

    • 0: Median filter disabled

    • 1: Median filter enabled

IIR Enable

  • RTL8721Dx/RTL8711Dx:

    • 0

    • 1

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: IIR filter for high frequency white noise, active when filter enabled

    • 0: IIR filter disabled

    • 1: IIR filter enabled

IIR A1

RTL8721Dx/RTL8711Dx: 0~65535

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: active when IIR filter enabled

IIR Gain

RTL8721Dx/RTL8711Dx: 0~65535

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: Not supported

  • RTL8721Dx/RTL8711Dx: active when IIR filter enabled

Channel configuration

Parameter

Value

Description

Mbias

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: 1~63

  • RTL8721Dx/RTL8711Dx: 1~255

Sensitivity setting for each channel.

1 LSB = 0.25uA.

Different register bit map:

  • RTL8730E/RTL8726EA/RTL8713EC/RTL8720EA/RTL8710EC: 0.25uA/0.5uA/1uA/2uA/4uA/8uA

  • RTL8721Dx/RTL8711Dx: 0.25uA/0.5uA/1uA/2uA/4uA/8uA/16uA/32uA

Diff Threshold

0~4095

Difference threshold judgement mode operates when ETC function is enabled.

Compare the average sample data with the difference threshold to judge touch or proximity.

Abs Threshold

0~4095

Absolute threshold judgement mode operates when ETC function is disabled.

Compare the average sample data with the absolute threshold to judge touch or proximity.

N Noise Threshold

0~4095

Raw data of the maximum capacitance change caused by the environmental change.

P Noise Threshold

0~4095

Raw data of the maximum capacitance change caused by the environmental change.

Sample Data

0~4095

Real finger touch voltage.

Also named average data.

Baseline Data

0~4095

The reference voltage.

Active when ETC enabled.

Diff Data

-4095~4095

Difference data between average data (sample data) and baseline data.

Active when ETC enabled.

Diff Data = Baseline Data - Average Data

SNR

SNR monitor operates effectively during project development or MP.

\(SNR= |Diff Data (touch signal)|/|Noise (peak-to-peak)|\)

Reload Configuration

  1. Make sure the device is connected.

  2. Go to the Configuration tab.

  3. Click the Reload button.

    Note

    • The configuration will be auto-reloaded when Open button is clicked.

    • When you click Apply or Reload button, both general configurations and channel configurations will take effect simultaneously.

Apply Configuration

  1. Make sure device is connected.

  2. Go to the Configuration tab.

  3. Change the value of parameters listed in Table General configuration and Channel configuration.

  4. Click the Apply button.

Calibration

Using tool to adjust Iref and threshold, it is more convenient to adjust the parameters that meet the performance requirements.

Note

The same set of hardware circuit corresponds to the same set of parameter values. After the hardware circuit is replaced, the calibration parameter values need to be reset.

Cap Test Tool is used as a tool to improve the debugging speed in the development stage, after the parameter calibration of a model product, users need to fill in the suggested parameters given by tool in the SDK code, so as to solidify a set of parameters in FLASH to realize batch operation.

Operational details of the SDK can be provided in the application note.

Iref Calibration

Iref determines the sensitivity.

Theoretically, the larger Iref is, the higher the sensitivity will be. But too high Iref will cause the charging voltage to exceed the measurement range of ADC, so a reasonable Iref should meet the following principles:

  • The sampling value of the untouched state accounts for about 80% of the ADC maximum range. Because the ADC resolution is 12 bits, and the maximum range number code is 4095, it is safer that the sampling value of the untouched state is set at about 3300.

Note

The value filled in the register is only used for tool. When the IC is powered off, the register will be cleared. Therefore, if you want to save the calibration result value, you need to fill the result parameters (Mbias) into the SDK.

The calibration process of Iref is integrated in the tool, and the user is only required to complete the following calibration process:

  1. Make sure device is connected.

  2. Go to the Configuration tab.

  3. Select the checkbox of channels which need to be enabled.

  4. Click the Iref Calibration button.

    Caution

    Don’t touch Cap-Touch pins during Iref calibration process.

  5. Observe the logs and wait the process to complete.

  6. Both mbias and baseline will be calibrated in device, and mbias will be updated in Cap Test Tool.

    ../../_images/cap_tool_iref_calibration_operation.png

    Iref calibration operation

Threshold Calibration

The threshold (Diff threshold) determines the reliability and flexibility of the touch operation. Too high threshold may cause the touch to be accurately identified, and too low threshold may cause false trigger operation. Therefore, a reasonable threshold should be personalized according to the test results of the actual circuit. Generally, it is recommended to set the threshold at 80% of the touch value.

Calibration program adopts the way of touch with manual operation, because the tool does not know the size of the touch signal in advance, the user needs to make 2 or 5 standard touches operation after clicking the button to start the task of calibrating the threshold. The task will record the average touch, and after the user clicks the button again to end the task, a reasonable threshold will be automatically filled in the register.

The threshold also includes the noise threshold, which is used to limit the noise range and realize the noise tracking and filtering of the algorithm, usually without too much attention from the user. The user only needs to divide the calibrated Diff threshold by 2 and fill in the SDK as N Noise threshold and P Noise threshold respectively.

The absolute value threshold is the debugging function, which the user does not need to pay attention to, and this parameter limits the touch behavior when the ETC function is disabled.

Note

The value filled in the register is only used for tool. When the IC is powered off, the register will be cleared. Therefore, if you want to save the calibration result value, you need to fill the result parameters (Diff threshold, N Noise threshold and P Noise threshold) into the SDK.

  1. Make sure the device is connected.

  2. Go to the Configuration tab.

  3. Select the checkbox of channels which need to be enabled.

  4. Click the Start Threshold Calibration button.

    The tool starts to print logs.

  5. Touch channels.

    If you want to observe the signals, continue Step 6; otherwise, jump to Step 8.

    ../../_images/cap_tool_threshold_calibration_operation_before_calibration.png

    Threshold calibration operation (before calibration)

  1. Switch to the Monitor tab.

    It only shows Diff Data vs Diff Threshold view. Change the Select Channel(s) box to switch channels.

    Note

    • Diff threshold will be set to the value of 80% of max. diff data.

    • Noise threshold will be set to the value of 40% of max. diff data.

    ../../_images/cap_tool_threshold_calibration_operation_in_calibration.png

    Threshold calibration operation (in calibration)

  2. Switch to the Configuration tab.

  1. Click the Stop Threshold Calibration button.

  2. Cap Test Tool calculates diff threshold and noise threshold, prints log and updates values in cells.

    ../../_images/cap_tool_threshold_calibration_operation_after_calibration.png

    Threshold calibration operation (after calibration)

    Note

    • Threshold calibration only works in ETC-enabled mode.

    • Diff threshold, N Noise threshold and P Noise threshold will be calculated and set to device based on the note in Step 6.

    • Abs Threshold is auto-set in device and won’t be updated after threshold calibration. Please click the Reload button if you want to load Abs Threshold value.

    Caution

    Remember to click the Stop Threshold Calibration button when completes, otherwise the threshold value won’t be calculated.

Monitor

Parameters

Monitor parameters

Parameter

Value

Comment

Debug Enable

0/1

Disabled now.

  • 0: Debug mode disabled/normal mode enabled

  • 1: Debug mode enabled/normal mode disabled

Debug Mode

Manual/Auto

Active when debug enabled.

Debug mode usually works during debug/development process.

Select View

  • Sample Data

  • Average Data vs Baseline

  • Diff Data vs Diff Threshold

  • SNR

Different views of signals.

Displayed Samples

0~400

The sample number of raw data which is captured in active time.

Sample Interval

10~10000ms

Sample interval in active time.

Reset Baseline

  1. Make sure the device is connected.

  2. Go to the Monitor tab.

  3. Click the Reset Baseline button.

    Note

    • It will reset the baseline of all channels.

    • It has no association with the current monitor view.

    ../../_images/cap_tool_reset_baseline_operation.png

    Reset baseline operation

Observe Signals

  1. Make sure the device is connected.

  2. Go to the Configuration:menuselection:` tab, and select the checkbox of channels which need to be enabled.

  3. Go to the Monitor tab.

  4. Change the select View box, and set the values of Displayed Samples and Sample Interval.

  5. Click the Start button and touch channels.

  6. Click the Stop button when completes.

Monitor boards of different views are shown in the following figures.

../../_images/cap_tool_monitor_board_sample_data_view.png

Monitor board (Sample Data View)

../../_images/cap_tool_monitor_board_data_baseline_view.png

Monitor board (Average Data vs Baseline View)

../../_images/cap_tool_monitor_board_diff_threshold_view.png

Monitor board (Diff Data vs Diff Threshold View)

../../_images/cap_tool_monitor_board_snr_view.png

Monitor board (SNR View)

Note

  • In Sample Data and Average Data vs Baseline view, Select Channel(s) could be chosen before/in monitoring status.

  • In Diff Data vs Diff Threshold view, the specific channel configuration could be customized by user before monitor starts.

  • In SNR view, Select Channel(s) is disabled since the signal-to-noise ratio is global data.