4 interrupt handling, 5 crystal oscillator (xosc), 1 overview – Rainbow Electronics ATmega128RFA1 User Manual
Page 80: 2 integrated oscillator setup, Atmega128rfa1

80
8266A-MCU Wireless-12/09
ATmega128RFA1
The value BATMON_OK should be read out to verify the current supply voltage value
after setting a new threshold.
Note: The battery monitor is inactive during SLEEP states. Refer to status register
TRX_STATUS for details.
9.6.4.4 Interrupt Handling
A supply voltage drop below the configured threshold value is indicated by the
BAT_LOW interrupt. The BAT_LOW status bit as well as the BATLOW_EN bit is
located in the BATMON register. If BATLOW_EN =0, no IRQ is issued, but the status
flag is set if the battery low event occurs.
The interrupt is only issued if BATMON_OK changes from 1 to 0 and the event is stored
until the IRQ handler is called or the BAT_LOW IRQ is cleared manually by writing ‘1’ to
the BAT_LOW status flag.
No interrupt is generated when:
•
The battery voltage is below the default 1.8V threshold at power up (BATMON_OK
was never 1) or
•
A new threshold is set which is still above the current supply voltage (BATMON_OK
remains 0).
Noise or temporary voltage drops may generate unwanted interrupts when the battery
voltage is close to the programmed threshold voltage. To avoid this:
•
Disable the BAT_LOW interrupt with the BATLOW_EN Bit in the BATMON register
and treat the battery as empty or
•
Set a lower threshold value.
9.6.5 Crystal Oscillator (XOSC)
The main features of the crystal oscillator are:
•
Amplitude controlled 16 MHz generation;
•
215 µs typical settling time after leaving SLEEP state;
•
Configurable trimming with a capacitance array;
9.6.5.1 Overview
The crystal oscillator generates the reference frequency for the radio transceiver. All
other internally generated frequencies of the radio transceiver are derived from this
unique frequency. The overall system performance is therefore critically determined by
the accuracy of the crystal reference frequency. The external components of the crystal
oscillator should be selected carefully and the related board layout should be done with
caution as described in section
"Application Circuits" on page 493.
The register XOSC_CTRL provides access to the control signals of the oscillator. Two
operating modes are supported. It is recommended to use the integrated oscillator
setup as described in
page 81. Nevertheless a reference frequency can
be fed to the internal circuitry by using an external clock reference as shown in
9.6.5.2 Integrated Oscillator Setup
The output frequency of the internal oscillator depends on the load capacitance
between the crystal pins XTAL1 and XTAL2. The total load capacitance C
L
must be
equal to the specified load capacitance of the crystal itself. It consists of the external
capacitors CX and parasitic capacitances connected to the XTAL nodes.