Unable to start secondary oscillator on PIC24F16K102
I am unable to set the OSCCON,#SOSCEN bit on a prototype test board. The FOSC configuration is set as :-
#pragma config POSCMOD = HS
#pragma config OSCIOFNC = OFF
#pragma config POSCFREQ = HS
#pragma config SOSCSEL = SOSCHP
#pragma config FCKSM = CSDCMD
Relevent part of initialisation is :-
mov #0x0010,w0 ; Set all GPIO pins as outputs except for SOSC pins
mov w0,TRISA ;
mov w0,TRISB ;
bset OSCCON,#SOSCEN ; Enable secondary oscillator (32.768KHz) ***This does nothing - bit not set!!!****
bset T1CON,#15 ; Enable T1
bset T1CON,#1 ; Clock timer from T1CK pin (SOSCO)
I must be doing something wrong in the configuration or initialisation, but can't see any thing obvious. The SOSC power is set to high in case there was a faulty XTAL, but the fact that the SOSC enable bit cannot be set seems to be the likely cause of the problem. The processor is operating and executing a micky-mouse programme.
Hope someone can lighten my darkness.