XIAO_nRF52840 mbed's SPI performance is only 1/3.5 of non-mbed's

I knew that there were differences between “mbed” and “non-mbed” in terms of maximum SPI clock frequency (mbed:8MHz non-mbed:32MHz) and port drive mode (mbed:standard drive non-mded:high drive). However, when I used an OLED display at the same 8 MHz, I found that there was a big difference in frame rate. I investigated and found that the main reason is that the 1-byte transfer time is 5.6uS for “non-mbed” and 19.5uS for “mbed”. The data transfer throughput is only 1/3.5.
Be careful when using SPI with “mbed”.

Below is a summary of the analysis results.

DisplayTest_Video.zip (3.3 MB)

Display_Test_sketch.zip (1.9 KB)

2 Likes

Very good analyses @msfujino , thank you!

Everyone from Seeed looking at this, here is a practical example of the problems caused by this:

Now all the code was moved from mbed to standard Adafruit-libraries because it was unusably slow with mbed.