Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Help - ESP32 and Teensy 4.0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Help - ESP32 and Teensy 4.0

by andybelov on Mon Jan 27, 2020 11:27 pm

Got this: http://learn.adafruit.com/adafruit-airl ... g/overview
Giving up after a few hours.
Getting "Communication with WiFi module failed!" in C:\Users\Homer\Documents\Arduino\libraries\WiFiNIN A-master\examples\ScanNetworks\ScanNetworks.ino
Had to modify this: C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\Pr intable.h
It needs this: #include <stdlib.h>

My connection:
VUSB -- USB power
3.3v -- Normal 3.3v power
Ground -- Ground pin
Pin 5 -- AirLift CS pin
Pin 6 -- AirLift Reset pin
Pin 9 -- AirLift busy pin
Pin 10 -- AirLift GPIO 0 pin (used to put the ESP32 into bootloading mode if you soldered the jumper)
Pin 11 -- SPI MOSI
Pin 12 -- SPI MISO
Pin 13 -- SPI SCLK

These are not connected. As I understand, they are needed for firmware upload only:
Pin 0 (RX1) -- AirLift firmware upload (must join a solder jumper to use)
Pin 1 (TX1) -- AirLift firmware upload (must join a solder jumper to use)

Have the "3.3" jumper on the top soldered.
If anybody has it working, please share your wiring and the rest.

andybelov
 
Posts: 5
Joined: Tue Sep 02, 2014 2:43 pm

Re: Help - ESP32 and Teensy 4.0

by adafruit_support_mike on Wed Jan 29, 2020 2:15 am

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: Help - ESP32 and Teensy 4.0

by andybelov on Wed Jan 29, 2020 7:55 pm

Thanks for helping.
Here is the wiring and the sketch.

20200129_183106.jpg
20200129_183106.jpg (226.42 KiB) Viewed 117 times


Code: Select all | TOGGLE FULL SIZE
/*

 This example  prints the board's MAC address, and
 scans for available Wifi networks using the NINA module.
 Every ten seconds, it scans again. It doesn't actually
 connect to any network, so no encryption scheme is specified.

 Circuit:
 * Board with NINA firmware on it (In this case its an Adafruit AirLift)

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 21 Junn 2012
 by Tom Igoe and Jaymes Dec
 */


#include <SPI.h>
#include <WiFiNINA.h>

 // Configure the pins used for the ESP32 connection
#if defined(ADAFRUIT_FEATHER_M4_EXPRESS) || \
  defined(ADAFRUIT_FEATHER_M0_EXPRESS) || \
  defined(ARDUINO_AVR_FEATHER32U4) || \
  defined(ARDUINO_NRF52840_FEATHER) || \
  defined(ADAFRUIT_ITSYBITSY_M0_EXPRESS) || \
  defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) || \
  defined(ARDUINO_AVR_ITSYBITSY32U4_3V)
  #define SPIWIFI       SPI  // The SPI port
  #define SPIWIFI_SS    13   // Chip select pin
  #define ESP32_RESETN  12   // Reset pin
  #define SPIWIFI_ACK   11   // a.k.a BUSY or READY pin
  #define ESP32_GPIO0   10

#elif defined(ARDUINO_AVR_FEATHER328P)
  #define SPIWIFI       SPI  // The SPI port
  #define SPIWIFI_SS     4   // Chip select pin
  #define ESP32_RESETN   3   // Reset pin
  #define SPIWIFI_ACK    2   // a.k.a BUSY or READY pin
  #define ESP32_GPIO0   -1

#elif defined(ARDUINO_NRF52832_FEATHER)
  #define SPIWIFI       SPI  // The SPI port
  #define SPIWIFI_SS    16  // Chip select pin
  #define ESP32_RESETN  15  // Reset pin
  #define SPIWIFI_ACK    7  // a.k.a BUSY or READY pin
  #define ESP32_GPIO0   -1

#elif defined(TEENSYDUINO)
  #define SPIWIFI       SPI  // The SPI port
  #define SPIWIFI_SS     5   // Chip select pin
  #define ESP32_RESETN   6   // Reset pin
  #define SPIWIFI_ACK    9   // a.k.a BUSY or READY pin
  #define ESP32_GPIO0   -1
#endif

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("WiFi Scanning test");

  // 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
    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();
}

andybelov
 
Posts: 5
Joined: Tue Sep 02, 2014 2:43 pm

Re: Help - ESP32 and Teensy 4.0

by andybelov on Mon Feb 24, 2020 11:48 pm

Nobody?

andybelov
 
Posts: 5
Joined: Tue Sep 02, 2014 2:43 pm

Re: Help - ESP32 and Teensy 4.0

by adafruit_support_mike on Tue Feb 25, 2020 3:36 am

Sorry for the delay getting back to you.

Checking the connections, it looks like you're doing something unusual with power to the ESP32. I see what looks like a jumper from the AirLift's EN pin to a GND pin on the Teensy, which will shut down the AirLift's 3.3V regulator. Normally that would disable the board, but I also see jumpers from the AirLift's USB pin to a 5V pin on the Teensy, and between the Teensy's 3.3V pin and the AirLift's 3.3V pin.

I can't find an output current spec for the Teensy's 3V pin, but the AirLift is a fairly power hungry board. My guess is that the ESP32 is browning out.

Try getting rid of the EN and 3.3V jumpers, and just let the AirLift power itself from its USB pin.

adafruit_support_mike
 
Posts: 61443
Joined: Thu Feb 11, 2010 2:51 pm

Re: Help - ESP32 and Teensy 4.0

by andybelov on Tue Feb 25, 2020 1:31 pm

That was very helpful, Mike.
Thank you.

I was poking in the dark with the power.

andybelov
 
Posts: 5
Joined: Tue Sep 02, 2014 2:43 pm

Please be positive and constructive with your questions and comments.