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.
- 1 CC32xx ADC : How to use this peripheral...
- 1.3Battery voltage measurement
- 1.3.4Important considerations
- 1.3.4.1Droop correction
- 1.3.4Important considerations
- 1.3Battery voltage measurement
Are you using the ADC on the CC32xx Family of devices?
CC3200 Antenna Selection is method by which user can configure the WLAN RF Antenna on the CC3200 device from a Browser. The CC3200 device scans the Access Points with 2 different Antennas, stores the SSID and RSSI information in the memory and create an HTML page. User can open the HTML page and select the Antenna which he/she wants to configure. The CC3200 has the capability for Over-the-Air programming which allows for files to be written and updated over a network connection. An OTA programming library is available in the CC3200 SDK. The OTA update scheme relies on a subroutine that periodically checks with a remote OTA server to see if there are any available file updates. Cc3200tool can upload NWP/MAC/PHY firmwares (/sys/servicepack.ucf), but it seems this only works on a clean FS. The tool also implements the functionality described in TI's Application Note CC3100/CC3200 Embedded Programming. This runs on Python =3.6 with recent pySerial. To install, if you have pip and want system-wide.
Are you seeing un-expected results?
If yes, please spend some time on this page...
Introduction
[edit]
The CC32xx family of devices has an internal ADC which operates at 500Ksps with 12-bits of resolution.
The ADC has 8 analog inputs, of which 4 are available for the user on external pins, while the remaining 4 are used for on internal signals.
The external analog inputs are available on pins 57, 58, 59, 60. Of these, pin 57 is used as UART on the Launchad, thus it is not available to be used as and ADC input while debugging.
The 8 analog inputs are sampled in a round robin method (i.e. the ADC samples input1, input2 .... input8, input 1..... continuously) creating a effecting sample rate of 62.5KHz (500Ksps/8) at each pin.
Once connected to the external pin, the ADC continuously samples the pin and the contents are available to be read out using the corresponding API.
Note : In this application note, the figures may refer to the CC3200 but the same applies to the CC3220 as well.
ADC characterestics[edit]
Important :
The inputs to the ADC are required to be well within 1.4V to avoid clipping, which will cause distortion.
The ADC inputs can be damaged if an input voltage higher than 1.8V is applied to these pin. The 1.8V hard limit must be considered from both the SW and HW points of view.
Always add a resistor divider/buffer to bring down the measurement signal voltage to within the ADC limits.
Input impedance
The internal circuit of the ADC alone is stated in the datasheet. However, in addition to the sampling capacitors, there are additional muxes in the path which adds it's own capacitance.
All of these capacitance add in parallel to create an equivalent capacitance of about 12pF at the device pin.
Transfer function
The most obvious way to think about an ADC is to picture it as a multimeter. Apply an input voltage to the pin , configure the ADC to read the pin, read the output register and then convert it to an equivalent voltage using the expression V = code * Vref/2^N where,
Vref is the reference voltage(1.467V)
N is the number of bits (N = 12) and
code refers to the output of the ADC read back from the internal register.Note that the bits 13:2 are the actual ADC codes.
Though this assumption is true to some extent, there are some pitfalls.
1. The multimeter offers a high impedance input under all conditions whereas the ADC does draw current from the input.
2. The multimeter does some averaging on the input signal wheras the ADC is a spot measurement.
These two characters make the ADC a bit difficult to work with.
Let's look at a few example measurements...
Battery voltage measurement[edit]
The most widely used case of the ADC is to measure the voltage of the battery to give an indication to the user, or to take some evasive action before shutdown. Since the input range of the ADC is limited to 1.4V max and the battery voltage can vary from 2.3V to 3.3V depending upon the battery type and age, some scaling of the signal is required. This scaling can easily be implemented using a resistive divider network. Let us assume that the max voltage = 3.3V. Then we can scale 3.3V using the scaling factor of 1.4V/3.3V.
Simple resistive divider (Not recommended)
[edit]
Let us consider the case where R1 = 220K and R2 = 150K as shown for the voltage divider in the figure below.
In the figure above, the switch represents the ADC sampling. While in the sampling phase, the switch will be closed for a duration of 400ns. During this phase the internal capacitor (12pF) gets charged from the external voltage divider.
The thevenin's equivalent circuit for the external circuit is shown in the figure below.
Using the standard capacitor charging equation, we can calculate the voltage at the capacitor at the end of the sampling time (400ns)
Using Vc = V (1 - e^(-t/RC)), we get the final voltage on the capacitor at the end of 400ns as 0.42V.
Note that the error is very large in this measurement and this is not a good method of measurement. This error however can be overcome by adding a capacitor at the ADC pin as shown the following section.
Resistive divider with buffer capacitor (Recommended)
[edit]
Cc3200 Sdk
With the above circuit, the external capacitor gets charged to 1.34V through the resistor divider while the ADC is not connected to the pin. When the ADC is connected to the pin, the internal capacitor starts to charge from the external capacitor. Since the switch resistance is negligible and the external capacitor is quite large compared to the internal one, the 12pF cap can charge to the final value of 1.34V.
The external capacitor is calculated based on the following calculation. Assuming that the Cin is charged from Cext fully, this will result in a charge re-distribution. Assuming that the entire charge is supplied from the Cext, we should not let the Cext voltage drop below 1LSB of the ADC. So we can calculate
Cext = Cin x 4096 which gives 50nF. For margin we can assume 2x the calculated value and use 100nF (0.1uF).
Note that the use of the external capacitor restricts the measurement bandwidth. Neglecting the effect of Cin (too small comprated to Cext), the overall 3dB bandwidth is limited to 1/(2*pi* R*Cext) where R is the parallel combination of R1 and R2.
In this particular case, the bandwidth is 17.8 Hz, which is good enough to estimate battery voltage as it will smoothen down fast transients dips due to peak currents.
Further averaging has to be performed in software to get better estimate of the voltage.
A few points to consider
1. The equivalent resistance of R1 + R2 in series will draw a current of Vcc/(R1+R2) = 3.3V/370K ~= 9uA. If the current draw is a concern, one may be tempted to simply increase the resistor values. However this will slow down the re-charing of the capacitor Cext after the pin is disconnected from the ADC.
2. An alternative is to disconnect R2 from the circuit by using an NMOS transistor controlled by the CC32xx device. This circuit is shown below. In this circuit an additional optional capacitor is shown (C1) which may be used to improve the overall frequency response and speed up the charging time. This capacitor along with R1, R2, and Cext work as a compensated attenuator. Note that this arrangement will however not offer any noise filtering and should be used with caution.
Measurement example
[edit]
In this example, a CC32xx Launchpad is used along with a resistor divider with capacitor as shown in the above section. The divider is connected between 3.3V and ground and th divided output is connected to Pin 58 (P1.2 connector). The setup is shown below.
The default ADC example from the CC3200 SDK 1.2.0 is modified to display the voltage directly. Also the pin is disconnected after the measurements are completed in the modified example.
The reference voltage however is specified as 1.4V in the example SDK. It has to be corrected to 1.467V. The corrected lines are given below
File path : CC3200SDK_1.2.0cc3200-sdkexampleadc
File : main.c
Lines 286 to 293 are modified as below
The voltage measured on the pin is about 1.3V due to tolerance in the resistors used.
The ADC readings are dumped on the terminal using the command 'adcdemo 58'. The contents are stored to a file and then analyzed.
The measured voltage waveform is shown below. (128 readings are taken in this example)
Figure : ADC samples vs time
Important considerations[edit]
Droop correction
[edit]
Note that the internal ADC is continuously running and if the ADC is connected to the external pin, continuous current will be drawn from the external capacitor. This will cause the external capacitor to drop down the voltage with time. Each sample causes a charge re-distribution between the external capacitor Cext and the internal Cin which causes the Cext to discarge. This will cause a measurement error.
Hence for the DC measurement, the ADC pin should be disconnected immediately after the measurement is completed to allow the Cext to recover. This can be done by calling APIs ( ADCChannelEnable() / Disable()) or changing pix-mux to GPIO. The above graph shows an example measurement using the ADC pin 58. The resistors are used as mentioned in above sections with 0.1uF capacitor.
Assuing the Cext is fully charged to V1 = R2/(R1+R2) x Vcc
Each sample will draw approximately Q = Cin x V1 charge from Cext.
Assuming N samples are taken, the Cext will loose NxCin x V1 charge.
The voltage drop in the Cext can be calculated by the below formula
Vdrop = N x Cin x V1 / Cext. (volts)
In this example, by taking 128 samples, the Cext capacitor will drop by about 20mV.
If a simple averaging function is used in the measurement, the measurement error would be Vdrop/2 = 10mV. While this may be acceptable for most applications, it can be improved further by using the below methods.
1. Offset adjustment
Based on the chosen capacitor value and the approximate value of Vcc, we can clearly calculate the expected Vdrop across N samples by using the formula above. Then the Vcc can be estimated as
Vcc = Vavg + Vdrop/2
The method can be recursively used to improve the value of Vcc, if there is no prior information on Vcc.
2. Least squares fit
Using the set of values obtained from the ADC say (Vi, ti) where i = 0,1,2.....N-1, we can estimate the curve of V = F(t)
With that curve the initial value of V(t) can be estimated. Although this method is more mathematically intensive, it yields be best estimate of the voltage in presence of high noise.
Choosing the capacitor (for droop correction)[edit]
The capacitor chosen should be linear in the entire operating voltage range. i.e. the capacitance should remain constant over the operating voltage range for the voltage droop calculations to hold. It is recommended to use a tantalum or a film type SMT capacitor for this application. Ceramic multilayer capacitors are prone to capacitance change with voltage. (The capacitance can drop upto 50% with only a few volts DC). If the end user is not implementing the DC offset correction using the droop calculation, then any capacitor can be used.
First measurement[edit]
The first measurement of the ADC for the battery voltage need to take into account the charging time of the capacitor. Assuming that the input is a step with a fast rise time (usually few ms which can be ignored), the time taken for the capacitor can be estimated from the simple capacitor charging equation. In this specific case, the charging time to reach 1% accuracy is about 45ms. This has to be taken into account during the measurements. The wake-up from power on RESET for the CC32xx device is at least 1.1sec. So that gives more than enough time for the voltage at the capacitor to settle to its final value.
Time between measurements[edit]
Once the battery voltage is measured , the ADC is disconnected from the pin which enables the resistor to charge back from the resistor divider. The time taken to charge back has to be again estimated from the RC charging equation.
V(t) = Vo + V x (1-e^(-t/RC)) where Vo is the voltage at the time of disconnecting the pin and V is the thevenin equivalent voltage.
For this example , assuming V(t) to reach within 1 LSB of the ADC code, and Vo to be 1.28V
Choosing the capacitor (for droop correction)
[edit]
The capacitor chosen should be linear in the entire operating voltage range. i.e. the capacitance should remain constant over the operating voltage range for the voltage droop calculations to hold good. It is recommended to use a tantalum or a film type SMT capacitor for this application. Ceramic multilayer capacitors are prone to capacitance change with voltage. (The capacitance can drop upto 50% with few volts of DC). If the end user is not implementing the DC offset correction using the droop calculation, then any capacitor can be used.
Also derating the capacitance by choosing one with a very high voltage rating is an option. In this case, the max voltage is 1.4V at the ADC input and we can chose a 16V capacitor. This will reduce the capacitance change with voltage.
AC measurements
[edit]
As noted in the case of battery monitoring, the use of external resistor divider and capacitor severly restricts the bandwidth of measurement. This method is not suitable for AC signals which can have the bandwidth all the way to the Nyquist limit of Fs/2 or 31KHz in this ADC. In order to drive the input, a suitable ADC buffer needs to be used. There are several application notes available on the internet in choosing the right OPAMP depending upon the bandwidth, accuracy, offset, linearity and drift requirements. It is recommended for the user to select the OPAMP driver based on their requirement by referring to the application notes below.
Cc3200 Sdk For Mac Windows 10
www.ti.com/lit/ml/slyp166/slyp166.pdf
e2e.ti.com/cfs-file.ashx/__key/telligent-evolution-components-attachments/00-232-01-00-00-12-39-75/PA_2D00_001--Optimize_5F00_SAR_5F00_converter_5F00_design-REV-b.pdf{{#invoke: Navbox | navbox }}
{{
Please post only comments related to the article CC3200 ADC Appnote here. | Keystone=
Please post only comments related to the article CC3200 ADC Appnote here. | C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC3200 ADC Appnote here. | DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC3200 ADC Appnote here. | MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC3200 ADC Appnote here. | OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 ADC Appnote here. | OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 ADC Appnote here. | MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC3200 ADC Appnote here. | For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC3200 ADC Appnote here. }} |
Links | |||
|
Introduction of TI CC3200 WiFi Modules
The TI CC3200 WiFi Modules, used for data transparent transmission. USR-C322 is a wifi module released by USR IOT, which has the features of minisize, low power and industry-grade. The hardware of USR-C322 wifi module integrates MAC, baseband chip, RF transceiver unit and power amplifier.
USR-C322 wifi module is based on TI CC3200 chip, which has industrial ARM Cortex-M4 core and ultra-low power operation mechanism. And it supports WiFi protocol and TCP/IP protocol. User can achieve the function of UART devices connecting to Internet with simple configuration.
Features of TI CC3200 WiFi Modules
Support Wi-Fi@2.4 GHz 802.11 b/g/n wireless standards
Based on ARM Cortex-M4 kernel, running frequency of 80 MHZ
Support WEP, WPA/WPA2 security mode
Support AP/STA working mode
Support Simplelink/usrlink networking configuration
Support custom webpage function
The fully integrated serial to wifi TCP/UDP transmission function,the rate of serial port up to 3M bps
Support two uart and three socket communication
Support PC1 16 bytes encryption when work in transparent transmission mode
Support httpsD Client function
Support websocket function
Support SSL Client function
Support search in local area network (LAN) and wireless parameters setting function
Support TCP/UDP Client registration packet mechanism
Support class RFC2217 automatic baud rate adaptation function
Supports 485 transmission control
Support AT+ simple instruction set configuration
Single 3.3 V power supply
Ultra low power mode, support deep dormancy
Support internal/external antenna option
Minisize: 18.22mm*26.65mm*2.8mm SMT
FCC/CE/RoHS certificated
Function of TI CC3200 WiFi Modules
TI CC3200 Chip: TI chips; based on ARM Cortex-M4 kernel; running frequency of 80 MHZ
Ultra-low power: Working : Min 3.5mA; Deep Sleep : Min 25uA
Open SDK: Support secondary development according to TI SDK and “USR” encapsulated SDK
High-speed UART: Max baud rate of 3Mbps (with specific firmware and opening the flow control; In this firmware, the module only can work in transparent transmission mode)
Simplelink: one key access to WiFi
Double serials: two UARTs
Three links: three TCP links
Two encryption communication methods: PC1 Encrypt,SSL encryption submission
More functions: custom webpage, websocket, httpsd client
No data loss
Application Field of TI CC3200 WiFi Modules
WiFi remote control and monitoring, TCP/IP and WiFi coprocessor
WiFi remote control toy such as aircraft and cars
WiFi Internet radio, camera, digital photo frame
Medical instrument, data acquisition, handheld device
WiFi fatness testing machine, smart card terminal, Smart Home
Instrument, equipment parameter monitoring, wireless POS machine
Modern agriculture, military field and other wireless related secondary development applications
Ultra-low Power TI CC3200 WiFi Modules
C322 has five power modes,which has Min.3.5mA standby power and has Min.25uA deep sleep power.Its power control can be the highest level.