Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
3 years, 7 months ago.
SPI speed difference between old (rev 17) MBED lib and latest MBED lib
I'm running into a strange speed difference with SPI running the exact same program, with 2 different MBED libraries. I am driving a small 128x64 OLED screen on SPI, where I'm measuring the time it takes to clear the display. The display library I'm running can be found here: https://developer.mbed.org/users/Anaesthetix/code/SSH1106/
In both cases I'm driving the SPI bus with a frequency of 24 MHz (checked with a scope). The one using rev 17 of the mbed lib, clears the display in 1ms. Where the same program, with the latest mbed lib included, completes its task in 2ms. It seems that the time in between writes to the bus doubled. To check whether there are any differences when running iterations, I've run a madgwick filter with both mbed libraries. In both cases, it takes 62us to run the filter once. So no speed difference there.
A quick scope snap of the SCLK pin while running the old (rev17) lib: https://postimg.org/image/7ffi5c1x5
And one while running the latest lib: https://postimg.org/image/742n6baux
The code mentioned above runs on the Mbed LPC1768, at a 128 MHz core clock. I've sifted through the changelogs, but cannot find anything related to this. If anyone is able to give insight into why this happens, that would be greatly appreciated. Also, merry christmas to you all!
3 years, 7 months ago.
No explanation yet, but some remarks: You state the LPC1768 is running at coreclock of 128 MHz. That seems wrong. The default coreclock for the mbed lib on the LPC1768 is 96 MHz (to support the USB function). The nominal freq of the LPC1768 is 100 MHz. Have you modified the PLL?
The SPI baudrate is set at 24 MHz in the OLED lib, and you say it was checked on a scope. However, even the first picture shows SCLK rate at about 919 KHz. So way off.. The second pic shows SCLK freq of about half that speed, which could explain doubling the time for the clear operation. So there seems to be problem with the coreclock. Have you tested other frequencies (serial port baudrate) or timers (LED blink rates).