Feather M0 with st7735 over sercom SPI

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
orhanyor
 
Posts: 10
Joined: Wed Mar 20, 2019 5:19 pm

Feather M0 with st7735 over sercom SPI

Post by orhanyor »

hello, im trying to run this tft ST7735 with sercom SPI with no luck so far. i carefully followed the instructions in here https://learn.adafruit.com/using-atsamd ... -a-new-spi and tried implement the required code to a very basic code to test it.

things to note : if i use regular hw SPI constructor with default MOSI SCK pins screen works perfectly fine. i only move those two pins to sercom SPI but screen is just blank. while wired for sercom SPI i changed the constructor to use software SPI again screen works with those pins intended for sercom SPI. like this;
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
along with
#define TFT_MOSI 11
#define TFT_SCLK 12

if i keep the code above for softwareSPI and also keep the sercom declaration along with pinperipheral for pins 11 and 12 screen still works in software SPI. while all this is happening i get very fast count from 1 to 255 in serial monitor which i believe is a sign at least mySPI is alive.

can anybody please look at the code and see if im doing something wrong. thank you

Code: Select all


#include <Adafruit_GFX.h>    
#include <Adafruit_ST7735.h> 
#include <SPI.h>
#include "wiring_private.h"  //essential for pinperipheral function

#define TFT_CS        6
#define TFT_RST       9 
#define TFT_DC        10

SPIClass mySPI (&sercom1, 13, 12, 11, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_1);  // sercom spi definition


Adafruit_ST7735 tft = Adafruit_ST7735(&mySPI, TFT_CS, TFT_DC, TFT_RST);  // st7735 constructor

void setup() {
  Serial.begin(115200);
  
  mySPI.begin();
  
  pinPeripheral(11, PIO_SERCOM);   //defining pin 11, 12, 13 to be used as sercom pins.
  pinPeripheral(12, PIO_SERCOM);
  pinPeripheral(13, PIO_SERCOM);
  
 tft.initR(INITR_MINI160x80);  

 tft.fillScreen(ST7735_WHITE);  

 tft.setTextWrap(false); 

 tft.setCursor(0, 0); 
 tft.setTextColor(ST7735_BLACK); 
 tft.setTextSize(3); 
 tft.println("Hello");
}
uint8_t i=0;
void loop()     
{
  Serial.println(i);
  mySPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));     // copied this part from adafruit spi example 
  mySPI.transfer(i++);
  mySPI.endTransaction();
}
Last edited by orhanyor on Sun Apr 28, 2019 8:37 am, edited 1 time in total.

User avatar
orhanyor
 
Posts: 10
Joined: Wed Mar 20, 2019 5:19 pm

Re: Feather M0 with st7735 over sercom SPI

Post by orhanyor »

issue is library related opened a thread in github page

https://github.com/adafruit/Adafruit-GF ... issues/215

User avatar
orhanyor
 
Posts: 10
Joined: Wed Mar 20, 2019 5:19 pm

Re: Feather M0 with st7735 over sercom SPI

Post by orhanyor »

solved

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”