Two-speed start-up
Posted: Tue Sep 16, 2008 2:35 pm
M. Kerhuel,
we use the PIC mechanism for two-speed start-up, and we would very
much like this to be supported in the block-set. The necessary strange invocations
for the dsPIC33F series follow (taken from the Microchip manual section 70186b.pdf).
I believe it's similar for other PIC variants, but have not checked.
The extra configuration settings (in _FOSC()) are
FCKSM_CSECME Both enabled
FCKSM_CSECMD Only clock switching enabled
FCKSM_CSDCMD Both disabled (default, as the block-set does at present)
Bernard Leak.
Just *after* setting PLLFBD and CLKDIV as at present, the oscillator mode can be
switched over as follows:
;Place the New Oscillator Selection (NOSC=0b101) in W0
MOV #0x15,w0
;OSCCONH (high byte) Unlock Sequence
MOV #OSCCONH, w1
MOV #0x78, w2
MOV #0x9A, w3
MOV.B w2, [w1] ; Write 0x78
MOV.B w3, [w1] ; Write 0x9A
;Set New Oscillator Selection
MOV.B w0, [w1]
; Place 0x01 in W0 for setting clock switch enabled bit
MOV #0x01, w0
;OSCCONL (low byte) Unlock Sequence
MOV #OSCCONL, w1
MOV #0x46, w2
MOV #0x57, w3
MOV.B w2, [w1] ; Write 0x46
MOV.B w3, [w1] ; Write 0x9A
; Enable Clock Switch
MOV.B w0, [w1] ; Request Clock Switching by Setting OSWEN bit
wait:
btsc OSCCONL, #OSWEN
bra wait
we use the PIC mechanism for two-speed start-up, and we would very
much like this to be supported in the block-set. The necessary strange invocations
for the dsPIC33F series follow (taken from the Microchip manual section 70186b.pdf).
I believe it's similar for other PIC variants, but have not checked.
The extra configuration settings (in _FOSC()) are
FCKSM_CSECME Both enabled
FCKSM_CSECMD Only clock switching enabled
FCKSM_CSDCMD Both disabled (default, as the block-set does at present)
Bernard Leak.
Just *after* setting PLLFBD and CLKDIV as at present, the oscillator mode can be
switched over as follows:
;Place the New Oscillator Selection (NOSC=0b101) in W0
MOV #0x15,w0
;OSCCONH (high byte) Unlock Sequence
MOV #OSCCONH, w1
MOV #0x78, w2
MOV #0x9A, w3
MOV.B w2, [w1] ; Write 0x78
MOV.B w3, [w1] ; Write 0x9A
;Set New Oscillator Selection
MOV.B w0, [w1]
; Place 0x01 in W0 for setting clock switch enabled bit
MOV #0x01, w0
;OSCCONL (low byte) Unlock Sequence
MOV #OSCCONL, w1
MOV #0x46, w2
MOV #0x57, w3
MOV.B w2, [w1] ; Write 0x46
MOV.B w3, [w1] ; Write 0x9A
; Enable Clock Switch
MOV.B w0, [w1] ; Request Clock Switching by Setting OSWEN bit
wait:
btsc OSCCONL, #OSWEN
bra wait