2011-04-10, 15:39:52
Hi,
it seems i fixed the problem. I added this:
;Place the New Oscillator Selection (NOSC=0b111) in W0
MOV #0x17, 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 WREG, OSCCONH
; 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
copy/pasted Code Example for Clock Switching from 07. Oscillator - dsPIC33F FRM.pdf into
; User specific entry code area
Now application with XT_PLL switched on works and Loader works normally.
Dmitri
it seems i fixed the problem. I added this:
;Place the New Oscillator Selection (NOSC=0b111) in W0
MOV #0x17, 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 WREG, OSCCONH
; 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
copy/pasted Code Example for Clock Switching from 07. Oscillator - dsPIC33F FRM.pdf into
; User specific entry code area
Now application with XT_PLL switched on works and Loader works normally.
Dmitri