NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Sitara ADC/Touchscreen Overview
Contents
Supported Platforms[edit]
This document details information regarding the touchscreen and ADC subsystem for AM335x. For AM437x, the same concepts applies to ADC0.
Simplified Hardware Overview[edit]
This page and the below diagram knowingly excludes and simplifies the various blocks that are a part of the Touchscreen/ADC subsystem. A detailed description of the ADC/Touchscreen IP can be found in the AM335x and AM437x Technical Reference Manual. The purpose of this page is to provide a brief overview of the IP as it relates to the customer usage of the touchscreen and general purpose ADC driver.
The first thing to take away from the diagram is that the ADC and resistive touchscreen subsystem is handled by a single IP block. There are also two FIFOs that can be used to store values. This will be discussed some more in the software overview section. Also the 8 ADC pins are muxed together and connected to a single Analog Front End (AFE). This means even when trying to sample multiple channels together (resistive touchscreen or ADC continuous mode) the hardware will sample each channel sequentially rather than in parallel. Therefore, the more channels being sampled at a time the longer the total sample conversion will be.
Simplified Software Overview[edit]
Although the touchscreen and ADC are handled by a single block of IP three separate drivers are needed to properly support using a resistive touchscreen, general purpose ADC and synchronizing access of the IP between the two drivers.
- Touchscreen Driver – Handles configuration of IP based on touchscreen usage. Handles the various touch events. Passes touch coordinates pressure and touch events to higher level kernel input layer.
- Driver Location: <kernel src>/drivers/input/touchscreen/ti_am335x_tsc.c
- ADC Driver – Used to handle traditional adc usage. Uses the IIO framework to support reading the ADC using one shot mode ( reading a single channel once ) and continuous mode ( read one or more channels repeatedly times).
- Driver Location: <kernel src>/drivers/iio/adc/ti_am335x_adc.c
- Multi-Function Driver (MFD) – The multi-function driver is used to coordinate actions between the touchscreen and adc driver. Since both of these drivers utilize the same IP the MFD driver needs to insure that only one driver has access to the IP at a single time.
- Driver Location: <kernel src>/drivers/mfd/ti_am335x_tscadc.c
Part of the challenge of having one IP supporting two different functionalities is that additional care must be taken to insure that adc samples requested by one driver isn’t mixed in with samples from the other driver. For example using the generic ADC driver to read channel X but then having its value being mixed in with the touchscreen driver trying to calculate the x and y coordinate will cause all sorts of problems. To avoid the above issue each driver only uses one of the two FIFOs within the ADC. FIFO0 is used only by the touchscreen driver and FIFO1 is used by the ADC driver.
Facts and Limitations[edit]
Based on the simplified software and hardware overview several limitations exist that can affect usage and performance of the driver.
- IRQ for touchscreen and general purpose ADC are shared so any interrupts enabled by one driver will cause the interrupt service routine (ISR) for both drivers to run if they are both enabled..
- Since ADC channels are muxed, the total conversion time scales based on the total amount of ADC channels being read at one time.
- Settings in the CTRL register like ADC_ClkDiv will affect both the ADC and touchscreen.
- Since the touchscreen driver uses asynchronous hardware trigger (finger/stylus), the general purpose ADC driver can be interrupted to process touch events which can delay receiving ADC results.
- If both of the drivers attempt to use the ADC subsystem at the same time the driver that requested access last may be delayed until the other driver has completed its operation. If the touchscreen driver ends up being delayed then pen down events may be missed. Although, unless some kind of drawing or paint application is being used these missed events are not noticed. If the ADC driver ends up being delayed then the amount of time required to get its results may increase.
- When using one shot mode only a single channel can be sampled at a time. An error will be given if there is any attempt to read any channel before the previous request has been completed.
- External hardware events can trigger an ADC conversion. However, if the resistive touchscreen is used no hardware event can be used to trigger the start of conversion for the general purpose ADC.