Frequency Hop Module

Last modified by Microchip on 2026/02/23 13:32

The Frequency Hop module helps the touch controller avoid interference from external noise sources (such as power lines, switching power supplies, or other electronic devices) that can affect touch detection accuracy. It achieves this by dynamically changing (or "hopping") the acquisition frequency used for touch measurements. By cycling through multiple frequencies, the system can minimize the impact of noise that may be present at a specific frequency.

Frequency Hop Typedefs and Data Structures

qtm_freq_hop_config_t

typedef struct {
   uint16_t num_sensors;
   uint8_t num_freqs;
   uint8_t *freq_option_select;
   uint8_t *median_filter_freq;
} qtm_freq_hop_config_t;

Description: Frequency Hop configuration 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_select2/4 bytesN/AThe pointer to the acquisition library frequency selection parameter
*median_filter_freq2/4 bytesN/AThe pointer to the array of selected frequencies

Back to Top

qtm_freq_hop_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;
} qtm_freq_hop_data_t;

Description: Frequency Hop data structure

More Info: The follow describes the individual members of the structure:

ParameterSizeRange/OptionsUsage
module_status1 byteN/AModule status – N/A
current_freq1 byte0-to-15Current frequency step
*filter_buffer2/4 bytesN/AThe pointer to the filter buffer array for measured signals
*qtm_acq_node_data2/4 bytesN/AThe pointer to the node data structure of the acquisition group

Back to Top

qtm_freq_hop_control_t

typedef struct
{
    qtm_freq_hop_data_t (*qtm_freq_hop_data);
    qtm_freq_hop_config_t (*qtm_freq_hop_config);
} qtm_freq_hop_control_t;

Description: Frequency Hop combined configuration and data structure

Back to Top

Frequency Hop Frequency Selection

The Frequency Hop module achieves better noise immunity by cycling through a series of acquisition frequencies to avoid noise at any one sampling frequency. It varies the acquisition frequency by inserting a delay of 0 to 15 PTC clocks into the acquisition cycle. For example, the table below illustrates the list of supported frequencies for a PTC clock of 4 MHz.

PTC Frequency Delay CyclesAcquisition Frequency (kHz)
0FREQ_SEL_066.67
1FREQ_SEL_162.5
2FREQ_SEL_258.82
3FREQ_SEL_355.56
4FREQ_SEL_452.63
5FREQ_SEL_550
6FREQ_SEL_647.62
7FREQ_SEL_745.45
8FREQ_SEL_843.48
9FREQ_SEL_941.67
10FREQ_SEL_1040
11FREQ_SEL_1138.46
12FREQ_SEL_1237.04
13FREQ_SEL_1335.71
14FREQ_SEL_1434.48
15FREQ_SEL_1533.33
16FREQ_SEL_SPREADVariable frequencies

Back to Top

Frequency Hop APIs

qtm_freq_hop

touch_ret_t qtm_freq_hop(qtm_freq_hop_control_t *qtm_freq_hop_control)

Description:
Performs Frequency Hopping Algorithm
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()

Parameter:

TypeDescription.
qtm_freq_hop_control_t*Pointer to Frequency Hop Control structure.

Return:

TypeDescription.
touch_ret_tTouch Library Return Status

Back to Top

qtm_get_freq_hop_module_id

uint16_t qtm_get_freq_hop_module_id(void)

Description: Returns the module ID

Parameter:

TypeDescription.
NoneNone.

Return:

TypeDescription.
uint16_tModule ID

Back to Top

qtm_get_freq_hop_module_ver

uint8_t qtm_get_freq_hop_module_ver(void)

Description: Returns the module Firmware version

Parameter:

TypeDescription.
NoneNone.

Return:

TypeDescription.
uint8_tModule version

Back to Top