I have a Grand Central M4, which is an awesome board for protoyping :) And I am using the Arduino IDE. And at first, I want to give a big thank you for providing all the boards and libraries for the Arduino IDE!!
Now, I need to connect one of those small SSD1331 SPI RGB OLEDs to an SPI interface on the pins in the range ~30-49 (default SPI is already in use). I followed the guide here
https://learn.adafruit.com/using-atsamd ... -a-new-spi
and basically, it "works", but display changes were even slower compared to a Soft-SPI. So, I measured the SCK, and it is running at ~150kHz, while the display should be able to handle at least 8MHz.
Now, my question is: How can I change the speed on sercom6 to an appropriate SPI speed? And maybe how to change the clock source if necessary? I am really stuck here.
Here are the relevant parts of my code which I guessed mainly from sercom.cpp:
Code: Select all
// SPI2 pins: SS: 46, MISO: 47, MOSI: 48, SCK: 49
#define OLED_SCK_PIN 49
#define OLED_MOSI_PIN 48
#define OLED_CS_PIN 45
#define OLED_DC_PIN 44
#define OLED_RST_PIN 43
#include "wiring_private.h" // pinPeripheral() function
SPIClass SPI2 (&sercom6, 47, OLED_SCK_PIN, OLED_MOSI_PIN, SPI_PAD_0_SCK_1, SERCOM_RX_PAD_3);
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <Fonts/FreeSerif9pt7b.h>
Adafruit_SSD1331 *oled;
void setup()
{
sercom6.setClockSource(sercom6.getSercomIndex(), SERCOM_CLOCK_SOURCE_100M, true);
sercom6.setClockSource(sercom6.getSercomIndex(), SERCOM_CLOCK_SOURCE_100M, false);
SPI2.begin();
pinPeripheral(OLED_SCK_PIN, PIO_SERCOM);
pinPeripheral(OLED_MOSI_PIN, PIO_SERCOM);
oled = new Adafruit_SSD1331(&SPI2, OLED_CS_PIN, OLED_DC_PIN, OLED_RST_PIN);
oled->begin(100000000);
}
Thank you very much!!