Declaring tmp as volatile appears to have cleared it up. Thank you.
I'm using the GNU ARM toolchain with the -Os flag.
It seems that having VPBDIV declared as volatile should have implied
the same thing. I suppose I'm not clear on the semantics of volatile
reads.
Josh
--- In lpc2000@yahoogroups.com, "Richard" <richas@y...> wrote:
>
> Josh,
> Make sure that your compiler is not the culprit. Often times it
> will "optimize" out writes to dummy variables or multiple writes to
> the same variable. Try lowering the optimization level and/or verify
> that the C code gets compiled. Declaring the variable as volatile may
> take care of the problem.
>
> Richard
>
>
> --- In lpc2000@yahoogroups.com, "fuhsjr00" <fuhsjr00@y...> wrote:
> >
> > 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,
> >
> > JoshMessage
Re: Minimum wait time from read to write of VPBDIV?
2005-02-15 by fuhsjr00
Attachments
- No local attachments were found for this message.