High-speed SPI communication

akk8222
Posts: 1
Joined: Thu Nov 09, 2023 12:30 pm

High-speed SPI communication

Postby akk8222 » Thu Nov 09, 2023 12:43 pm

Hi there,
I want to send a large number of 16-bit format signals (about 2^13 patterns) and at high speed via SPI communication using an ESP32.
I created a program to send two formats and checked the protocol. Then, there is an issue that after ssPin(Select) goes low, sckPin(Clock) starts outputting too late to send. Is there any way to reduce this time?

Code: Select all

#include <SPI.h>
const int ssPin = 5;    
const int sckPin = 18;  
const int mosiPin = 23; 
const int misoPin = 19; 

uint16_t dataWRITE[2] = {0x1234, 0xABCD}; 

void setup() {
  // put your setup code here, to run once:
  SPI.begin();
  SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
  pinMode(ssPin, OUTPUT);
  digitalWrite(ssPin, HIGH); 
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int i = 0; i < 2; i++){
    digitalWrite(ssPin, LOW); 
    SPI.transfer16(dataWRITE[i]);
    digitalWrite(ssPin, HIGH); 
  }
    delay(1000);
  
}
protocol.JPG
protocol image.
protocol.JPG (61.09 KiB) Viewed 316 times

Who is online

Users browsing this forum: Baidu [Spider], cskilbeck and 190 guests