Forums

Speed Problem on LPC2300 & LPC2101/2/3

Started by nxp_marketing_usa June 5, 2007
>>Does the behaviour change if you alter the division ratio between
>>AHB and VPB i.e. VPBDIV?

Hmmmmm. I DID try changing VPBDIV from 01 to 02 (Divide by 1 to
Divide by 2) and it didn't fix it, however it did slow my PWM
frequency down. Is this what you meant for me to try, Danish ??

Thank you,
boB
--- In l..., "Danish Ali" wrote:
>
> Pure speculation here, but it sounds to me like an
> issue with the AHB to VPB bridge.
> The processor (on the AHB) alternates reading and
> writing to devices on the VPB.
>
> Maybe the reads get priority (because they would
> stall the processor) and somehow the system
> never gets round to doing the write to the PWM
> because the next read has come round (unless you
> put in a NOP to delay things). The AHB-to-VPB
> bridge might be too clever in that it sees that
> the next-time-round-the-loop write is to the same
> address, and somehow assume that it is ok to lose
> the older write.
> I seem to remember (on discussions of non-fast GPIO
> ports, also on the VPB) that you had to issue two
> consecutive writes to the VPB to be certain that
> the first one had taken.
>
> How might you test this theory? Does the behaviour
> change if you alter the division ratio between
> AHB and VPB i.e. VPBDIV?
>
> Hope this helps,
> Danish
>
> --- In l..., "bobtransformer" wrote:
> >
> > OK, Changing MAMCR to 1 did not fix it. Changing the PLL
> > from 12 MHz X 5 to 12MHz X 4 did not fix it either. I will try to
> > explain sortof what I'm doing in my main() while(1) loop which is
> > where I have to add the NOP. My board has some pots and LEDs and
> > RS232 interface etc. I am reading A/D channels, one of which is a
> > TrimPOT, and I am shoving the A/D result into a INT called PWM which
> > is changed in my timer interrupt as well as where the A/D is managed.
> > Here is the simplest form of my code in the while loop...
> >
> > while(1) { //while loop in main
> > asm("nop"); //Adding this one line fixes my PWM problem
> > PWM = AD1CH.absorbPot;
> > }
> >
> > Now, my PWM works just fine with the NOP added either at beginning or
> > the end.
> >
> > Normally, this while loop has a bunch of other code, such as LEDs etc
> > (using a Second counter also in timer int), UART output of Voltage
> > from A/D channels etc. They seem to work fine. Just the A/D to PWM
> > doesn't work without the NOP. If all that other code is in this while
> > loop, it does not change the fact that I need to add that NOP. I can
> > put the NOP anywhere in the code, inbetween the UART output and LEDs
> > blinking or whatever, and it fixes the PWM. I can turn the pot and
> > the PWM changes as it should. Also, I can add as many or few NOPs in
> > there as I want. It must have at least one NOP, anywhere to make the
> > PWM take the A/D value. Now I am going to go look at the output
> > listing and see if optimization changes do anything as well. IAR,
> > LPC2144 and J-Link.
> >
> > Any ideas gladly looked into.
> > Thanks,
> > boB
>

An Engineer's Guide to the LPC2100 Series

Yes that is what I meant you to try. Yes it would also
slow the PWM frequency. Sorry it didn't help.

Checking the User Manual I see things are more
complicated on the LPC2300 because you have
PCLKSEL to individually select clocks for each
peripheral.

Regards,
Danish
--- In l..., "bobtransformer" wrote:
>
> >>Does the behaviour change if you alter the division ratio between
> >>AHB and VPB i.e. VPBDIV?
>
> Hmmmmm. I DID try changing VPBDIV from 01 to 02 (Divide by 1 to
> Divide by 2) and it didn't fix it, however it did slow my PWM
> frequency down. Is this what you meant for me to try, Danish ??
>
> Thank you,
> boB