Pico with WiFi shim problems

Posted on
  • Hi, I got one of the original Picos with wifi shim and have updated the firmware on the Pico to 2v01 using TI CC3000 Wi-Fi networking (I did try with the other one as well just to make sure). I checked the ESP firmware on the board and that is as follows "AT version:0.25.0.0(Jun 12 2015 20:26:28)\r\nSDK version:1.1.2\r\ncompile time:Jun 17 2015 22:11:51\r\n\r\nOK\r\n" I think it's the most stable version?

    When I do a simple GET request, it times out and throws an error, which varies from code -6, not found to code -15, no response

    I can access the endpoints through the browser/curl so I think that's ok. Am I missing something obvious? It's been a while since I did anything with my Pico and wifi so may have missed an update somewhere.

  • Well, it all sounds reasonably positive - you've obviously got two-way comms with the ESP8266 so we can pretty much rule hardware out.

    Please could you post your code up and I'll take a look? All I can think is maybe even if you're connected to a WiFi access point the DHCP may not have worked for some reason so there's no way to actually connect to the net.

    You could also try doing the GET with a simple IP address and see if that helps?

  • Yes I think it's something stupid I'm doing. It connects to the WiFi but just won't get anything.

    I tried substituting the URL for 172.217.169.14 which I think is the ip for google.com but got the same result.

    Thanks,

    Here's my code:

    digitalWrite(B9,1); // enable on Pico Shim V2
    Serial2.setup(115200, { rx: A3, tx : A2 });
    
    const http = require("http");
    
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      if (err) throw err;
      console.log("Connecting to WiFi");
      wifi.connect(WIFI_NAME, WIFI_PASS, function(err) {
    
        if (err) throw err;
        console.log("Connected");
    
        fetchData();
    
      });
    });
    
    function fetchData() {
      console.log('Fetching data');
      http.get("http://gomako.co.uk/hello.txt"­, function(res) {
      var contents = "";
        res.on("data", function(data) { contents += data; });
        res.on("close", function() { console.log(contents); });
      }).on("error", function(e) {
        console.log("ERROR", e);
      });
    }
    
  • I just tried it here and it works fine for me on a 2v01 Pico:

    Connecting to WiFi
    Connected
    Fetching data
    Hello
    >wifi.getIP(print)
    =undefined
    null 192.168.1.74
    >wifi.getVersion(print)
    =undefined
    null AT version:0.25.0.0(Jun 12 2015 20:26:28)
    > 
    

    So it may well be something to do with your WiFi setup. What does wifi.getIP(print) return for you?

  • Thanks, I had a sinking feeling it's something to do with my Wifi.

    I had a look on my router and it's seeing the Espruino and assigning it an IP address.

    Output is:

    ["AT+CIFSR\r\n"
    =undefined
    ] "+CIFSR:STAIP,\"192"
    ] ".168.1.5\"\r\n+CIFSR:STAMAC,\"18:fe:34:­9d:5"
    ] "2:14\"\r\n\r\nOK\r\n"
    null 192.168.1.5
    
  • Ugh, guess what? Turning my router on and off seems to have fixed the issue.

    What I'm trying to do is to get an URL a few times a day. If my Wifi needs to be reset along the way, will I need to tell the Pico to reset its connection too? So if I try and fail to get a response, will I need to reset the connection is what I mean.

  • I'm not 100% sure on that, the ESP8266 itself may auto-reconnect if the AP goes down - however there is a disconnected event on wifi that you can hook onto in order to manually trigger a reconnect I believe.

  • Ok thanks

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Pico with WiFi shim problems

Posted by Avatar for Bennr @Bennr

Actions