Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

VPB bad read behaviour

2003-12-09 by Robert Adsett

I'm seeing some odd behaviour in the VPB registers that I haven't been able 
to track down so far.  So I thought I would check to see if anyone else had 
run across it yet.  The following is a code fragment I'm using to read the 
VPB divider so that I can determine the clock speed the peripherals see.

  *ptr = (VPB_param)VPBDIV;/*lint !e930*/
  switch( VPBDIV & 0x3) {
     case VPB_DIV_ONE:
          *ptr =  VPB_DIV1;
          break;

     case VPB_DIV_HALF:
          *ptr =  VPB_DIV2;
          break;

     case VPB_DIV_QUARTER:
          *ptr =  VPB_DIV4;
          break;

     default:
          r->_errno = EINVAL;
          return -1;
     }
  return 0;

Notice that I'm reading the divider twice.  The first time is just thrown 
away.  If I remove that first read and just use the one in the switch I get 
an incorrect result.  The assembly output does appear to be correct.

Anyone seen anything like this before?  I don't have a nice short 
reproducible test case yet.  For now I'm living with the workaround but I'm 
worried about what else may be lurking out there.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.