Can someone from Freescale please verify the above behavior as either true or false? The code to test is this (where, if ERCLKEN is off, oscillator does not start even though EREFS is on):
mov #%00000110,ICSC2
; |||||||+--------- EREFSTEN
; ||||||+---------- ERCLKEN (change to 0 and see if it oscillates)
; |||||+----------- EREFS
; ||||+------------ LP
; |||+------------- HGO
; ||+-------------- RANGE
; ++--------------- BDIV
brclr OSCINIT.,ICSSC,*
clr ICSC1
If indeed there is a problem, you won't get past the BRCLR instruction (and the oscillator will not work).
I also have another strange behavior with the RTI on the same chip. It won't accept the external reference as a source clock (i.e., no interrupts), it only works with the internal 1KHz reference. No stop modes are involved, so the EREFSTEN bit shouldn't matter. Again, can someone verify this? This is the code (where, if RTCLKS is 1 [external], no interrupts are triggered):
lda #%00010001
|||||+++--------- RTIS - Period for RTI
||||+------------ Reserved
|||+------------- RTIE - Interrupt Enable
||+-------------- RTCLKS - RTI Clock Source (change to 1 and see)
|+--------------- RTIACK - Interrupt Acknowledge
+---------------- RTIF - Interrupt Flag
sta SRTISC ;turn on RTI interrupts
...
RTI_Handler
lda #RTIACK_
ora SRTISC
sta SRTISC ;reset the interrupt
rti
org Vrti
dw RTI_Handler
If RTCLKS is 1, the RTI_Handler isn't entered.
The code as is works with external 32.768KHz crystal and internal RTI 1KHz reference.
Thanks.
P.S. To whoever rated my original post as average, it'd be nice if they also bothered to tell the world how come, while they obviously can't offer any advice (even a simple one, like: it's in the book, read p. xxx), they feel they're justified to rate something for which they have nothing to say. Plain arrogance, I guess. If they at least offered some useful advice, I'd be happier with even a zero rating from them!