SlideShare a Scribd company logo
CPU Clocking System
The dsPIC33FJ32MC202/204 and dsPIC33FJ16MC304 devices provide seven system clock
options:
 Fast RC (FRC) Oscillator
 FRC Oscillator with PLL
 Primary (XT, HS or EC) Oscillator
 Primary Oscillator with PLL
 Secondary (LP) Oscillator
 Low-Power RC (LPRC) Oscillator
 FRC Oscillator with postscaler
Fast RC
The Fast RC (FRC) internal oscillator runs at a nominal frequency of 7.37 MHz. User software can tune
the FRC frequency. User software can optionally specify a factor (ranging from 1:2 to 1:256) by which the
FRC clock frequency is divided. This factor is selected using the FRCDIV<2:0> bits (CLKDIV<10:8>).
Primary
The primary oscillator can use one of the following as its clock source:
 XT (Crystal): Crystals and ceramic resonators in the range of 3 MHz to 10 MHz. The crystal is
connected to the OSC1 and OSC2 pins.
 HS (High-Speed Crystal): Crystals in the range of 10 MHz to 40 MHz. The crystal is connected to
the OSC1 and OSC2 pins.
 EC (External Clock): The external clock signal is directly applied to the OSC1 pin.
Low-Power RC
The LPRC (Low-Power RC) internal oscIllator runs at a nominal frequencyof32.768 kHz. It is also used as
a reference clock by the Watchdog Timer (WDT) and Fail-Safe Clock Monitor (FSCM).
FRC
The clock signals generated by the FRC and primary oscillators can be optionally applied to an on-chip
Phase Locked Loop (PLL) to provide a wide range of output frequencies for device operation. PLL
configuration is described in Section 8.1.3 “PLL Configuration”.
The FRC frequency depends on the FRC accuracy (see Table 24-18) and the value of the FRC Oscillator
Tuning register (see Register 8-4).
Manual cpu clocking system
8.1.2 SYSTEM CLOCK SELECTION
The oscillator source used ata device Power-on Resetevent is selected using Configuration bit settings.
The oscillator Configuration bitsettings are located in the Configuration registers in the program memory.
(Refer to Section 21.1 “Configuration Bits” for further details.) The Initial Oscillator Selection
Configuration bits,FNOSC<2:0> (FOSCSEL<2:0>), and the Primary Oscillator Mode Select Configuration
bits,POSCMD<1:0> (FOSC<1:0>), selectthe oscillator source thatis used ata Power-on Reset.The FRC
primaryoscillator is the default(unprogrammed) selection.
The Configuration bits allow users to choose among 12 differentclock modes,shown in Table 8-1. The
output of the oscillator (or the output of the PLL if a PLL mode has been selected) FOSC is divided by 2 to
generate the device instruction clock (FCY) and the peripheral clock time base (FP). FCY defines the
operating speed of the device, and speeds up to 40MHz are supported bythe dsPIC33FJ32MC202/204
and dsPIC33FJ16MC304 architecture. Instruction execution speed or device operating frequency, FCY, is
given by:
8.1.3 PLL CONFIGURATION
The primary oscillator and internal FRC oscillator can optionally use an on-chip PLL to obtain higher
speeds of operation. The PLL provides significant flexibility in selecting the device operating speed. A
block diagram of the PLL is shown in Figure 8-2.
The output of the primary oscillator or FRC, denoted as ‘FIN’, is divided down by a prescale factor (N1) of
2, 3,... or 33 before being provided to the PLL’s Voltage Controlled Oscillator (VCO). The input to the VCO
must be selected in the range of 0.8 MHz to 8 MHz. The prescale factor ‘N1’ is selected using the
PLLPRE<4:0> bits (CLKDIV<4:0>).
The PLL Feedback Divisor,selected using the PLLDIV<8:0> bits (PLLFBD<8:0>), provides a factor ‘M’, by
which the input to the VCO is multiplied. This factor must be selected such that the resulting VCO output
frequency is in the range of 100 MHz to 200 MHz.
The VCO output is further divided by a postscale factor ‘N2.’ This factor is selected using the
PLLPOST<1:0> bits (CLKDIV<7:6>). ‘N2’ can be either 2, 4 or 8, and must be selected such that the PLL
output frequency (FOSC) is in the range of 12.5 MHz to 80 MHz, which generates device operating speeds
of 6.25-40 MIPS.
For a primary oscillator or FRC oscillator, output ‘FIN’, the PLL output ‘FOSC’ is given by:
For example, suppose a 10 MHz crystal is being used with the selected oscillator mode of XT with PLL.
 If PLLPRE<4:0> = 0, then N1 = 2. This yields a VCO input of 10/2 = 5 MHz, which is within the
acceptable range of 0.8-8 MHz.
 If PLLDIV<8:0> = 0x1E, then M = 32. This yields a VCO output of 5 x 32 = 160 MHz, which is
within the 100-200 MHz ranged needed.
 If PLLPOST<1:0> = 0, then N2 = 2. This provides a Fosc of 160/2 = 80 MHz. The resultantdevice
operating speed is 80/2 = 40 MIPS.
Programando en el DSPIC
Configuraciondel osciladorinternoconDSPIC
Utilizando la ecuacion:
𝐹𝑜𝑠𝑐 = 𝐹𝐼𝑁 ∗ (
𝑀
𝑁1 ∗ 𝑁2
)
𝐹𝑜𝑠𝑐 = 7.37 MHz.∗ (
43
2 ∗ 2
)
𝐹𝑐𝑦 = (
79.2275
2
)
𝐹𝑐𝑦 = 39.61375
Este 𝐹𝑐𝑦 se declara en la programación:
8.2 Clock Switching Operation
Applications are free to switch among any of the four clock sources (Primary, LP, FRC and LPRC) under
software control at any time. To limit the possible side effects of this flexibility, dsPIC33FJ32MC202/204
and dsPIC33FJ16MC304 devices have a safeguard lock built into the switch process.
8.2.1 ENABLING CLOCK SWITCHING
To enable clock switching, the FCKSM1 Configuration bit in the Configuration register must be
programmed to ‘0’. (Refer to Section 21.1 “Configuration Bits” for further details.) If the FCKSM1
Configuration bitis unprogrammed (‘1’), the clock switching function and Fail-Safe Clock Monitor function
are disabled.
This is the default setting. The NOSC control bits (OSCCON<10:8>) do not control the clock selection
when clock switching is disabled. However, the COSC bits (OSCCON<14:12>) reflect the clock source
selected by the FNOSC Configuration bits.
The OSWEN control bit (OSCCON<0>) has no effect when clock switching is disabled.It is held at ‘0’ at all
times.
8.2.2 OSCILLATOR SWITCHING SEQUENCE
Performing a clock switch requires this basic sequence:
1. If desired, read the COSC bits (OSCCON<14:12>) to determine the current oscillator source.
2. Perform the unlock sequence to allow a write to the OSCCON register high byte.
3. Write the appropriate value to the NOSC control bits (OSCCON<10:8>) for the new oscillator source.
4. Perform the unlock sequence to allow a write to the OSCCON register low byte.
5. Set the OSWEN bit (OSCCON<0>) to initiate the oscillator switch.
Once the basic sequence is completed, the system clock hardware responds automatically as follows:
1. The clock switching hardware compares the COSC status bits with the new value of the NOSC control
bits.If they are the same,the clock switch is a redundantoperation.In this case,the OSWEN bit is cleared
automatically and the clock switch is aborted.
2. If a valid clock switch has been initiated, the LOCK (OSCCON<5>) and the CF (OSCCON<3>) status
bits are cleared.
3. The new oscillator is turned on by the hardware ifit is not currently running.If a crystal oscillator mustbe
turned on, the hardware waits until the Oscillator Start-up Timer (OST) expires. If the new source is using
the PLL, the hardware waits until a PLL lock is detected (LOCK = 1).
4. The hardware waits for 10 clock cycles from the new clock source and then performs the clock switch.
5. The hardware clears the OSWEN bit to indicate a successful clock transition. In addition, the NOSC bit
values are transferred to the COSC status bits.
6. The old clock source is turned off at this time, with the exception of LPRC (if WDT or FSCM are
enabled) or LP (if LPOSCEN remains set).
8.3 Fail-Safe Clock Monitor (FSCM)
The Fail-Safe Clock Monitor (FSCM) allows the device to continue to operate even in the event of an
oscillator failure. The FSCM function is enabled by programming. If the FSCM function is enabled, the
LPRC internal oscillator runs at all times (except during Sleep mode) and is not subject to control by the
Watchdog Timer.
In the event of an oscillator failure,the FSCM generates a clock failure trap event and switches the system
clock over to the FRC oscillator.Then the application program can either attemptto restart the oscillator or
execute a controlled shutdown. The trap can be treated as a warm Reset by simply loading the Reset
address into the oscillator fail trap vector.
If the PLL multiplier is used to scale the system clock, the internal FRC is also multiplied by the same
factor on clock failure. Essentially, the device switches to FRC with PLL on a clock failure.
EN LA PAGINA 126 DEL DATASHEET EXPLICA ESTE CODIGO:
Ad

More Related Content

What's hot (20)

DPA
DPADPA
DPA
Ramasubbu .P
 
PSC9131UG_C4_FD
PSC9131UG_C4_FDPSC9131UG_C4_FD
PSC9131UG_C4_FD
Haim Amir
 
At89c4051
At89c4051At89c4051
At89c4051
Microtech Solutions
 
At 89s51
At 89s51At 89s51
At 89s51
Mr Giap
 
8051 interrupts
8051 interrupts8051 interrupts
8051 interrupts
Shreyans Pathak
 
8 interrupt 8051
8 interrupt 80518 interrupt 8051
8 interrupt 8051
daniemol
 
dspAt89 s52
dspAt89 s52dspAt89 s52
dspAt89 s52
Mahesh Madapati
 
Atmel
AtmelAtmel
Atmel
Prashant Sharma
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Interrupt
InterruptInterrupt
Interrupt
anishgoel
 
Configure ospf v3 single areaa
Configure ospf v3 single areaaConfigure ospf v3 single areaa
Configure ospf v3 single areaa
jebong03
 
At89c2051 Data sheet
At89c2051 Data sheetAt89c2051 Data sheet
At89c2051 Data sheet
Microtech Solutions
 
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWERMastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
Mastering Microcontroller : TIMERS, PWM, CAN, RTC,LOW POWER
FastBit Embedded Brain Academy
 
Linux router
Linux routerLinux router
Linux router
Miguel E Arellano Quezada
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
Ankit Bhatnagar
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
Aarav Soni
 
Industrial training presentation
Industrial training presentationIndustrial training presentation
Industrial training presentation
lavinasebastian
 
Lab 9 instructions
Lab 9 instructionsLab 9 instructions
Lab 9 instructions
trayyoo
 
TSync_Timing_Boards_revA
TSync_Timing_Boards_revATSync_Timing_Boards_revA
TSync_Timing_Boards_revA
Matthew Loomis, MBA
 
Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)Vista 1600 c epon olt quick start manual(r1.2)
Vista 1600 c epon olt quick start manual(r1.2)
Shanxi Cai
 

Viewers also liked (11)

Introducción a la ing. informática y de sistemas
Introducción a la ing. informática y de sistemasIntroducción a la ing. informática y de sistemas
Introducción a la ing. informática y de sistemas
Jorge Pariasca
 
Presentacion de metabuscadores
Presentacion de metabuscadoresPresentacion de metabuscadores
Presentacion de metabuscadores
Elizabeth Tonato
 
Un estandar para la informacion economica- financiera
Un estandar para la informacion economica- financieraUn estandar para la informacion economica- financiera
Un estandar para la informacion economica- financiera
migue1110
 
CURRICULAM VITAE2
CURRICULAM VITAE2CURRICULAM VITAE2
CURRICULAM VITAE2
SOURAV DE
 
Trabajo en clase
Trabajo en claseTrabajo en clase
Trabajo en clase
Elizabeth Tonato
 
METABUSCADORES
METABUSCADORESMETABUSCADORES
METABUSCADORES
Zeta Zambrano
 
Bol. pres
Bol. presBol. pres
Bol. pres
Cris Maciá
 
Diana
DianaDiana
Diana
viviana-cepeda3318
 
Cuadro comparativo slide share..
Cuadro comparativo slide share..Cuadro comparativo slide share..
Cuadro comparativo slide share..
Asdrubal Alejandro Cachutt Albino
 
Rey alfonso x (1)
Rey alfonso x (1)Rey alfonso x (1)
Rey alfonso x (1)
Veronica Paz
 
Harish book slide
Harish book slideHarish book slide
Harish book slide
Harish Bramhaver
 
Ad

Similar to Manual cpu clocking system (20)

Lecture 5 (system clock crossbar and gpio) rv012
Lecture 5 (system clock crossbar and gpio) rv012Lecture 5 (system clock crossbar and gpio) rv012
Lecture 5 (system clock crossbar and gpio) rv012
cairo university
 
Pll in lpc2148
Pll in lpc2148Pll in lpc2148
Pll in lpc2148
Aarav Soni
 
Serial_communication protocol of msp430.pptx
Serial_communication protocol of msp430.pptxSerial_communication protocol of msp430.pptx
Serial_communication protocol of msp430.pptx
DarshanKumarG3
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Stm32f303 rest and Clock contol
Stm32f303 rest and Clock contolStm32f303 rest and Clock contol
Stm32f303 rest and Clock contol
Prem Sanil
 
Msp 430 module 3
Msp 430 module 3Msp 430 module 3
Msp 430 module 3
SARALA T
 
COMPLETE DETAIL OF ARM PART 3
COMPLETE DETAIL OF ARM PART 3COMPLETE DETAIL OF ARM PART 3
COMPLETE DETAIL OF ARM PART 3
NOWAY
 
pic_1.pdf
pic_1.pdfpic_1.pdf
pic_1.pdf
ZatinGupta2
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
Ruthvik Vaila
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
Keroles karam khalil
 
STM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC blockSTM32 Microcontroller Clocks and RCC block
STM32 Microcontroller Clocks and RCC block
FastBit Embedded Brain Academy
 
Week7_lpm_2015.ppt
Week7_lpm_2015.pptWeek7_lpm_2015.ppt
Week7_lpm_2015.ppt
AmitKumar7572
 
Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. ppt
gaurav5345
 
Assembler4
Assembler4Assembler4
Assembler4
Omar Sanchez
 
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontrolerDatasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Muhammad Kennedy Ginting
 
8051-interrupts-temporary suspension of a program
8051-interrupts-temporary suspension of a program8051-interrupts-temporary suspension of a program
8051-interrupts-temporary suspension of a program
Jason J Pulikkottil
 
Sensor de pressão de pneu
Sensor de pressão de pneuSensor de pressão de pneu
Sensor de pressão de pneu
Carlos Vergara
 
lesson01.ppt
lesson01.pptlesson01.ppt
lesson01.ppt
SushmaHiremath17
 
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
An Overview Study on 32-bit MCU MB91460 Series and its PeripheralsAn Overview Study on 32-bit MCU MB91460 Series and its Peripherals
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
Premier Farnell
 
Lecture 5 (system clock crossbar and gpio) rv012
Lecture 5 (system clock crossbar and gpio) rv012Lecture 5 (system clock crossbar and gpio) rv012
Lecture 5 (system clock crossbar and gpio) rv012
cairo university
 
Pll in lpc2148
Pll in lpc2148Pll in lpc2148
Pll in lpc2148
Aarav Soni
 
Serial_communication protocol of msp430.pptx
Serial_communication protocol of msp430.pptxSerial_communication protocol of msp430.pptx
Serial_communication protocol of msp430.pptx
DarshanKumarG3
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
Omar Sanchez
 
Stm32f303 rest and Clock contol
Stm32f303 rest and Clock contolStm32f303 rest and Clock contol
Stm32f303 rest and Clock contol
Prem Sanil
 
Msp 430 module 3
Msp 430 module 3Msp 430 module 3
Msp 430 module 3
SARALA T
 
COMPLETE DETAIL OF ARM PART 3
COMPLETE DETAIL OF ARM PART 3COMPLETE DETAIL OF ARM PART 3
COMPLETE DETAIL OF ARM PART 3
NOWAY
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
Ruthvik Vaila
 
Sereial com. ppt
Sereial com. pptSereial com. ppt
Sereial com. ppt
gaurav5345
 
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontrolerDatasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Datasheet RTC DS1307 untuk waktu yang tepat pada mikrokontroler
Muhammad Kennedy Ginting
 
8051-interrupts-temporary suspension of a program
8051-interrupts-temporary suspension of a program8051-interrupts-temporary suspension of a program
8051-interrupts-temporary suspension of a program
Jason J Pulikkottil
 
Sensor de pressão de pneu
Sensor de pressão de pneuSensor de pressão de pneu
Sensor de pressão de pneu
Carlos Vergara
 
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
An Overview Study on 32-bit MCU MB91460 Series and its PeripheralsAn Overview Study on 32-bit MCU MB91460 Series and its Peripherals
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
Premier Farnell
 
Ad

Recently uploaded (15)

How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
emestica1
 
Cloud-to-cloud Migration presentation.pptx
Cloud-to-cloud Migration presentation.pptxCloud-to-cloud Migration presentation.pptx
Cloud-to-cloud Migration presentation.pptx
marketing140789
 
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness GuideThe Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
russellpeter1995
 
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
Taqyea
 
IoT PPT introduction to internet of things
IoT PPT introduction to internet of thingsIoT PPT introduction to internet of things
IoT PPT introduction to internet of things
VaishnaviPatil3995
 
introduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.pptintroduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.ppt
SherifElGohary7
 
Paper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdfPaper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdf
Steven McGee
 
ProjectArtificial Intelligence Good or Evil.pptx
ProjectArtificial Intelligence Good or Evil.pptxProjectArtificial Intelligence Good or Evil.pptx
ProjectArtificial Intelligence Good or Evil.pptx
OlenaKotovska
 
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
werhkr1
 
Breaking Down the Latest Spectrum Internet Plans.pdf
Breaking Down the Latest Spectrum Internet Plans.pdfBreaking Down the Latest Spectrum Internet Plans.pdf
Breaking Down the Latest Spectrum Internet Plans.pdf
Internet Bundle Now
 
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
Taqyea
 
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdfGiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
Giacomo Vacca
 
AG-FIRMA Ai Agent for Agriculture | RAG ..
AG-FIRMA Ai Agent for Agriculture  | RAG ..AG-FIRMA Ai Agent for Agriculture  | RAG ..
AG-FIRMA Ai Agent for Agriculture | RAG ..
Anass Nabil
 
Presentation Mehdi Monitorama 2022 Cancer and Monitoring
Presentation Mehdi Monitorama 2022 Cancer and MonitoringPresentation Mehdi Monitorama 2022 Cancer and Monitoring
Presentation Mehdi Monitorama 2022 Cancer and Monitoring
mdaoudi
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
CompTIA-Security-Study-Guide-with-over-500-Practice-Test-Questions-Exam-SY0-7...
emestica1
 
Cloud-to-cloud Migration presentation.pptx
Cloud-to-cloud Migration presentation.pptxCloud-to-cloud Migration presentation.pptx
Cloud-to-cloud Migration presentation.pptx
marketing140789
 
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness GuideThe Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
The Hidden Risks of Hiring Hackers to Change Grades: An Awareness Guide
russellpeter1995
 
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
学生卡英国RCA毕业证皇家艺术学院电子毕业证学历证书
Taqyea
 
IoT PPT introduction to internet of things
IoT PPT introduction to internet of thingsIoT PPT introduction to internet of things
IoT PPT introduction to internet of things
VaishnaviPatil3995
 
introduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.pptintroduction to html and cssIntroHTML.ppt
introduction to html and cssIntroHTML.ppt
SherifElGohary7
 
Paper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdfPaper: World Game (s) Great Redesign.pdf
Paper: World Game (s) Great Redesign.pdf
Steven McGee
 
ProjectArtificial Intelligence Good or Evil.pptx
ProjectArtificial Intelligence Good or Evil.pptxProjectArtificial Intelligence Good or Evil.pptx
ProjectArtificial Intelligence Good or Evil.pptx
OlenaKotovska
 
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
DEF CON 25 - Whitney-Merrill-and-Terrell-McSweeny-Tick-Tick-Boom-Tech-and-the...
werhkr1
 
Breaking Down the Latest Spectrum Internet Plans.pdf
Breaking Down the Latest Spectrum Internet Plans.pdfBreaking Down the Latest Spectrum Internet Plans.pdf
Breaking Down the Latest Spectrum Internet Plans.pdf
Internet Bundle Now
 
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
美国文凭明尼苏达大学莫里斯分校毕业证范本UMM学位证书
Taqyea
 
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdfGiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
Giacomo Vacca
 
AG-FIRMA Ai Agent for Agriculture | RAG ..
AG-FIRMA Ai Agent for Agriculture  | RAG ..AG-FIRMA Ai Agent for Agriculture  | RAG ..
AG-FIRMA Ai Agent for Agriculture | RAG ..
Anass Nabil
 
Presentation Mehdi Monitorama 2022 Cancer and Monitoring
Presentation Mehdi Monitorama 2022 Cancer and MonitoringPresentation Mehdi Monitorama 2022 Cancer and Monitoring
Presentation Mehdi Monitorama 2022 Cancer and Monitoring
mdaoudi
 

Manual cpu clocking system

  • 1. CPU Clocking System The dsPIC33FJ32MC202/204 and dsPIC33FJ16MC304 devices provide seven system clock options:  Fast RC (FRC) Oscillator  FRC Oscillator with PLL  Primary (XT, HS or EC) Oscillator  Primary Oscillator with PLL  Secondary (LP) Oscillator  Low-Power RC (LPRC) Oscillator  FRC Oscillator with postscaler Fast RC The Fast RC (FRC) internal oscillator runs at a nominal frequency of 7.37 MHz. User software can tune the FRC frequency. User software can optionally specify a factor (ranging from 1:2 to 1:256) by which the FRC clock frequency is divided. This factor is selected using the FRCDIV<2:0> bits (CLKDIV<10:8>). Primary The primary oscillator can use one of the following as its clock source:  XT (Crystal): Crystals and ceramic resonators in the range of 3 MHz to 10 MHz. The crystal is connected to the OSC1 and OSC2 pins.  HS (High-Speed Crystal): Crystals in the range of 10 MHz to 40 MHz. The crystal is connected to the OSC1 and OSC2 pins.  EC (External Clock): The external clock signal is directly applied to the OSC1 pin. Low-Power RC The LPRC (Low-Power RC) internal oscIllator runs at a nominal frequencyof32.768 kHz. It is also used as a reference clock by the Watchdog Timer (WDT) and Fail-Safe Clock Monitor (FSCM). FRC The clock signals generated by the FRC and primary oscillators can be optionally applied to an on-chip Phase Locked Loop (PLL) to provide a wide range of output frequencies for device operation. PLL configuration is described in Section 8.1.3 “PLL Configuration”. The FRC frequency depends on the FRC accuracy (see Table 24-18) and the value of the FRC Oscillator Tuning register (see Register 8-4).
  • 3. 8.1.2 SYSTEM CLOCK SELECTION The oscillator source used ata device Power-on Resetevent is selected using Configuration bit settings. The oscillator Configuration bitsettings are located in the Configuration registers in the program memory. (Refer to Section 21.1 “Configuration Bits” for further details.) The Initial Oscillator Selection Configuration bits,FNOSC<2:0> (FOSCSEL<2:0>), and the Primary Oscillator Mode Select Configuration bits,POSCMD<1:0> (FOSC<1:0>), selectthe oscillator source thatis used ata Power-on Reset.The FRC primaryoscillator is the default(unprogrammed) selection. The Configuration bits allow users to choose among 12 differentclock modes,shown in Table 8-1. The output of the oscillator (or the output of the PLL if a PLL mode has been selected) FOSC is divided by 2 to generate the device instruction clock (FCY) and the peripheral clock time base (FP). FCY defines the operating speed of the device, and speeds up to 40MHz are supported bythe dsPIC33FJ32MC202/204 and dsPIC33FJ16MC304 architecture. Instruction execution speed or device operating frequency, FCY, is given by: 8.1.3 PLL CONFIGURATION The primary oscillator and internal FRC oscillator can optionally use an on-chip PLL to obtain higher speeds of operation. The PLL provides significant flexibility in selecting the device operating speed. A block diagram of the PLL is shown in Figure 8-2. The output of the primary oscillator or FRC, denoted as ‘FIN’, is divided down by a prescale factor (N1) of 2, 3,... or 33 before being provided to the PLL’s Voltage Controlled Oscillator (VCO). The input to the VCO must be selected in the range of 0.8 MHz to 8 MHz. The prescale factor ‘N1’ is selected using the PLLPRE<4:0> bits (CLKDIV<4:0>). The PLL Feedback Divisor,selected using the PLLDIV<8:0> bits (PLLFBD<8:0>), provides a factor ‘M’, by which the input to the VCO is multiplied. This factor must be selected such that the resulting VCO output frequency is in the range of 100 MHz to 200 MHz. The VCO output is further divided by a postscale factor ‘N2.’ This factor is selected using the PLLPOST<1:0> bits (CLKDIV<7:6>). ‘N2’ can be either 2, 4 or 8, and must be selected such that the PLL output frequency (FOSC) is in the range of 12.5 MHz to 80 MHz, which generates device operating speeds of 6.25-40 MIPS. For a primary oscillator or FRC oscillator, output ‘FIN’, the PLL output ‘FOSC’ is given by: For example, suppose a 10 MHz crystal is being used with the selected oscillator mode of XT with PLL.  If PLLPRE<4:0> = 0, then N1 = 2. This yields a VCO input of 10/2 = 5 MHz, which is within the acceptable range of 0.8-8 MHz.  If PLLDIV<8:0> = 0x1E, then M = 32. This yields a VCO output of 5 x 32 = 160 MHz, which is within the 100-200 MHz ranged needed.
  • 4.  If PLLPOST<1:0> = 0, then N2 = 2. This provides a Fosc of 160/2 = 80 MHz. The resultantdevice operating speed is 80/2 = 40 MIPS.
  • 5. Programando en el DSPIC Configuraciondel osciladorinternoconDSPIC Utilizando la ecuacion: 𝐹𝑜𝑠𝑐 = 𝐹𝐼𝑁 ∗ ( 𝑀 𝑁1 ∗ 𝑁2 ) 𝐹𝑜𝑠𝑐 = 7.37 MHz.∗ ( 43 2 ∗ 2 ) 𝐹𝑐𝑦 = ( 79.2275 2 ) 𝐹𝑐𝑦 = 39.61375 Este 𝐹𝑐𝑦 se declara en la programación: 8.2 Clock Switching Operation Applications are free to switch among any of the four clock sources (Primary, LP, FRC and LPRC) under software control at any time. To limit the possible side effects of this flexibility, dsPIC33FJ32MC202/204 and dsPIC33FJ16MC304 devices have a safeguard lock built into the switch process. 8.2.1 ENABLING CLOCK SWITCHING To enable clock switching, the FCKSM1 Configuration bit in the Configuration register must be programmed to ‘0’. (Refer to Section 21.1 “Configuration Bits” for further details.) If the FCKSM1 Configuration bitis unprogrammed (‘1’), the clock switching function and Fail-Safe Clock Monitor function are disabled.
  • 6. This is the default setting. The NOSC control bits (OSCCON<10:8>) do not control the clock selection when clock switching is disabled. However, the COSC bits (OSCCON<14:12>) reflect the clock source selected by the FNOSC Configuration bits. The OSWEN control bit (OSCCON<0>) has no effect when clock switching is disabled.It is held at ‘0’ at all times. 8.2.2 OSCILLATOR SWITCHING SEQUENCE Performing a clock switch requires this basic sequence: 1. If desired, read the COSC bits (OSCCON<14:12>) to determine the current oscillator source. 2. Perform the unlock sequence to allow a write to the OSCCON register high byte. 3. Write the appropriate value to the NOSC control bits (OSCCON<10:8>) for the new oscillator source. 4. Perform the unlock sequence to allow a write to the OSCCON register low byte. 5. Set the OSWEN bit (OSCCON<0>) to initiate the oscillator switch. Once the basic sequence is completed, the system clock hardware responds automatically as follows: 1. The clock switching hardware compares the COSC status bits with the new value of the NOSC control bits.If they are the same,the clock switch is a redundantoperation.In this case,the OSWEN bit is cleared automatically and the clock switch is aborted. 2. If a valid clock switch has been initiated, the LOCK (OSCCON<5>) and the CF (OSCCON<3>) status bits are cleared. 3. The new oscillator is turned on by the hardware ifit is not currently running.If a crystal oscillator mustbe turned on, the hardware waits until the Oscillator Start-up Timer (OST) expires. If the new source is using the PLL, the hardware waits until a PLL lock is detected (LOCK = 1). 4. The hardware waits for 10 clock cycles from the new clock source and then performs the clock switch. 5. The hardware clears the OSWEN bit to indicate a successful clock transition. In addition, the NOSC bit values are transferred to the COSC status bits. 6. The old clock source is turned off at this time, with the exception of LPRC (if WDT or FSCM are enabled) or LP (if LPOSCEN remains set). 8.3 Fail-Safe Clock Monitor (FSCM) The Fail-Safe Clock Monitor (FSCM) allows the device to continue to operate even in the event of an oscillator failure. The FSCM function is enabled by programming. If the FSCM function is enabled, the LPRC internal oscillator runs at all times (except during Sleep mode) and is not subject to control by the Watchdog Timer. In the event of an oscillator failure,the FSCM generates a clock failure trap event and switches the system clock over to the FRC oscillator.Then the application program can either attemptto restart the oscillator or execute a controlled shutdown. The trap can be treated as a warm Reset by simply loading the Reset address into the oscillator fail trap vector.
  • 7. If the PLL multiplier is used to scale the system clock, the internal FRC is also multiplied by the same factor on clock failure. Essentially, the device switches to FRC with PLL on a clock failure. EN LA PAGINA 126 DEL DATASHEET EXPLICA ESTE CODIGO:
  翻译: