Hi Robodude,
The LPC1768 is a pretty nippy MCU, and the mbed libraries are pretty efficient, so I am surprised you are seeing sub 8MHz Arduino performance. I;d suggest it is something about your configuration or software, rather than the mbed itself.
Lets step through this and see where the problem is likely to be.
First off, it sounds like cracking the CPU clock up from 100MHz to 128MHz made little difference, so i'd sugges that the CPU isnt the bottle neck here. If the program was CPU bound, you'd have have seen a 30% increase in speed.
The IO libraries are pretty efficient. If you want to do some testing and benchmarking, that would be great (even better, publish the results back here!). You could do something like :
#include "mbed.h"
DigitialOut foo (p20);
int main () {
while(1){
foo = !foo;
}
}
This would hammer the IO as fast as possible, and if you have access to an oscilloscope, you could measure just how fast you can get around this IO loop.
However, the SPI interface isnt bitbashed, there is dedicated hardware, so as long as data is being fed to the SPI block fast enough, the transfer rate to the display is only bounded by the frequency that you've set the SPI interface to.
http://mbed.org/handbook/SPI
You'll notice that the SPI interface defaults to 1MHz, so that just about anything that you connect will work, which is great for a newbie. The more advanced users will appreciate the consequences of ramping this up to 10MHz, to the high speed stuff is left as a choice.
If you are happy to publish your code, myself and other mbed'ers will be able to take a look and maybe make some suggestions. Simply right click your project in the compiler and select publish, then post the generated URL to this thread.
Hope that helps,
Chris
Hey guys,
I got my mbed about 10 hours ago and have been playing with it. I decided to test the power of the 100MHz Cortex-M3 behind the mbed by seeing how smoothly it can drive a 320 x 240px QVGA LCD I got from ThaiEasyElec (TEE). I previously ran it off a 8MHz ATMega32, and earlier today managed to get it working on my XMega128a1 that runs at 32MHz. I am using the library provided by TEE for the ELT240320TP LCD. The LCD is controlled via a 8-bit parallel bus for data, and 6 control pins for select, read, write, backlight and reset.
The 32MHz XMega ran their demo code (filling the screen with a color, drawing six rectangles and four squares, as well as rendering a line of text) in under ~800 ms. I used my iPhone as a stopwatch, and before the moment I hit start!
The exact same library was ported to the mbed using the APIs documented on the site and compiler such as DigitalOut, BusOut, etc. This same exact test took over TEN seconds to be completed on the mbed. I'm sorry, but as far as I know a 100MHz ARM Cortex-M3 is supposed to be faster than a 32MHz XMega.... Hell, even a 8MHz ATMega32 or else NXP is in trouble.
I even tried using the ClockControl library to bump the speed up to 128MHz -- which worked, but barely made it any faster.
Are the APIs so slow? I know Arduino's built in digitalwrite functions are pretty slow but wow - I'd imagine a LPC1768 to handle it.
-robodude666