home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vxworks
- Path: sparky!uunet!news!wrs.com!carl
- From: carl@wrs.com (Carl Chesbrough)
- Subject: Re: MVME167 and RealTime Clock
- Message-ID: <carl.713812388@wrs.com>
- Sender: news@wrs.com (News Manager)
- Nntp-Posting-Host: yellow
- Organization: Wind River Systems, Inc.
- References: <1992Aug14.013252.7600@chiton.ucsd.edu> <1992Aug14.024626.21811@leland.Stanford.EDU>
- Date: Fri, 14 Aug 1992 17:13:08 GMT
- Lines: 61
-
- marcu@leland.Stanford.EDU (Marc Albert Ullman) writes:
-
- >In article <1992Aug14.013252.7600@chiton.ucsd.edu> cdl@chiton.ucsd.edu (Carl Lowenstein) writes:
- >>Deep down in the inside of the PCC2 hardware is a prescale divider
- >>that divides the CPU clock rate (25 MHz) to make the timer clock.
- >>The MVME167 Programmers Manual points out that the byte that controls
- >>the prescaler should be set to (256 - BCLK), or 0xe7 for 25 MHz.
- >>I found both by peeking at the hardware register and by examining
- >>the code in vw/config/mv167/sysLib.c that the number in use was 0xe6.
- >>The one's complement of 25, rather than the two's complement.
- >>
- >> *PCC2_PRESCALE = ~BCLK; /* one's complement, wrong */
- >>
- >> *PCC2_PRESCALE = -BCLK; /* two's complement, right */
- >>
- >>What a difference between the little straight line and the little wiggly one!
-
- >While I agree with your general problem assessment--indeed the library
- >code is wrong--your fix is not quite correct. It is the Prescaler Clock
- >Adjust Register that is being incorrectly initialized. It is not clear
- >why the driver even bothers writing to the Prescaler Count Register since
- >the documentation says it is a read-only register (although the register
- >map says otherwise). Thus I believe the correct fix is to change:
-
- > *PCC2_PRESCALE = ~BCLK;
- > *PCC2_PRESCALE_CLK_ADJ = ~BCLK;
- >to:
- > *PCC2_PRESCALE_CLK_ADJ = 256 - BCLK;
-
- >Yes, I realize that for a char register the 256 is unnecessary but it
- >makes it clearer that one read the documentation.
-
- >--Marc Ullman
- > Stanford University
-
- On page 2-63 of the Motorola MV167 Programmer's Reference Guide the
- Prescaler Counter register is shown as R/W. The description states:
-
- "... The lower 8 bits of the prescaler counter increment to
- $FF at the bus clock rate and then they are loaded from the
- prescaler adjust register. ..."
-
- Also, the reset value is shown to be 0x00. Thus if you do not do an
- initial write to this register the first count will be from 0x00 to
- 0xff, and not from 0xec to 0xff (for 20 MHz). Once the counter would
- go from 0x00 to 0xff, then the prescaller adjust register is loaded.
-
- The correct fix is:
-
- *PCC2_PRESCALE = ~BCLK;
- *PCC2_PRESCALE_CLK_ADJ = ~BCLK;
-
- to:
-
- *PCC2_PRESCALE = 256 - BCLK;
- *PCC2_PRESCALE_CLK_ADJ = 256 - BCLK;
-
-
- Carl C. Chesbrough
- Wind River Systems, Inc.
- carl@wrs.com
-