Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Teensy 4.0 and WiFi with WINC1500 breakout board

  1. #1
    Junior Member
    Join Date
    Nov 2021
    Location
    Italy
    Posts
    4

    Teensy 4.0 and WiFi with WINC1500 breakout board

    Hy guys,

    I'm trying to use the WINC1500 breakout board to make my Teensy 4.0 connect to the wifi network without success.

    My Arduino IDE version is: 1.8.13
    My WiFi library version is: 1.2.7
    My WiFi101 library version is: 0.16.1

    I was able to update the WINC1500 firmware (to the 19.6.1 version) succesfully using the Teensy, following these instructions.

    I have tried to use the board with an Arduino UNO using the following connections:

    Click image for larger version. 

Name:	Arduino_UNO_WINC.jpg 
Views:	15 
Size:	223.9 KB 
ID:	26475
    Click image for larger version. 

Name:	Arduino_WINC_connections_2.jpg 
Views:	14 
Size:	34.5 KB 
ID:	26476

    I've placed the line WiFi.setPins(8,7,4); at the beginning of the setup and I went through all the first examples (CheckWiFi101FirmwareVersion, ScanNetworks, ConnectWithWPA) with satisfactory results: even the green LED marked "wifi" on the WINC breakout board lights up at the end of execution of example ConnectWithWPA to indicate a successful connection.

    I went through the same steps using Teensy and the results were not as satisfactory (partially satisfactory would be better to say).

    I've used the same connections I've made for the Arduino

    Click image for larger version. 

Name:	Teensy4_WINC_connections_2.jpg 
Views:	15 
Size:	34.0 KB 
ID:	26473
    Click image for larger version. 

Name:	Teensy_WINC.jpg 
Views:	18 
Size:	245.7 KB 
ID:	26474

    Even if with this setup I'm able to correctly check the firmware version:
    Code:
    WiFi101 firmware check.
    
    WiFi101 shield: DETECTED
    Firmware version installed: 19.6.1
    Latest firmware version available : 19.6.1
    
    Check result: PASSED
    I don't see any available WiFi network:
    Code:
    10:30:44.094 -> MAC: F8:F0:05:95:96:C6
    10:30:44.094 -> Scanning available networks...
    10:30:44.094 -> ** Scan Networks **
    10:30:49.083 -> number of available networks:0
    10:30:59.083 -> Scanning available networks...
    10:30:59.083 -> ** Scan Networks **
    10:30:59.083 -> number of available networks:0
    While, using the Arduino UNO, I saw, at least, 7 different WiFi networks.
    Then, when I tried connecting to one of them I knew it is up and working, The Teensy get stuck in a loop:
    Code:
    10:32:42.323 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:33:52.329 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:02.849 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:13.379 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:23.944 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:34.473 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:44.997 -> Attempting to connect to WPA SSID: My_WiFi_network
    10:34:55.549 -> Attempting to connect to WPA SSID: My_WiFi_network
    • Why it is (not) working this way?
    • Is there something I'm doing wrong? maybe some forbidden Teensy Pin I should substitute with another one?
    • Maybe is it a question of current draw (which is not the case IMHO)?


    Ps:
    I've also read some other similar posts but I wasn't able to get any useful information (link, link, link, link and link)

    PPS: thanks @BriComp, my code is almost the same as the code of the WiFi examples as I have explained.
    here we are with the first example CheckWiFi101FirmwareVersion:

    Code:
    /*
     * This example check if the firmware loaded on the WiFi101
     * shield is updated.
     *
     * Circuit:
     * - WiFi101 Shield attached
     *
     * Created 29 July 2015 by Cristian Maglie
     * This code is in the public domain.
     */
    #include <SPI.h>
    #include <WiFi101.h>
    #include <driver/source/nmasic.h>
    
    void setup() {
      // ref: https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-the-wifi-module
      //Configure pins for Adafruit ATWINC1500 Feather
      // WiFi.setPins(chipSelect, irq, reset, enable-facoltativo)
      WiFi.setPins(8,7,4);
    
      
      // Initialize serial
      Serial.begin(9600);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
      }
      
      
      // Print a welcome message
      Serial.println("WiFi101 firmware check.");
      Serial.println();
    
      // Check for the presence of the shield
      Serial.print("WiFi101 shield: ");
      if (WiFi.status() == WL_NO_SHIELD) {
        Serial.println("NOT PRESENT");
        return; // don't continue
      }
      Serial.println("DETECTED");
    
      // Print firmware version on the shield
      String fv = WiFi.firmwareVersion();
      String latestFv;
      Serial.print("Firmware version installed: ");
      Serial.println(fv);
    
      if (REV(GET_CHIPID()) >= REV_3A0) {
        // model B
        latestFv = WIFI_FIRMWARE_LATEST_MODEL_B;
      } else {
        // model A
        latestFv = WIFI_FIRMWARE_LATEST_MODEL_A;
      }
    
      // Print required firmware version
      Serial.print("Latest firmware version available : ");
      Serial.println(latestFv);
    
      // Check if the latest version is installed
      Serial.println();
      if (fv >= latestFv) {
        Serial.println("Check result: PASSED");
      } else {
        Serial.println("Check result: NOT PASSED");
        Serial.println(" - The firmware version on the shield do not match the");
        Serial.println("   version required by the library, you may experience");
        Serial.println("   issues or failures.");
      }
      
    }
    
    void loop() {
      // do nothing
    }
    here's the second example ScanNetworks:

    Code:
    /*
     This example  prints the WiFi shield's MAC address, and
     scans for available WiFi networks using the WiFi shield.
     Every ten seconds, it scans again. It doesn't actually
     connect to any network, so no encryption scheme is specified.
    
     Circuit:
     * WiFi shield attached
    
     created 13 July 2010
     by dlf (Metodo2 srl)
     modified 21 Junn 2012
     by Tom Igoe and Jaymes Dec
     */
    
    
    #include <SPI.h>
    #include <WiFi101.h>
    
    void setup() {
      //Initialize serial and wait for port to open:
      // ref: https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-the-wifi-module
      //Configure pins for Adafruit ATWINC1500 Feather
      // WiFi.setPins(chipSelect, irq, reset, enable)
      WiFi.setPins(8,7,4);
      
      Serial.begin(115200);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
      }
    
      // check for the presence of the shield:
      if (WiFi.status() == WL_NO_SHIELD) {
        Serial.println("WiFi shield not present");
        // don't continue:
        while (true);
      }
    
      // Print WiFi MAC address:
      printMacAddress();
    
      // scan for existing networks:
      Serial.println("Scanning available networks...");
      listNetworks();
    }
    
    void loop() {
      delay(10000);
      // scan for existing networks:
      Serial.println("Scanning available networks...");
      listNetworks();
    }
    
    void printMacAddress() {
      // the MAC address of your WiFi shield
      byte mac[6];
    
      // print your MAC address:
      WiFi.macAddress(mac);
      Serial.print("MAC: ");
      printMacAddress(mac);
    }
    
    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));
        Serial.flush();
      }
    }
    
    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;
      }
    }
    
    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();
    }
    here's the third ConnectWithWPA:

    Code:
    /*
    
     This example connects to an unencrypted WiFi network.
     Then it prints the  MAC address of the WiFi shield,
     the IP address obtained, and other network details.
    
     Circuit:
     * WiFi shield attached
    
     created 13 July 2010
     by dlf (Metodo2 srl)
     modified 31 May 2012
     by Tom Igoe
     */
    #include <SPI.h>
    #include <WiFi101.h>
    
    #include "arduino_secrets.h" 
    ///////please enter your sensitive data in the Secret tab/arduino_secrets.h
    char ssid[] = SECRET_SSID;        // your network SSID (name)
    char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
    int status = WL_IDLE_STATUS;     // the WiFi radio's status
    
    void setup() {
        //Initialize serial and wait for port to open:
      // ref: https://learn.adafruit.com/adafruit-feather-m0-wifi-atwinc1500/using-the-wifi-module
      //Configure pins for Adafruit ATWINC1500 Feather
      // WiFi.setPins(chipSelect, irq, reset, enable)
      WiFi.setPins(8,7,4);
    
      
      //Initialize serial and wait for port to open:
      Serial.begin(115200);
      while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
      }
      Serial.println("Serial opened!");
    
      Serial.print( "wifi status: " );
      Serial.println( WiFi.status() );
    
      
      // check for the presence of the shield:
      if (WiFi.status() == WL_NO_SHIELD) {
        Serial.println("WiFi shield not present");
        // don't continue:
        while( true );
      }
      Serial.println("WiFiShield presence test: passed!");
      delay(5000);
    
      // attempt to connect to WiFi network:
      while ( status != WL_CONNECTED) {
        Serial.print("Attempting to connect to WPA SSID: ");
        Serial.println(ssid);
        // Connect to WPA/WPA2 network:
        status = WiFi.begin(ssid, pass);
        
        // wait 10 seconds for connection:
        delay(10000);
      }
    
      // you're connected now, so print out the data:
      Serial.print("You're connected to the network");
      printCurrentNet();
      printWiFiData();
    
    }
    
    void loop() {
      // check the network connection once every 10 seconds:
      delay(10000);
      printCurrentNet();
    }
    
    void printWiFiData() {
      // print your WiFi shield's IP address:
      IPAddress ip = WiFi.localIP();
      Serial.print("IP Address: ");
      Serial.println(ip);
      Serial.println(ip);
    
      // print your MAC address:
      byte mac[6];
      WiFi.macAddress(mac);
      Serial.print("MAC address: ");
      printMacAddress(mac);
    
    }
    
    void printCurrentNet() {
      // print the SSID of the network you're attached to:
      Serial.print("SSID: ");
      Serial.println(WiFi.SSID());
    
      // print the MAC address of the router you're attached to:
      byte bssid[6];
      WiFi.BSSID(bssid);
      Serial.print("BSSID: ");
      printMacAddress(bssid);
    
      // print the received signal strength:
      long rssi = WiFi.RSSI();
      Serial.print("signal strength (RSSI):");
      Serial.println(rssi);
    
      // print the encryption type:
      byte encryption = WiFi.encryptionType();
      Serial.print("Encryption Type:");
      Serial.println(encryption, HEX);
      Serial.println();
    }
    
    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 by moscardo; 11-10-2021 at 02:44 PM. Reason: added complete source code

  2. #2
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    497
    You are not likely to get much help if you don't show your code.
    Enclose it between code tags using the # button.

  3. #3
    Junior Member
    Join Date
    Nov 2021
    Location
    Italy
    Posts
    4
    Thank you @BriComp for your reply.
    Please find the full source code on the first post.
    Let me know

  4. #4
    Junior Member
    Join Date
    Dec 2018
    Location
    California
    Posts
    17
    This has been on my someday/maybe list for years so I am following with interest!

  5. #5
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    497
    That module needs up to 300mA when transmitting, the T4.0 is rated at 250mA, although I believe that is thermally limited.
    I suggest you supply the WINC1500 breakout board from the USB derived 5v. It has an onboard voltage regulator to take it down to the required 3.3v.

  6. #6
    Junior Member
    Join Date
    Mar 2021
    Posts
    17
    Quote Originally Posted by moscardo View Post
    Hy guys,

    I'm trying to use the WINC1500 breakout board to make my Teensy 4.0 connect to the wifi network without success.

    [/CODE]
    Hi,
    myself I didn't work with the WINC1500 on a Teensy 4.0 board but worked with Ethernet on the Teensy 4.1.
    I mostly used libraries adapted by khoih-prog for different boards and WiFi-modules like:
    https://github.com/khoih-prog/WiFiWebServer
    I think that the Teensy 4.0 and the WINC1500 should be covered by his libraries.
    Kind regards
    RoSchmi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •