Hello boys and girls, and sorry for this boring question.
I have been trying 1-2 year with HC08GR8 and HC08QY4 controllers, and use custom built monitor circuits based on the Motorola/Freescale book circuits (factory pdf docs.) and it's working perfectly, except one thing.
I can't start these CPU-s in normal user mode.
1. Upload 1 simple code (led blinker) to flashrom. Offcourse it working perfectly from debugger software.
2. Setup the reset vectors to my code. (example:fffe:ee , ffff:00) (My code first instruction address: $ee00)
3. Connect/disconnect the required pins, followed reference books. (example: IRQ pin vTST disconnect, external osc disconnect, etc.)
4. Turned on the power and do nothing. (Original power is a 12v car battery, what is regulated to 5v with 7805 + 2 capac.)
This is the result with GR8 and QY4 both of them.
I was beginning to give up with this CPU-s, I do not understand why is it so hard, and why didn't describe this thing clearly in factory docs.
I did everything from GR8 and QY4 reference books 100%, but it's not working.
This forum is my last chance, please help me somebody.
Thank you very much to everyone. (My english is not perfect sorry.)
Solved! Go to Solution.
As you don't give enough details about your code (or even a tiny sample that does not work for you), I can only guess.
I suspect there may be a COP issue. From the QY4 manual:
The COP should be serviced as soon as possible out of reset to guarantee the maximum amount of time before the first time out.
Are your doing this? And, later on, do you either turn off COP (with something like mov #%00000001,CONFIG1
) or service it regularly enough so it does not timeout?
The debugger disables COP so you may not see exactly the same behavior.
As you don't give enough details about your code (or even a tiny sample that does not work for you), I can only guess.
I suspect there may be a COP issue. From the QY4 manual:
The COP should be serviced as soon as possible out of reset to guarantee the maximum amount of time before the first time out.
Are your doing this? And, later on, do you either turn off COP (with something like mov #%00000001,CONFIG1
) or service it regularly enough so it does not timeout?
The debugger disables COP so you may not see exactly the same behavior.
Thank you very much Tony!
I tried this, and working, but not by move instruction.
It works only with classic lda, sta couple. (My experience, the move is not usable is several situations...)
The complete source for this prog the following:
org $ee00
lda #$01
sta $001f ;COP power off
lda #%11111111
sta $0005 ;All portb pin to output
lda #%00110110 ;Timer1 speed cycle /64
sta $0020 ;Timer1 setting up
bclr 5,$0020 ;Timer1 start!
cykl:
brclr 7,$0020,* ;Wait until timcounter overflow
bset 0,$0001 ;Portb0 led ON
bclr 7,$0020 ;Clear overflow bit
brclr 7,$0020,* ;wait until timcounter overflow again
bclr 0,$0001 ;Portb0 led OFF
bclr 7,$0020 ;Clear overflow bit
bra cykl ; branch to cykl to restart process
Oh one more little question:
When CPU run in user mode induvidually, the clock is really 8 Mhz?
Thanks!
(BTW, MOV works just fine as long as the destination address is in zero page RAM, i.e., addresses $00 through $FF, which is the case here with the CONFIG1 register).
Regarding the clock, the QY4 supports 12.8MHz, 8MHz, and 4MHz with the internal oscillator. But that is not the bus clock which is what instructions use. Bus clock for the HC08 is 1/4 the oscillator. So, if you have set the internal oscillator for 8MHz (but I don't see it in your code example as OSCSC register is not set), then the bus speed is 2MHz.
The default (from reset) oscillator is 4MHz which gives a bus of just 1 MHz.
Thankyou very much!
These informations are new for me again.
Thanks a lot!