post-save off-USB ESP8266 comms

Posted on
  • So my wifi code is now solid when Pico and Adafruit Huzzah are running attached to the WebIDE.

    However I am unable to connect to the ESP8266 following save() and disconnect from USB.

    The two variables would seem to be power and possible changes to serial.

    I am avoiding print and console when not on IDE, having read of problems this can introduce. However I wonder if something unhelpful is going down the serial1 line? I don't have a TTL cable to be able to monitor it.

    I have an OLED display and was able to put in enough instrumentation to confirm that everything else is working fine as far as I can tell.

    Sometimes when I return to USB it just starts working again. This led me to think it this was power as the symptom (steady blue light on ESp8266) is similar to what I had when I wasn't giving it enough juice. But I've ruled that out by having esp8266 on its own separate power circuit.

    Powering off and on makes no odds, including whether I power off while connected to USB or afterwards.

    In init I am re-initialising the serial line and also the ESP8266.

    I've also tried pulsing the RST line on the ESP8266 to try to reset it before reconnecting - this seems to work as the lights flash, but no reconnection possible.

  • Have you connected the Huzzah to B6/B7?

    It's a common thing with Espruino - the 'console' moves from USB to Serial1 when USB is disconnected - which lets you connect a totally unprogrammed Pico to something like Bluetooth so you can program it.

    When it moves, it then stops you reading back data on Serial1. Easy solution is to just put the following right at the top of your code that runs on initialisation:

    function onInit() {
      USB.setConsole(); 
      // ...
    }
    

    It'll force the console on to USB (even if USB isn't connected)

  • Committed docs elsewhere on this, but in case anyone else stumbles on this, yes, this is the answer!

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

post-save off-USB ESP8266 comms

Posted by Avatar for Moray @Moray

Actions