Skip to content

help!nbspi do not work on esp8266arduino sdk #2

@DengJackNo1

Description

@DengJackNo1

hello,bro,i am diy my espboy, When I was compiling the Arduino project, I found that nbSPI was not working.
gpio16 as reverse tft cs pin, when high level .cs pin is active.
gpio 12(the spi miso pin) as tft dc pin .high level as tft display data , low level as tft display data. i do not konw the reason.
maybe:

gpio 12 is spi miso pin,so nbspi do not work
2.nbspi spi speed is too fast
I hope to receive your assistance.
Here is my test code

// TFT_eSPI setup ST7735
#define TFT_MISO  PIN_D6  // D6 not connect,Automatically assigned with ESP8266 if not defined
#define TFT_MOSI  PIN_D7  // Automatically assigned with ESP8266 if not defined
#define TFT_SCLK  PIN_D5  // Automatically assigned with ESP8266 if not defined

//#define TFT_CS    -1  // Chip select control pin D8
#define TFT_DC    12  // Data Command control pin
#define TFT_RST   -1 

// nbspi setup
// Set an IO to measure timing
#define NBSPI_TDBG_IO 12
#define NBSPI_TDBG_HIGH GPOS = (1<<NBSPI_TDBG_IO) // 0.1 ?s
#define NBSPI_TDBG_LOW GPOC = (1<<NBSPI_TDBG_IO) // 0.1 ?s

#include <TFT_eSPI.h>
#include <SPI.h>
#include "nbSPI.h"
TFT_eSPI tft;
extern SPIClass spi;
uint8_t sBuffer[50][50];
void setup() {
  int i;
  Serial.begin(115200);
  Serial.println("hello 1");
  pinMode(16, OUTPUT);  // select
  digitalWrite(16, 1);  // cs active
  tft.begin();
  tft.fillScreen(TFT_RED);
  delay(1000);
  memset(sBuffer, 0xff, 2500);
  tft.setAddrWindow(10, 10, 50, 50);
  NBSPI_TDBG_HIGH;
  spi.transfer((uint8_t *)sBuffer, 2500);
  NBSPI_TDBG_LOW;
  memset(sBuffer, 0, 2500);
  while (nbSPI_isBusy())
    ;
  Serial.println("hello 1");
  NBSPI_TDBG_HIGH;
  //spi.transfer((uint8_t *)sBuffer, 2500);
  nbSPI_writeBytes((uint8_t *)sBuffer, 1600);
  NBSPI_TDBG_LOW;
  Serial.println("hello 2");
  while (nbSPI_isBusy()) {
    delayMicroseconds(2);
  };
  Serial.println("hello end3");
}

void loop() {
  delay(1000);
  // put your main code here, to run repeatedly:
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions