Minimum wait time from read to write of VPBDIV?
2005-02-14 by fuhsjr00
The engineering dept. at the particular company that I work for is
looking into using the Philips LPC as the foundation for our future
devices. We have been playing with an Olimex LPC-H212X evaluation
board. I've written various small programs to test the features we
need from the processor.
We are using a 14.7456 MHz crystal and have CCLK and PCLK set to
58.9824 MHz.
The errata listed for the LPC2129 helped to get the external
interrupts going. The result was:
{
/* Do PLL, UART0 and interrupt vector 0 initialization... */
PINSEL1 |= 1;
tmp = VPBDIV;
tmp = VPBDIV;
VPBDIV = 0;
EXTMODE = 1;
VPBDIV = 1;
VPBDIV = 0;
EXTPOLAR = 0;
VPBDIV = 0;
VPBDIV = tmp;
/* Remainder of program... */
}
This seemed to work fine. However, when I tried using the external
interrupts with a more complicated program, I began to get odd
behavior. After playing around with it for a while, I discovered that
the following would work.
{
volatile int vol;
int i;
/* Do PLL, UART0 and interrupt vector 0 initialization. */
PINSEL1 |= 1;
tmp = VPBDIV;
tmp = VPBDIV;
for(i = 0; i < 3; i++){
vol = 0;
}
VPBDIV = 0;
EXTMODE = 1;
VPBDIV = 1;
VPBDIV = 0;
EXTPOLAR = 0;
VPBDIV = 0;
VPBDIV = tmp;
/* Remainder of program. */
}
If I bumped the number of iterations down to 2, the program would
exhibit odd behavior.
Could anyone explain to me why this is?
Thanks,
Josh