0

How can i get faster Soft SPI on zero
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How can i get faster Soft SPI on zero

by AHMEARS on Wed Sep 13, 2017 6:44 am

My tft Display with Joystick work to slow on a Genuino Zero shield, since i used in my sketch for gps modul:
If i use: Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); my tft did not work.
So i use: Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK);

#define SD_CS 4
#define TFT_CS 10
#define TFT_RST 0
#define TFT_DC 8
#define TFT_SCLK 13
#define TFT_MOSI 11

#define mySerial Serial2
Uart Serial2 (&sercom2, 3, 2, SERCOM_RX_PAD_1, UART_TX_PAD_2);


in void setup()
pinPeripheral(3, PIO_SERCOM_ALT);
pinPeripheral(2, PIO_SERCOM);

Should i change the spi frequency?
how can i improve the performance?

AHMEARS
 
Posts: 74
Joined: Fri Aug 04, 2017 6:57 am

Re: How can i get faster Soft SPI on zero

by adafruit_support_rick on Wed Sep 13, 2017 12:33 pm

I don't understand what the GPS has to do with SPI.

The Zero does not have hardware SPI on pins 11, 12, and 13., so that's why you have to use Software SPI.
However, you *can* use Hardware SPI by running wires from the ICSP header on the Zero to the SCK and DI pads on the Shield.

The ICSP pinout is as follows. Only wire up the SCK and MOSI pins.
ICSP pinout.png
ICSP pinout.png (9.88 KiB) Viewed 192 times

adafruit_support_rick
 
Posts: 34836
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: How can i get faster Soft SPI on zero

by AHMEARS on Wed Sep 13, 2017 1:00 pm

now i use Software SPI but this work to slow. So if i use Hardware SPI and wire from ICSP header to SCK and DI pads, will the 1.8" tft work faster?
Should i absolutly use Pin 11, 12, 13? which advantages i have?
Tanks a lot for support

AHMEARS
 
Posts: 74
Joined: Fri Aug 04, 2017 6:57 am

Re: How can i get faster Soft SPI on zero

by adafruit_support_rick on Wed Sep 13, 2017 1:40 pm

Hardware SPI will be much faster.

You do not use pin 11, 12, 13. They can only be used for software SPI on the Zero.

Use SCK and MOSI on the ISP header. Use the following in your sketch:
Code: Select all | TOGGLE FULL SIZE
#define TFT_CS     10
#define TFT_RST    9
#define TFT_DC     8

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);

adafruit_support_rick
 
Posts: 34836
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: How can i get faster Soft SPI on zero

by AHMEARS on Thu Sep 14, 2017 8:32 am

sure that i must use DI pad? because if i use DI Pad i have a white screen and if i use DO than it works.
If i want to use Sd card (at that moment sd init failed) should i wired more pins on spi from zero to my tft?

AHMEARS
 
Posts: 74
Joined: Fri Aug 04, 2017 6:57 am

Re: How can i get faster Soft SPI on zero

by adafruit_support_rick on Thu Sep 14, 2017 9:30 am

Well, if DO works, then I'm happy.

You don't need to do anything different for the SD. Make sure you are using digital 4 for CS when you call SD.begin
Code: Select all | TOGGLE FULL SIZE
#define SD_CS    4  // Chip select line for SD card

  Serial.print("Initializing SD card...");
  if (!SD.begin(SD_CS)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");

adafruit_support_rick
 
Posts: 34836
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: How can i get faster Soft SPI on zero

by AHMEARS on Thu Sep 14, 2017 10:55 am

if i use MISO from ISP (ZERO shield) to DI pad than sd works

Thanks a lot for Support

AHMEARS
 
Posts: 74
Joined: Fri Aug 04, 2017 6:57 am

Re: How can i get faster Soft SPI on zero

by adafruit_support_rick on Thu Sep 14, 2017 1:34 pm

D'Oh! Right - you need MISO. Sorry.

adafruit_support_rick
 
Posts: 34836
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.