CONFIG OSC

From MCS Wiki AVR
(Difference between revisions)
Jump to: navigation, search
 
Line 18: Line 18:
  
 
= <span class="f_Header">Remarks</span> =
 
= <span class="f_Header">Remarks</span> =
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
+
<div style="padding: 0px; margin: 0px 0px 0px 4px;"><div style="padding: 0px; margin: 0px 0px 0px 4px;">
{| cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
+
{| style="border: solid 2px #000000; border-spacing:0px; border-collapse: collapse;" cellspacing="0" cellpadding="1" border="1"
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
OSC
 
OSC
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Use ENABLED to enable the internal 2 MHZ oscillator. This oscillator is enabled by default. Use DISABLED to disable the internal oscillator.
 
Use ENABLED to enable the internal 2 MHZ oscillator. This oscillator is enabled by default. Use DISABLED to disable the internal oscillator.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
PLLOSC
 
PLLOSC
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Use ENABLED to enable the PLL oscillator. The oscillator is disabled by default.
 
Use ENABLED to enable the PLL oscillator. The oscillator is disabled by default.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
EXTOSC
 
EXTOSC
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Use ENABLED to enable the external oscillator. The external oscillator is disabled by default.
 
Use ENABLED to enable the external oscillator. The external oscillator is disabled by default.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
32KHZOSC
 
32KHZOSC
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Use ENABLED to enable the internal 32 KHz oscillator. This oscillator is disabled by default.
 
Use ENABLED to enable the internal 32 KHz oscillator. This oscillator is disabled by default.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
32MHZOSC
 
32MHZOSC
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Use ENABLED to enable the internal 32 MHz oscillator. This oscillator is disabled by default.
 
Use ENABLED to enable the internal 32 MHz oscillator. This oscillator is disabled by default.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
RANGE
 
RANGE
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Specify the range of the external oscillator.
 
Specify the range of the external oscillator.
  
Line 73: Line 73:
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
 
32KHZPOWERMODE
 
32KHZPOWERMODE
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
 
Select the power mode of the 32 KHz interal oscillator. This can be NORMAL or LOW_POWER.
 
Select the power mode of the 32 KHz interal oscillator. This can be NORMAL or LOW_POWER.
  
Line 82: Line 82:
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; border: solid 1px #000000;" width="16%" valign="top" |  
STARTUP
+
XOSC_SEL_STARTUP
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; border: solid 1px #000000;" width="126%" valign="top" |  
The startup time can be specified. Use a value of &nbsp;:
+
The type and startup type of the crystal or resonator can be specified. Use a value of &nbsp;:
  
- EXTCLK (6 CLK)
+
- EXTCLK (6 CLK) , will select external clock
  
- 32KHZ (for 16 CLK)
+
- 32KHZ (for 16 CLK) , will select 32.768 TOSC
  
- XTAL_256CLK &nbsp;(for 256 CLK)
+
- XTAL_256CLK &nbsp;(for 256 CLK), will select 0.4-16 MHz XTAL
  
- XTAL_1KCLK &nbsp;(for 1K CLK)
+
- XTAL_1KCLK &nbsp;(for 1K CLK) , will select 0.4-16 MHz XTAL
  
- XTAL_16CLK &nbsp; (for 16K CLK)
+
- XTAL_16CLK &nbsp; (for 16K CLK) , will select 0.4-16 MHz XTAL
  
|- style="vertical-align: top;"
+
|-
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; background-color:#ccffcc; border: solid 1px #000000;" width="16%" bgcolor="#ccffcc" |  
 
PLLSOURCE
 
PLLSOURCE
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; background-color:#ccffcc; border: solid 1px #000000;" width="126%" bgcolor="#ccffcc" |  
This option let you select the oscillator source of the PLL oscillator. Valid options are&nbsp;:
+
This option let you select the oscillator source of the PLL oscillator. Valid options are :
  
 
- RC2MHZ , the internal 2 MHz oscillator (default)
 
- RC2MHZ , the internal 2 MHz oscillator (default)
Line 111: Line 111:
 
- EXTCLOCK , an external clock signal or oscillator
 
- EXTCLOCK , an external clock signal or oscillator
  
|- style="vertical-align: top;"
+
|-
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; background-color:#ccffcc; border: solid 1px #000000;" width="16%" bgcolor="#ccffcc" |  
 
PLLDIV2
 
PLLDIV2
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; background-color:#ccffcc; border: solid 1px #000000;" width="126%" bgcolor="#ccffcc" |  
 
This option let you select the PLL two divider. Valid options are ENABLED and DISABLED
 
This option let you select the PLL two divider. Valid options are ENABLED and DISABLED
  
|- style="vertical-align: top;"
+
|-
| valign="top" width="16%" style="width: 152px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:16%; background-color:#ccffcc; border: solid 1px #000000;" width="16%" bgcolor="#ccffcc" |  
 
PLLMUL
 
PLLMUL
  
| valign="top" width="126%" style="width: 809px; border: 1px solid rgb(0, 0, 0);" |  
+
| style="width:126%; background-color:#ccffcc; border: solid 1px #000000;" width="126%" bgcolor="#ccffcc" |  
 
This option let you specify the PLL multiplication factor. The numeric value must be in the range from 1-31. A value of 0 disables the multiplication.
 
This option let you specify the PLL multiplication factor. The numeric value must be in the range from 1-31. A value of 0 disables the multiplication.
 +
 +
|-
 +
| style="width:16%; background-color:#ffff99; border: solid 1px #000000;" width="16%" bgcolor="#ffff99" |
 +
32MHZCALIB
 +
 +
| style="width:126%; background-color:#ffff99; border: solid 1px #000000;" width="126%" bgcolor="#ffff99" |
 +
This option allow you to specify the calibration source for the 32MHZ oscillator. The possible options are :
 +
 +
- RC32K &nbsp;, selects the 32.768 KHZ internal oscillator
 +
 +
- XOSC32, selects the 32.768 KHz crystal oscillator on TOSC
 +
 +
- USBSOF , selects USB start of frame
 +
 +
|-
 +
| style="width:16%; background-color:#ffff99; border: solid 1px #000000;" width="16%" bgcolor="#ffff99" |
 +
2MHZCALIB
 +
 +
| style="width:126%; background-color:#ffff99; border: solid 1px #000000;" width="126%" bgcolor="#ffff99" |
 +
This option allow you to specify the calibration source for the internal 2MHZ oscillator. The possible options are :
 +
 +
- 32KHZINT &nbsp;, selects the 32.768 KHZ internal oscillator. (default)
 +
 +
- 32KHZ_EXT_TOSC, selects the 32.768 KHz crystal oscillator on TOSC
 +
 +
|-
 +
| style="width:16%; background-color:#ffff99; border: solid 1px #000000;" width="16%" bgcolor="#ffff99" |
 +
32MHZDFL
 +
 +
| style="width:126%; background-color:#ffff99; border: solid 1px #000000;" width="126%" bgcolor="#ffff99" |
 +
This option will enable or disable the DFLL and auto calibration of the 32 MHZ oscillator.
 +
 +
Possible values :
 +
 +
- ENABLED
 +
 +
- DISABLED
 +
 +
|-
 +
| style="width:16%; background-color:#ffff99; border: solid 1px #000000;" width="16%" bgcolor="#ffff99" |
 +
2MHZDFL
 +
 +
| style="width:126%; background-color:#ffff99; border: solid 1px #000000;" width="126%" bgcolor="#ffff99" |
 +
This option will enable or disable the DFLL and auto calibration of the 2 MHZ oscillator.
 +
 +
Possible values :
 +
 +
- ENABLED
 +
 +
- DISABLED
  
 
|}
 
|}
Line 129: Line 179:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
 +
<span style="font-family: Arial;">&nbsp;</span>
 +
</div><div style="padding: 0px; margin: 0px 0px 0px 4px;"><br/></div>
 
You can also use automatic calibration. This will calibrate the 32 MHz oscillator using the 32 KHz oscillator.
 
You can also use automatic calibration. This will calibrate the 32 MHz oscillator using the 32 KHz oscillator.
  

Latest revision as of 20:10, 17 January 2017

Contents

Action

Select and enable the oscillators available to the Xmega

 

See also ATXMEGA

 

Syntax

CONFIG OSC=ENABLED|DISABLED , PLLOSC=ENABLED|DISABLED,  EXTOSC=ENABLED|DISABLED, 32KHZOSC=ENABLED|DISABLED,  32MHZOSC=ENABLED|DISABLED,  RANGE=range, 32KHZPOWERMODE=powermode, XOSC_SEL__STARTUP=xosc_sel_startup , PLLSOURCE=pll , PLLDIV2=plldiv , PLLMUL=pllmul , 32MHZCALIB= 32mhzcalib , 2MHZCALIB= 2mhzcalib , 2MHZDFL= 2MHZDFL , 32MHZDFL= 32MHZDFL

 

 

Remarks

OSC

Use ENABLED to enable the internal 2 MHZ oscillator. This oscillator is enabled by default. Use DISABLED to disable the internal oscillator.

PLLOSC

Use ENABLED to enable the PLL oscillator. The oscillator is disabled by default.

EXTOSC

Use ENABLED to enable the external oscillator. The external oscillator is disabled by default.

32KHZOSC

Use ENABLED to enable the internal 32 KHz oscillator. This oscillator is disabled by default.

32MHZOSC

Use ENABLED to enable the internal 32 MHz oscillator. This oscillator is disabled by default.

RANGE

Specify the range of the external oscillator.

- 400KHZ_2MHZ

- 2MHZ_9MHZ

- 9MHZ_12MHZ

- 12MHZ_16MHZ

This option is only needed when using the external oscillator.

32KHZPOWERMODE

Select the power mode of the 32 KHz interal oscillator. This can be NORMAL or LOW_POWER.

The default is NORMAL

XOSC_SEL_STARTUP

The type and startup type of the crystal or resonator can be specified. Use a value of  :

- EXTCLK (6 CLK) , will select external clock

- 32KHZ (for 16 CLK) , will select 32.768 TOSC

- XTAL_256CLK  (for 256 CLK), will select 0.4-16 MHz XTAL

- XTAL_1KCLK  (for 1K CLK) , will select 0.4-16 MHz XTAL

- XTAL_16CLK   (for 16K CLK) , will select 0.4-16 MHz XTAL

PLLSOURCE

This option let you select the oscillator source of the PLL oscillator. Valid options are :

- RC2MHZ , the internal 2 MHz oscillator (default)

- RC32MHZ , the internal 32 MHz oscillator

- EXTCLOCK , an external clock signal or oscillator

PLLDIV2

This option let you select the PLL two divider. Valid options are ENABLED and DISABLED

PLLMUL

This option let you specify the PLL multiplication factor. The numeric value must be in the range from 1-31. A value of 0 disables the multiplication.

32MHZCALIB

This option allow you to specify the calibration source for the 32MHZ oscillator. The possible options are :

- RC32K  , selects the 32.768 KHZ internal oscillator

- XOSC32, selects the 32.768 KHz crystal oscillator on TOSC

- USBSOF , selects USB start of frame

2MHZCALIB

This option allow you to specify the calibration source for the internal 2MHZ oscillator. The possible options are :

- 32KHZINT  , selects the 32.768 KHZ internal oscillator. (default)

- 32KHZ_EXT_TOSC, selects the 32.768 KHz crystal oscillator on TOSC

32MHZDFL

This option will enable or disable the DFLL and auto calibration of the 32 MHZ oscillator.

Possible values :

- ENABLED

- DISABLED

2MHZDFL

This option will enable or disable the DFLL and auto calibration of the 2 MHZ oscillator.

Possible values :

- ENABLED

- DISABLED

 

 


You can also use automatic calibration. This will calibrate the 32 MHz oscillator using the 32 KHz oscillator.

The required code :

 

Config Osc = (enabled or disabled), 32mhzosc = Enabled , 32khzosc = enabled

Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
OSC_DFLLCTRL.0 = 1    'enable 
DFLLRC32M_CTRL.0 = 1 'enable

See also

CONFIG SYSCLOCK

 

 

Example

Config Osc = Enabled , 32mhzosc = Enabled ' enable 2 MHz and 32 MHz interal oscillators

PLL Example

'Clock: 32 MHz External 4 MHz Xtal, PLL x 8
Config osc = enabled , EXTOSC = enabled , pllosc = enabled , _
range = 2MHZ_9MHZ , startup = XTAL_16KCLK , pllsource = extclock , pllmul = 8
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language