Frequency Hop Auto-Tune Module

Last modified by Microchip on 2026/02/24 14:22

The Frequency Hop Auto-Tune module in Microchip’s Touch Modular Library is designed to automatically optimize the acquisition frequencies used for capacitive touch sensing. This feature enhances noise immunity by dynamically selecting the best frequencies for touch measurements, reducing the impact of environmental interference.

Frequency Hop Autotune Typedefs and Structures

qtm_freq_hop_autotune_config_t

typedef struct
{
 uint16_t num_sensors;
 uint8_t num_freqs;
 uint8_t *freq_option_select;
 uint8_t *median_filter_freq;
 uint8_t enable_freq_autotune;
 uint8_t max_variance_limit;
 uint8_t autotune_count_in_limit;
}qtm_freq_hop_autotune_config_t;

Description: Frequency Hop Auto-Tune Nodule Configuration

More Info: Here is a description of each of the elements in this structure:

ParameterSizeRange/OptionsUsage
num_sensors1 byte0 – 255The number of sensors to buffer data for the median filter
num_freqs1 byte3-to-7The number of frequencies to cycle/depth of the median filter
*freq_option_selectPointer 2/4 bytesPointerPointer to the acquisition library frequency selection parameter
*median_filter_freqPointer 2/4 bytesPointerPointer to the array of frequencies to be used on median filter samples
enable_freq_autotune1 byte0 or 1Disable (0) or enable (1) automatic retuning of hop frequencies
max_variance_limit1 byte1-to-255Signal variance required to trigger retuning of hop frequency
Autotune_count_in1 byte1-to-255The number of occurrences of max_variance_limit to trigger returning of hop frequency

Back to Top

qtm_freq_hop_autotune_data_t

typedef struct
{
 uint8_t module_status;
 uint8_t current_freq;
 uint16_t *filter_buffer;
  qtm_acq_node_data_t *qtm_acq_node_data;
 uint8_t *freq_tune_count_ins;
}qtm_freq_hop_autotune_data_t;

Description: Frequency Hop Auto-Tune Module Status Data

More Info: Here is a description of each of the elements in this structure:

ParameterSizeRange/OptionsUsage
module_status1 byteN/AModule status – N/A
current_freq1 byte0-to-15Current frequency step
*filter_bufferPointer 2/4 bytesPointerThe pointer to the filter buffer array for measured signals
*qtm_acq_node_dataPointer 2/4 bytesPointerThe pointer to the node data structure of the acquisition group
*freq_tune_count_insPointer 2/4 bytesPointerPointing to the counter array to trigger frequency change

Back to Top

qtm_freq_hop_autotune_data_t

typedef struct
{
  qtm_freq_hop_autotune_data_t (*qtm_freq_hop_autotune_data);
  qtm_freq_hop_autotune_config_t (*qtm_freq_hop_autotune_config);  
} qtm_freq_hop_autotune_control_t;

Description: Frequency Hop Auto-Tune Module combination of configuration and status data

 

Back to Top

Frequency Hop Autotune Application Programming Interfaces (APIs)

qtm_freq_hop_autotune

touch_ret_t qtm_freq_hop_autotune(qtm_freq_hop_autotune_control_t
*qtm_freq_hop_autotune_control);

Description: Performs the frequency hopping auto-tune algorithm.

Parameter: qtm_freq_hop_autotune_control_t *qtm_freq_hop_autotune_control - Pointer to Frequency Hop Autotune Control Structure

Return: touch_ret_t

More Info: The algorithm does the following:

  • Measure noise in the signal value and based on the noise level, change the frequency-set used for acquisition.
  • Choose the next measurement's frequency from the frequency-set and perform median filter on the signal value (should be called after calling qtm_acquisition_process())

Back to Top

qtm_get_freq_auto_module_id

uint16_t qtm_get_freq_auto_module_id(void);

Description: Returns the Module ID

Parameter: void

Return: uint16_t Module ID

Back to Top

qtm_get_freq_auto_module_ver

uint8_t qtm_get_freq_auto_module_ver(void);

Description: Returns the Module Firmware Version

Parameter: void

Return: uint8_t Module Firmware Version - Upper nibble major / Lower nibble minor 

Back to Top