Thread (7 messages) 7 messages, 5 authors, 2007-02-26

Re: MPC834x global timers question

From: Ben Warren <hidden>
Date: 2007-02-24 03:20:25

Bruce,
--- Bruce_Leonard@selinc.com wrote:
I know this isn't the right forum for this but I
can't seem to find a 
generic PPC mailing list.

I'm trying to get a global timer going on an
MPC834x, and the way I learn 
is to just play with HW, so I've got an Abatron
BDI2K hooked up to my 
processor so I can just manipulate registers without
having to deal with 
writing code.  However, I seem to be unable to
modify certain registers in 
the global timers with this set up and I don't
understand why. 
Specifically, if a register has a bit that's a '1'
following a reset, I 
can't change that bit to a '0'.  This is happening
with the Global Timers 
Reference Registers (GTRFR1 - 4) and the Global
Timers Prescale Registers 
(GTPSR1 - 4).  The reset state of the GTRFRs is
0xFFFF and I can't change 
it to any other value.  The reset state of the
GTPSRs is 0x3 and I can't 
clear the 2 LSB.  I can change any other bits in the
prescale registers, 
but not the two which are a '1' at reset.
There's a sequence that needs to be followed.  You
need to enable the timer first, then set the mode,
then set the prescaler.  I've attached some expect
code for U-boot that generates a 1Hz output from timer
3 on an MCP8349.  It's not quite what you have, but
hopefully close enough for you to figure it out.  I
also have a simple char driver for Linux if you need
it later on.

COMMENT "Set SICLR so that GPIO1_8 becomes TOUT3"
send "mm.w e0000114\r"
expect $mmPrompt
send "8001\r"
expect $mmPrompt
send "q\r"
expect $mainPrompt

COMMENT "Enable timer 3"
send "mm.b e0000504\r"
expect $mmPrompt
send "01\r"
expect $mmPrompt
send "q\r"
expect $mainPrompt

COMMENT "Set mode register"
send "mm.w e0000520\r"
expect $mmPrompt
send "ff0c\r"
expect $mmPrompt
send "q\r"

COMMENT "Set frequency to 1Hz"
send "mm.w e0000524\r"
expect $mmPrompt
send "1f77\r"
expect $mmPrompt
send "q\r"
expect $mainPrompt

Hope this helps
regards,
Ben
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help