Nano Matter- SPI speed fixed at 38 MHz ?

I am using a TFT display with an SPI interface on my Nano Matter. 

I am using the Arduino Silabs core package 2.2.0, the latest.
While I am able to get the display to work with the Adafruit_ST7789 library, I measure the SPI clock at 38 MHz which the display can barely handle. I can't seem to slow the SPI clock rate down using any of the following methods:
tft.initSPI(8000000,SPI_MODE0);
This is a function call of the tft library, but doesn't work with MG240
SPI.setClockDivider(8);
This doesn't work with MG240S -deprecated
SPI.beginTransaction(8000000,MSBFIRST,SPI_MODE0);
This won't even compile- err message is :
no matching function for call to 'arduino::SilabsSPI::beginTransaction(int, BitOrder, arduino::SPIMode)'

I see in the api folder of the core package, in file HardwareSPI.h the following:
// Default speed set to 4MHz, SPI mode set to MODE 0 and Bit order set to MSB first. SPISettings() { init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0); }

However, this can't be right, as I get a 38 MHz SPI clock regardless of what I try.
Has anyone managed to set the SPI clock rate?
Thanks

Try...

SPI.begin ();
SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE01));

Hi Scott. Thanks for the response/info. I had tried that, which likely works, but am using Adafruit's SP7789 library for my TFT display. It was using its own SPIsettings structure for its SPI transactions. When I dug deeper, I found it was using 32 MHz as its default, and the MG240S was producing 38 MHz, as close as it could come to 32 MHz. Once I changed that in the library, I was able to get the lower speed that I wanted.
Cheers

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.