AN370
Rev. 1.0
67
7.9. Battery Voltage Measurement Module
This module measures unloaded and loaded battery voltage.
7.9.1. Battery Measurement Module Functions
iMVdd_Measure
Description
: Measures the battery voltage. It can be used in one of two modes.
1. If biWait == 0 then it measures the battery voltage when the battery is loaded with
current user application.
2. If biWait > 0 it measures battery voltage of forcibly loaded battery, where loading
is achieved by temporarily turning on major power hungry parts of the device.
The function requires that the temperature sensor demodulator DMD ISR interrupt service
routine is present in the user application.
The function does the following tasks in order:
1. Configure the DMD TS hardware for voltage mode measurement.
2. Forcibly enable DMD interrupt, EDMD = 1
3. Temporarily force overall global interrupt enable EA = 1. It remembers the state of the
EA bit as it was upon entering the function.
4. Measure the unloaded battery voltage.
5. Only if biWait > 0 make a loaded battery measurement:
6. Remember the current system clock speed and switch the system clock to slower pace.
7. Remember the current state of PA, DIV divider, and LC oscillator.
8. Forcibly enable PA, DIV, and LC oscillator. Note that even though the PA is enabled,
there is no RF power radiated to the antenna. The PA is configured such that it loads
the battery the same way as if it is driving an antenna.
9. Wait for biWait x 17 µs
10. Measure the loaded battery voltage using the DMD ISR interaction.
11. Restore the original PA, divider, and LC state.
12. Restore the original system clock frequency.
13. Forcibly disable DMD interrupt, EDMD = 0.
14. Restore the original value of the global EA bit.
15. Return the battery voltage measurement converted to [mV].
The function should be called on its own outside of the transmission since it has a signifi-
cant system impact. The user is advised to reinitialize the affected blocks after calling this
function. Before calling iMVdd_Measure for loaded measurement, vPa_Tune should be