# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ32MC10X -- Charge Time Measurement Unit

- 1
- 2
…
- 11
- 12
- 13
- 14
- 15
…
- 33
- 34

© 2010 Microchip Technology Inc. DS39724B-page 11-13
Section 11. CTMU
CTMU
11
11.5.1 Current Source Calibration
The current source on board the CTMU module has a range of ±62% nominal for each of three
current ranges. Therefore, for precise measurements, it is possible to measure and adjust this
current source by placing a high precision resistor, R
CAL, on the analog channel, AN2. An
example circuit is shown in Figure 11-2. The current source measurement is performed using the
following steps:
1. Initialize the A/D Converter.
2. Initialize the CTMU by configuring the module for Pulse Generation mode (TGEN = 1).
3. Enable the current source by setting EDG1STAT (CTMUCON<0> or CTMUCON1<8>).
4. Issue settling time delay.
5. Perform A/D conversion.
6. Calculate the current source current using I = V/R
CAL, where RCAL is a high precision
resistance and V is measured by performing an A/D conversion.
The CTMU current source may be trimmed with the trim bits in CTMUICON using an iterative pro-
cess to get an exact desired current. Alternatively, the nominal value without adjustment may be
used. It may be stored by the software for use in all subsequent capacitive or time measurements.
When the module is configured for pulse generation delay by setting the TGEN bit
(CTMUCON<12> or CTMUCON1<12>), the internal current source is connected to one of the
inputs of Comparator 2. Figure 11-2 shows the external connections for current source
calibration, as well as the relationship of the different analog modules required.
To calculate the value for R
CAL, the nominal current must be chosen and then the resistance can
be calculated. For example, if the A/D Converter reference voltage is 3.3V, use 70% of full scale,
or 2.31V as the desired approximate voltage to be read by the A/D Converter. If the range of the
CTMU current source is selected to be 0.55 A, the resistor value needed is calculated as
RCAL = 2.31V/0.55 A, for a value of 4.2 MΩ. Similarly, if the current source is chosen to be
5.5 A, R
CAL would be 420,000Ω and 42,000Ω if the current source is set to 55 A.
Figure 11-2: CTMU Current Source Calibration Circuit
A value of 70% of full-scale voltage is chosen to make sure that the A/D Converter was in a range
that is well above the noise floor. Keep in mind that if an exact current is chosen that is to incor-
porate the trimming bits from CTMUICON, the resistor value of R
CAL may need to be adjusted
accordingly. R
CAL may be also be adjusted to allow for available resistor values. RCAL should be
of the highest precision available, keeping in mind the amount of precision needed for the circuit
that the CTMU will be used to measure. A recommended minimum would be 0.1% tolerance.
The following examples show one typical method for performing a CTMU current calibration.
Example 11-1 shows how to initialize the A/D Converter and the CTMU; this routine is typical for
applications using both modules. Example 11-3 shows one method for the actual calibration
routine. Note that this method manually triggers the A/D Converter; this is done to demonstrate
the entire stepwise process. It is also possible to automatically trigger the conversion by setting
the CTTRIG bit (CTMUCON<8> or CTMUCON1<8>).
PIC24F Device
A/D Converter
CTMU
AN2
RCAL
Current Source
A/D
Trigger
A/D
MUX

- 1
- 2
…
- 11
- 12
- 13
- 14
- 15
…
- 33
- 34