home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vxworks / 726 < prev    next >
Encoding:
Text File  |  1992-08-14  |  2.7 KB  |  74 lines

  1. Newsgroups: comp.os.vxworks
  2. Path: sparky!uunet!news!wrs.com!carl
  3. From: carl@wrs.com (Carl Chesbrough)
  4. Subject: Re: MVME167 and RealTime Clock
  5. Message-ID: <carl.713812388@wrs.com>
  6. Sender: news@wrs.com (News Manager)
  7. Nntp-Posting-Host: yellow
  8. Organization: Wind River Systems, Inc.
  9. References: <1992Aug14.013252.7600@chiton.ucsd.edu> <1992Aug14.024626.21811@leland.Stanford.EDU>
  10. Date: Fri, 14 Aug 1992 17:13:08 GMT
  11. Lines: 61
  12.  
  13. marcu@leland.Stanford.EDU (Marc Albert Ullman) writes:
  14.  
  15. >In article <1992Aug14.013252.7600@chiton.ucsd.edu> cdl@chiton.ucsd.edu (Carl Lowenstein) writes:
  16. >>Deep down in the inside of the PCC2 hardware is a prescale divider
  17. >>that divides the CPU clock rate (25 MHz) to make the timer clock.
  18. >>The MVME167 Programmers Manual points out that the byte that controls
  19. >>the prescaler should be set to (256 - BCLK), or 0xe7 for 25 MHz.
  20. >>I found both by peeking at the hardware register and by examining
  21. >>the code in vw/config/mv167/sysLib.c that the number in use was 0xe6.
  22. >>The one's complement of 25, rather than the two's complement.
  23. >>
  24. >>    *PCC2_PRESCALE = ~BCLK;        /* one's complement, wrong */
  25. >>
  26. >>    *PCC2_PRESCALE = -BCLK;        /* two's complement, right */
  27. >>
  28. >>What a difference between the little straight line and the little wiggly one!
  29.  
  30. >While I agree with your general problem assessment--indeed the library
  31. >code is wrong--your fix is not quite correct.  It is the Prescaler Clock
  32. >Adjust Register that is being incorrectly initialized.  It is not clear
  33. >why the driver even bothers writing to the Prescaler Count Register since
  34. >the documentation says it is a read-only register (although the register
  35. >map says otherwise).  Thus I believe the correct fix is to change:
  36.  
  37. >        *PCC2_PRESCALE        = ~BCLK;
  38. >        *PCC2_PRESCALE_CLK_ADJ  = ~BCLK;
  39. >to:
  40. >        *PCC2_PRESCALE_CLK_ADJ  = 256 - BCLK;
  41.  
  42. >Yes, I realize that for a char register the 256 is unnecessary but it
  43. >makes it clearer that one read the documentation.
  44.  
  45. >--Marc Ullman
  46. >  Stanford University
  47.  
  48. On page 2-63 of the Motorola MV167 Programmer's Reference Guide the
  49. Prescaler Counter register is shown as R/W.  The description states:
  50.  
  51.     "... The lower 8 bits of the prescaler counter increment to
  52.     $FF at the bus clock rate and then they are loaded from the
  53.     prescaler adjust register.  ..."
  54.  
  55. Also, the reset value is shown to be 0x00.  Thus if you do not do an
  56. initial write to this register the first count will be from 0x00 to
  57. 0xff, and not from 0xec to 0xff (for 20 MHz).  Once the counter would
  58. go from 0x00 to 0xff, then the prescaller adjust register is loaded.
  59.  
  60. The correct fix is:
  61.  
  62.     *PCC2_PRESCALE          = ~BCLK;
  63.     *PCC2_PRESCALE_CLK_ADJ  = ~BCLK;
  64.  
  65. to:
  66.  
  67.     *PCC2_PRESCALE          = 256 - BCLK;
  68.     *PCC2_PRESCALE_CLK_ADJ  = 256 - BCLK;
  69.  
  70.  
  71. Carl C. Chesbrough
  72. Wind River Systems, Inc.
  73. carl@wrs.com
  74.