Hanna
Sourcecode Batteriemanagementsystem
Funktionen
Osc_group

Funktionen

static void osc_disable (uint8_t id)
 
static void osc_enable (uint8_t id)
 
static void osc_enable_external (uint8_t id)
 
static void osc_enable_internal (uint8_t id)
 Enable internal oscillator id. Mehr ...
 
static uint32_t osc_get_rate (uint8_t id)
 
static bool osc_is_ready (uint8_t id)
 
static void osc_wait_ready (uint8_t id)
 

Oscillator identifiers

#define OSC_ID_RC2MHZ   OSC_RC2MEN_bm
 2 MHz Internal RC Oscillator
 
#define OSC_ID_RC32MHZ   OSC_RC32MEN_bm
 32 MHz Internal RC Oscillator
 
#define OSC_ID_RC32KHZ   OSC_RC32KEN_bm
 32 KHz Internal RC Oscillator
 
#define OSC_ID_XOSC   OSC_XOSCEN_bm
 External Oscillator.
 
#define OSC_ID_USBSOF   0xff
 Reference from USB Start Of Frame. Mehr ...
 

External oscillator types

#define XOSC_TYPE_EXTERNAL   0
 External clock signal.
 
#define XOSC_TYPE_32KHZ   2
 32.768 kHz resonator on TOSC
 
#define XOSC_TYPE_XTAL   3
 0.4 to 16 MHz resonator on XTAL
 

XTAL resonator start-up cycles

#define XOSC_STARTUP_256   0
 256 cycle start-up time
 
#define XOSC_STARTUP_1024   1
 1 k cycle start-up time
 
#define XOSC_STARTUP_16384   2
 16 k cycle start-up time
 

XTAL resonator frequency range

#define XOSC_RANGE_04TO2   OSC_FRQRANGE_04TO2_gc
 0.4 to 2 MHz frequency range
 
#define XOSC_RANGE_2TO9   OSC_FRQRANGE_2TO9_gc
 2 to 9 MHz frequency range
 
#define XOSC_RANGE_9TO12   OSC_FRQRANGE_9TO12_gc
 9 to 12 MHz frequency range
 
#define XOSC_RANGE_12TO16   OSC_FRQRANGE_12TO16_gc
 12 to 16 MHz frequency range
 

XMEGA-Specific Oscillator Features

static void osc_enable_autocalibration (uint8_t id, uint8_t ref_id)
 Enable DFLL-based automatic calibration of an internal oscillator. Mehr ...
 
static void osc_disable_autocalibration (uint8_t id)
 Disable DFLL-based automatic calibration of an internal oscillator. Mehr ...
 
static void osc_user_calibration (uint8_t id, uint16_t calib)
 Load a specific calibration value for the specified oscillator. Mehr ...
 

Ausführliche Beschreibung

Errata

Makro-Dokumentation

#define OSC_ID_USBSOF   0xff

Reference from USB Start Of Frame.

Zu beachten
This cannot be enabled or disabled, but can be used as a reference for the autocalibration (DFLL).

Definiert in Zeile 81 der Datei osc.h.

Dokumentation der Funktionen

static void osc_disable_autocalibration ( uint8_t  id)
inlinestatic

Disable DFLL-based automatic calibration of an internal oscillator.

Siehe auch
osc_enable_autocalibration
Parameter
idThe ID of the oscillator for which to disable auto-calibration:
  • OSC_ID_RC2MHZ or OSC_ID_RC32MHZ.

Definiert in Zeile 418 der Datei osc.h.

static void osc_enable_autocalibration ( uint8_t  id,
uint8_t  ref_id 
)
inlinestatic

Enable DFLL-based automatic calibration of an internal oscillator.

The XMEGA features two Digital Frequency Locked Loops (DFLLs) which can be used to improve the accuracy of the 2 MHz and 32 MHz internal RC oscillators. The DFLL compares the oscillator frequency with a more accurate reference clock to do automatic run-time calibration of the oscillator.

This function enables auto-calibration for either the 2 MHz or 32 MHz internal oscillator using either the 32.768 kHz calibrated internal oscillator or an external crystal oscillator as a reference. If the latter option is used, the crystal must be connected to the TOSC pins and run at 32.768 kHz.

Parameter
idThe ID of the oscillator for which to enable auto-calibration:
  • OSC_ID_RC2MHZ or OSC_ID_RC32MHZ.
ref_idThe ID of the oscillator to use as a reference:
  • OSC_ID_RC32KHZ or OSC_ID_XOSC for internal or external 32 kHz reference, respectively.
  • OSC_ID_USBSOF for 32 MHz only when USB is available and running.

Definiert in Zeile 325 der Datei osc.h.

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

static void osc_enable_internal ( uint8_t  id)
inlinestatic

Enable internal oscillator id.

Do not call this function directly. Use osc_enable() instead.

Definiert in Zeile 215 der Datei osc.h.

static void osc_user_calibration ( uint8_t  id,
uint16_t  calib 
)
inlinestatic

Load a specific calibration value for the specified oscillator.

Parameter
idThe ID of the oscillator for which to disable auto-calibration:
  • OSC_ID_RC2MHZ or OSC_ID_RC32MHZ.
calibThe specific calibration value required:

Definiert in Zeile 446 der Datei osc.h.