Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 59 of 59

Thread: Adding WiFi to Teensy 3.x

  1. #51
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    Yes, that is correct, It hands on WiFi.scanNetworks() which is my first interaction at startup.

    I do not find this to be so unusual, as I use several Arduino/Teensy hardware based libraries that will hang if the corresponding hardware is not connected.

    Richard

  2. #52
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,136
    it is unusual and could be critical if your doing greenhouse or any other important tasks and the winc1500 decides to fail, leaving your controls in a complete lockup and can cause flooding or any other type of behaviour in critial projects.

    that and not everybody knows the winc1500 lockup issue, they would think the mcu is dead and debug trying to find the issue

  3. #53
    Junior Member
    Join Date
    Jul 2017
    Posts
    7
    Hi,

    I'm new to the whole Teensy world but had a few other devices I tried before, but as the Teensy 3.6 provides everything I need I want to get it running.
    Currently I'm in the same situation as some of you and want to get the Adafruit ATWINC1500 Breakout Board running.

    Reading through the previous posts, I connected it and got it "up and running", but once I try to send data via UDP nothing reaches the server.
    So I explain a little bit more in detail.

    Why do I assume it's "up and running":
    - I can read the firmware version (19.4.4)
    - I can connect to my Wifi
    - I get an IP address
    - My router says it's connected
    - WiFi LED is constantly green, Net LED is blinking when sending data (strangly the Teensy LED also blinks with the same frequency)

    How is it connected:
    Code:
    #include <SPI.h>
    #include <Adafruit_WINC1500.h>
    #include <Adafruit_WINC1500Udp.h>
    
    #define WINC_CS 10
    #define WINC_IRQ 9
    #define WINC_RST 8
    #define WINC_MOSI0 11
    #define WINC_MISO0 12
    #define WINC_SCK0 13
    #define WINC_EN 15
    
    SPI.setSCK(WINC_SCK0);
    SPI.setMOSI(WINC_MOSI0);
    SPI.setMISO(WINC_MISO0);
    SPI.setCS(WINC_CS);
    pinMode(WINC_CS, OUTPUT);
    digitalWrite(WINC_CS, HIGH);
    SPI.begin();
      
    #ifdef WINC_EN
      pinMode(WINC_EN, OUTPUT);
      digitalWrite(WINC_EN, HIGH);
    #endif
    How do I try to send data:
    Code:
    if (Udp.beginPacket(serverIp, port) == 1) {
        Udp.write("Foo");
        int result = Udp.endPacket();
        if(result != -1) {
          debugLog("Sent packet");   ///It's reaching this point, but no data are received on server side....
        }else {
          debugLog(String(result));
        }
    } else {
        debugLog("BeginPacket failed");
    }
    Why is it not a server-side problem?
    - Because I have a Feather M0 ATWINC1500 running the same code without any problems.
    - Because I have an iPhone App sending the same data to the same server without any problems.
    - Because Wireshark on the server does not log any data when trying to send from the Teensy (iPhone & Feather Wireshark logs data)

    What else did I try?
    - I tried replacing "SPI.begin()" with "SPI.beginTransaction(SPISettings(12000000, MSBFIRST, SPI_MODE0))" ==> Nothing works at all
    - I tried using the Wifi101 samples without any luck


    So...anyone any other ideas :-)

  4. #54
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    Are you instantiating?

    Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);

    After your Udp.write() I do not see a
    Udp.endPacket();

    Richard

  5. #55
    Junior Member
    Join Date
    Jul 2017
    Posts
    7
    Quote Originally Posted by RichardFerraro View Post
    Are you instantiating?

    Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);

    After your Udp.write() I do not see a
    Udp.endPacket();

    Richard
    Hi,

    don't know what you mean by instantiating? Do you have sample what you mean as "Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);" is basically calling the constructor as far as I understand.
    For the "missing" Udp.endPacket(), have a look at my code sample it's right the next line after Udp.write...

  6. #56
    Junior Member
    Join Date
    Jul 2017
    Posts
    7
    Ok, got a little further. I adapted the Adafruit library that it returns the error code from "sendto" in "endPacket".
    And now I'm getting -6 which means "An invalid argument is passed to a function." (SOCK_ERR_INVALID_ARG)

    http://asf.atmel.com/docs/latest/samd21/html/group___socket_error_code.html#ga3d22d700a5ecefd50 27c0f3c923ee095

  7. #57
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    perhaps the Winc1500 example WiFiUdpSendReceiveString.ino will help

  8. #58
    Junior Member
    Join Date
    Jul 2017
    Posts
    7
    Quote Originally Posted by nhebling View Post
    Ok, got a little further. I adapted the Adafruit library that it returns the error code from "sendto" in "endPacket".
    And now I'm getting -6 which means "An invalid argument is passed to a function." (SOCK_ERR_INVALID_ARG)

    http://asf.atmel.com/docs/latest/samd21/html/group___socket_error_code.html#ga3d22d700a5ecefd50 27c0f3c923ee095
    Ok, found my problem - my own stupid mistake :-)
    I forgot "Udp.begin", which led to the state that no socket was opened and this then caused that nothing could be sent.

  9. #59
    Junior Member
    Join Date
    Nov 2019
    Posts
    2
    Quote Originally Posted by fearless View Post
    Hello,
    I also attempted to hook up an Adafruit WINC1500 to Teensy 3.6 using the following pins:
    CS0= 10
    MOSI0 = 11
    MISO0 = 12
    SCK0 = 13
    IRQ = 34
    RST = 33
    Vin set to the 3.3 V on the Teensy board, with EN tied to Vin.
    I'm using SPI and WiFi 101 with the WiFi.setPins (10, 34, 33);
    I know WINC1500 board works as I have used it with the Arduino Mega with no issues.
    I have attempted to check firmware and run simple example sketches to no avail.
    Any help would be appreciated. Thanks.
    search the threads, Came across this as I'm thinking of doing the same, did you ever get this working ?

Posting Permissions

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