Spanish Italian
17432 Users    

How to configure the TSS (Touch Sensing Software)

  Download PDF version of the Article

Last week we saw how we can create a TSS (Touch Sensing Software) project. Now, let's see how to configure the TSS and the steps required to initialize and configure TSS.

Initialize the MCU bus, peripherals, and clocks by using the Device Initialization Tool integrated within the Freescale CodeWarrior IDE. The TSS library does not perform any device initialization other than selected GPIO and timer modules.

To initialize the TSS, call TSS_Init() function after initializing the MCU bus. This function returns an error code if the TSS was not configured correctly, and returns zero otherwise.

TSS - Touch Sensing Software- Configuration

You can configure the TSS by calling TSS_SetSystemConfig() function. This function changes values in the TSS configuration registers. If you attempt to change any configuration register manually, the library determines this as a memory corruption. The next time when TSS runs, it reports that by signalling Data Corruption Fault.

To change any configuration, you must call TSS_SetSystemConfig() function with the register that is to be changed. The new value for that register is passed as a parameter to TSS_SetSystemConfig() function. The TSS then writes the new value to the configuration register, and calculates the new checksum for all the configuration registers.

The easiest way to configure these registers is to first configure the System Response Time Register that determines how fast the TSS responds to any variances in the system. Next, you can set the DCTrackerRate (if enabled) and the sensitivity for all the electrodes. To set the sensitivity of electrodes, set each electrode individually. When setting the sensitivity of each electrode, you must use the macro, System_Sensitivity_Register, and add a number, where the number is the electrode that you wish to configure.

Setting_Electrodes_Sensitivity How to configure the TSS (Touch Sensing Software)

Control Structure Configuration
To configure the control structure, you must configure each control register. The keypad structure is configured to enable events for touch and release for this control. It is then configured to allow a maximum of two keys that are simultaneously active at any time. If the system were to find more than two keys pressed, then it does not send back a key press for the new keys that were pressed. Lastly, it is configured to enable the control and to enable the callback whenever there is a change in events.

TSS Control Structure Configuration Example

Callback Function
After the system is completely configured, it is the time to create callback routine that is generated whenever there is a new event in the system. The callback function is created as:

void fCallBack1(TSS_CONTROL_ID u8ControlId)

The parameter u8CtrlId is the ID of the control that generated the callback. Read all the events that have been generated. To do this, the event buffer can be read until it is empty and all the pending events in the control are executed.

void fCallBack1(TSS_CONTROL_ID u8ControlId)
{
if(cKey0.Events.BufferOvfFlag == 1)
{
cKey0.BufferReadIndex = cKey0.BufferWriteIndex;
(void) TSS_KeypadConfig(u8ControlId, Keypad_Events_Register, 0u);
}
(void) u8ControlId;
fm_write_index1 = cKey0.BufferWriteIndex-1;
Read_Touch_Buffer(fm_keypad_buffer1, cKey0);
return;
}

Timer Configuration
There are several ways to set the timer overflow vector. Out of which, one way to set the timer interrupt is by using the PRM file. You need to set the vector number used by the timer overflow vector. Refer to the MCU's Reference Manual to obtain the timer overflow vector number for the MCU to be used.

tss timer configuration exemple

Main Loop
For TSS to operate correctly, you must call TSS_Task() function periodically within the main loop.

Application Interrupt Management
The TSS leaves interrupts enabled while taking electrode measurements. Therefore, it is easy to get user's application interrupt electrode measurements when a user interrupt occurs. For TSS to identify whether an electrode measurement is interrupted, it is necessary to include ATL_SET_SAMPLE_INTERRUPTED() macro within every user interrupt. The TSS_API.h file must also be included as it contains interrupt routine.

Application_Interrupt_Management_Example TSS

TSS System Calibration and Parameter Tuning
In a typical user application, electrode sampling parameters (like sensitivity) must be set up carefully. Freescale Semiconductor provides the TSS Electrode Graphing Tool (EGT) that can communicate with the target application and visualize real-time data processed by the TSS library. The EGT comes with a simple communication protocol implementation for USB, IIC, or other physical interface.

Reference
TSS: Touch Sensing Software Suite

CONTACT REQUEST
If you want to know more about this Freescale product, please submit your request to Arrow Italy using this form.

NOTE: this form is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

This would surely be

This would surely be interesting to know.www.cypress.com/

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
11 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Who's new

  • christiank79
  • agabor
  • fabriziopd
  • irenix
  • pepershoe
  • raghun14
  • andreaspousette
  • rilhyk
  • thientruong
  • snaku

Who's online

There are currently 0 users and 44 guests online.