Question regarding SPI speed with P2/Photon2 - is this 25MHz maximum and does SPI.setClockSpeed(speed, MHZ); have a maximum vale check? I am asking because in porting a TFT library from Photon to P2, I forgot to change the speed value from 60 to 25. The sketch worked and I recorded that a fillScreen() function that was taking 44mS is now taking 86mS. If I set the clock speed to 25MHz I get the same result.
Second question is what is the best way to use DMA transfers (i.e. buffer size) to speed up writing to TFT? With the original fillScreen() on Photon - moving to writing a whole line at a time (buffer = 640 bytes) instead of each pixel reduced the time to fill a screen from 220mS to 44mS. Now with the reduced SPI bus speed the same has increased to 86mS.
SPI has a 25 MHz maximum speed. SPI1 has a maximum of 50 MHz, so if you can switch the pins around and use SPI1 (D pins), that will double the speed.
You should definitely use DMA, but using a very large DMA buffer won't have a significant improvement in speed because it will be handled in chunks internally anyway.
Also make sure you are using Device OS 5.3.1 or later, see note here.
@rickkas7 I am using OS 5.6.0, you mention about large DMA buffer affording little improvement - what is the 'sweet spot' size?
I will try with moving the TFT SPI to SPI1. I was 'pinned out' on the Photon and I am not sure I can spare the pins to have both SPI and SPI1. I need to be able to support Ethernet as an option!
@rickkas7 Would you be able to offer an explanation why when I run the same fillscreen() benchmark using SPI1 set to 50MHz speed rather than SPI at 25MHz speed it is slower?
SPI - benchmark time is 86mSec, SPI1 - benchmark time is 103mSec.