Teensy 4.0 and Wifi Lift SPI communication(using pin 34, 35, 36) doesn't work

byungjun

Member
Teensy 4.0 and AirLift-ESP32 SPI communication(using pin 34, 35, 36) doesn't work

Hello,
I'm working with T4 communicating with Airlift(ESP32, SPI) from Adafruit using the library shown in this page.
https://learn.adafruit.com/adafruit-airlift-breakout/arduino
It woks with this configuration.

#define SPIWIFI SPI // The SPI port
#define SPIWIFI_SS 10 // Chip select pin
#define ESP32_RESETN 5 // Reset pin
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
#define ESP32_GPIO0 -1
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13

But it doesn't work if I change the configuration like the following.

#define SPIWIFI SPI // The SPI port
#define SPIWIFI_SS 35 // Chip select pin
#define ESP32_RESETN 36 // Reset pin
#define SPIWIFI_ACK 34 // a.k.a BUSY or READY pin
#define ESP32_GPIO0 -1
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13

I double checked the soldering on the bottom pads and wiring.
No other connections other than T4 and Ailift.
Since I have to use pin 5, 7, 10 for other purposes, I have to use 34, 35 and 36 for communicating with Air Lift.
Do you have any suggestion to resolve this issue?
Thank you.

Byungjun

Photo1
Photo2

Code:
#include <SPI.h>
#include <WiFiNINA.h>
#include <SoftwareSerial.h>


#define SPIWIFI       SPI  // The SPI port
#define SPIWIFI_SS    35// 10//35   // Chip select pin, White
#define ESP32_RESETN  36 // 5//36   // Reset pin, Yellow
#define SPIWIFI_ACK   34 // 7//34   // a.k.a BUSY or READY pin, blue
#define ESP32_GPIO0    -1//37   // 37
#define MOSI_PIN  11
#define MISO_PIN  12
#define SCK_PIN   13

#define S2Tx 8
#define S2Rx 7



void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  Serial2.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  delay(1000);
  Serial.println("WiFi Scanning test");

  // SPI.setMOSI(MOSI_PIN);
  // SPI.setMISO(MISO_PIN);
  // SPI.setSCK(SCK_PIN);

  //  pinMode(ESP32_RESETN, OUTPUT);
  //  digitalWrite(ESP32_RESETN, HIGH);
  delay(1000);


  // Set up the pins!
  WiFi.setPins(SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);

  // check for the WiFi module:
  while (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    if (Serial2.available()) {
    //  Serial.println("available");
      byte read = Serial2.read();
      Serial.print(read);
    }
    delay(1000);
  }
  String fv = WiFi.firmwareVersion();
  Serial.println(fv);
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
    while (1) delay(10);
  }
  Serial.println("Firmware OK");

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC: ");
  printMacAddress(mac);
}

void loop() {
  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
  delay(10000);
}

void listNetworks() {
  // scan for nearby networks:
  Serial.println("** Scan Networks **");
  int numSsid = WiFi.scanNetworks();
  if (numSsid == -1) {
    Serial.println("Couldn't get a wifi connection");
    while (true);
  }

  // print the list of networks seen:
  Serial.print("number of available networks:");
  Serial.println(numSsid);

  // print the network number and name for each network found:
  for (int thisNet = 0; thisNet < numSsid; thisNet++) {
    Serial.print(thisNet);
    Serial.print(") ");
    Serial.print(WiFi.SSID(thisNet));
    Serial.print("\tSignal: ");
    Serial.print(WiFi.RSSI(thisNet));
    Serial.print(" dBm");
    Serial.print("\tEncryption: ");
    printEncryptionType(WiFi.encryptionType(thisNet));
  }
}

void printEncryptionType(int thisType) {
  // read the encryption type and print out the name:
  switch (thisType) {
    case ENC_TYPE_WEP:
      Serial.println("WEP");
      break;
    case ENC_TYPE_TKIP:
      Serial.println("WPA");
      break;
    case ENC_TYPE_CCMP:
      Serial.println("WPA2");
      break;
    case ENC_TYPE_NONE:
      Serial.println("None");
      break;
    case ENC_TYPE_AUTO:
      Serial.println("Auto");
      break;
    case ENC_TYPE_UNKNOWN:
    default:
      Serial.println("Unknown");
      break;
  }
}


void printMacAddress(byte mac[]) {
  for (int i = 5; i >= 0; i--) {
    if (mac[i] < 16) {
      Serial.print("0");
    }
    Serial.print(mac[i], HEX);
    if (i > 0) {
      Serial.print(":");
    }
  }
  Serial.println();
}
 
Last edited:
Back
Top