What about new version of module ESP8266WiFi

Posted on
Page
of 2
/ 2
Next
  • Dear Gordon,

    I have 3 pcs Pico from you and lots of esp8266-01. Both things are very exciting toys.
    I have tried to connect them together to create even better toy. I have some experience with ESP but I am total newbie in JS. I went through and through the forum, did all right steps but my efforts to have reliable appliance were less successful. The reason for it is my weak practice in JS (I will improve myself :-) ) but stronger reason is too old AT firmware in the ESP8266 module. You surely know that actual state of firmware from Espressif Systems is incomparably better than half year ago (hundreds of errors removed)... and I have to say that also the level of documentation went the same direction. There is some complication with new AT firmware from Espressif, they have leaped over the border of 512KB flash which are soldered in modules ESP-01. BUT on the other side there is very capable community around ESP8266 chip in Russia where I have found the solution. They have compiled the special AT firmware which fits in the 512KB flash and is most actual. Also, they have written the best tool in Java for work with ESP8266 modules as I know. It is very good tool for testing connected chip, sent AT commands and check their responses but not only for that... I used Esplorer parallel (two HW modules with the same firmware) with Espruino IDE during my efforts to modify your original module "ESP8266WiFi" (see picture). Warning: there are small differences between real AT responses and responses according Espressif documentation.

    Here are the right links ...
    ...firmware 512KB for ESP8266-01... version ATv0.25 from 12.06.2015
    http://esp8266.ru/download/sdk/AT25-SDK112-512k.bin
    ... AT instruction set EN... version ATv0.25 from 12.06.2015
    http://esp8266.ru/download/esp8266-doc/4A-ESP8266__AT%20Instruction%20Set__EN_v0.25.pdf
    ... Esplorer
    http://esp8266.ru/esplorer-latest/?f=ESPlorer.zip

    Gordon, I have tried to adapt your module "ESP8266Wifi" for above mentioned AT firmware but as I have written, my actual ability to do it in JS is very low. All above mentioned facts brought me to the idea that you or somebody else with corresponding capability could write new version of "ESP8266WiFi" module.

    Please, do you think it would be possible for you to find some time to do this job?

    PS: I'm sorry for my English, I'm not a native speaker.


    1 Attachment

    • twins_esp8266.jpg
  • Where is the documentation of the different AT command set?
    Where is documentation of the differences?
    That is what I would need to help...

    BTW - I don't test code I write for others on forum, but I'll at least assess how bad it will be, and maybe take a stab at making the changes (depending on how hard it looks).

    It would have been nice if espressif had picked one command set and stuck to it. There seem to be many versions of the firmware, all mutually incompatible.

  • Thanks for your reaction. I should explain my notice "Warning" in my previous message...
    a/ I don't want to compare OLD and NEW documentation about AT commands from Espressif. It has no sense, they are different (the contents and the quality). The provided documentation and firmware (my links) are the best in this moment, evolutionary on the highest possible level... good condition for new development of ESP8266WiFi module.
    b/ The actual module ESP8266WiFi uses only few AT commands from the whole set. The first step in the new evolution could be to go through existing library and adjust its functions to new ESP8266-01 firmware. It has sense because of higher quality of new firmware. The second step should be to top up the library with new functions (e.g. set/reset DHCP, set static IP and so on) to create complete set of net_functions.
    c/ My warning is necessary to understand this way... The firmware behaves according to the documentation but is always better to view behavior of the real system to be able to debug developed SW. I send as an EXAMPLE picture (pic_02.png). You can see different behavior of command "AT+CIFSR" (Get local IP address) dependent on command "AT+CWMODE=1/2/3. I have low level of knowledge of JS or lower fantasy but it is not clear for me how called function "wifi.getIP" could be processed from actual ESP8266WiFi module.
    d/ Espruino Pico is fantastic piece of HW and SW. ESP8266-01 is easily reachable and cheap module with WiFi, hundreds, thousands... maybe hundreds thousands sold pieces, some among people having Espruino Pico. There is nice "shim" connecting both worlds. The new firmware is the best version which still fits into 512KB. All together is good basis to make Espruino "nice network appliance" :-).
    e/ I am not able to do this task now but I put "the things on the table" as inspiration for others... as it is usual in open community. If somebody takes it and create something meaningful... lots of people will use and like it.


    1 Attachment

    • pic_02.png
  • Hi,

    Thanks - yes, I'd like to support the new firmware. Personally I think that unless they have changed something drastic, it should be possible to support both versions of the firmware from the same ESP8266 module - automatically (It could query the version at startup).

    The problem for me at the moment is that there's no way to update the firmware of the module once it is attached to the Pico. Personally I see fixing that as a priority...

  • Hi,
    I've three espruino boards, 1 pico and 2 original.
    I was looking this wifi module:
    http://www.banggood.com/es/ESP8266-ESP-12-Remote-Serial-Port-WIFI-Transceiver-Wireless-Module-p-964287.html
    Anyone know if it would work with espruino? Needs module ESP82266 rewrite?

  • Hi,

    thanks for your answer and willingness to solve the problem.
    I guess it isn't problem to flash new firmware. I don't have your shim but luckily RST and GPIO0 aren't connected as I see on web pages.

    We need only:
    a/ two wires, both connected to GND on one side and the other sides stay free... we will "poke at" the RST and GPIO0 pins on ESP8266 module later,
    b/ program to flash new firmware
    ... https://github.com/themadinventor/esptool ,
    c/ USB-UART module (3V3 levels), connected to PC as /dev/ttyUSB0 and to USART1 on Pico,
    d/ Pico, connected to PC as /dev/ttyACM0, running Espruino WEB IDE,
    e/ ESP8266 is connected to USART2 on Pico,
    f/ this short programm in Espruino Pico

    var baud=115200;
    
    Serial1.setup(baud, { rx: B7, tx : B6 });
    Serial2.setup(baud, { rx: A3, tx : A2 });
    
    console.log("Start flash ->");
    
    Serial1.on('data',function(d) {Serial2.write(d);});
    Serial2.on('data',function(d) {Serial1.write(d);});
    
    

    g/one wire mentioned in point a/ we hold on pin GPI0 and with second wire we tap RST pin ... ESP82666 is switched into programming mode (the wires can stay unconnected),
    h/ we start program in Pico,
    i/ we start esptool with this commnad... or some minimal modification

    ./esptool.py -p /dev/ttyUSB0 -b 115200 write_flash 0x00000 AT25-SDK112-512k.bin

    j/ we will see messages of esptool

    Connecting...
    Erasing flash...
    Writing at "address" 0x..... (..%)

    Leaving...

    k/ it is done... new firmware in ESP8266-01.

    Tested and verified.

  • AH! I see why I thought your other post didn't have any useful information... the second link doesn't lead anywhere - but for some reason the macrocosm shortened link just went straight to esp8266.ru, so I didn't realize there was a problem with the link.

    Can you post a working link to the docs on AT instruction set?

    esp8266.ru/download/esp8266-doc/4­A-ESP8266AT%20Instruction%20SetEN_v0­.25.pdf

  • Sorry, here is it.
    Good night :-)

  • Once more... some error on the server???


    1 Attachment

  • Have you noticed that I sent you the file with AT commands?


    1 Attachment

  • Yes, I saw that. That looks like docs for the normal AT command set though - it's got the Espressif logo and all on it? I have not had more than a few minutes to look at it though. What about docs for the firmware you're using?

    I am very busy lately - I do not have time to play detective and sort out the differences, if you give me clear information about exactly what the differences are, I can help - otherwise, I just don't have time.

  • Nice - that documentation is a whole step up from what used to exist!

    When I get some time free I'll try and flash a new version of the ESP8266 firmware and will try and get something working. Hopefully it won't be too bad. It looks like EspressIf may have dropped the dodgy Linked message - it would explain why things aren't working well at the moment, but when sorted it should allow multiple connections properly!

  • Hi - just to let you know I've now created a new driver that should work with the newer 0.25 firmware. Details on the ESP8266 page

  • Any chance someone writes a flash program that runs on the espruino pico directly? (as a USB Serial to ESP8266, I mean). My ESP-01's are on the shims, and desoldering is not really the best option.

  • Yeah, hopefully someone will - bit busy this week so it's unlikely to be me.

    I'll be trying to push the new USB code this week, so hopefully that'll make USB reliable enough that the Pico can just be put in a 'USB-TTL' forwarding mode.

  • Hi - many thanks for your time and good result!
    I have been on holiday now but luckily I have Pico+ESP8266 on the breadboard with :-).
    I have made some tests "in the battle field" and all have been OK. I have also modified one of your programms and it has been running more than 24 hours without any failure... More tinkering at home again...

    var WLAN_NAME   = "MySSID";
    var WLAN_KEY    = "MyPSW";
    var WEATHER_URL = "http://open.live.bbc.co.uk/weather/feeds/en/2643743/observations.rss"; 
    
    var wifi;
    
    // This gets the weather out of the XML and writes it to the LCD ... console.log ...
    function parseWeather(xml, date) {
      // No XML parser, so we have to be nasty
      var item = xml.indexOf("<item>");
      var descStart = xml.indexOf("<description>", item);
      var descEnd= xml.indexOf("</description>", descStart);
      var desc = xml.substring(descStart+13,descEnd);
      var titleStart=xml.indexOf("<title>");
      var titleEnd=xml.indexOf("</title>");
      var title=xml.slice(titleStart+7,titleEnd);
      var pubDateStart=xml.indexOf("<pubDate>");
      var pubDateEnd=xml.indexOf("</pubDate>");
      var pubDate=xml.slice(pubDateStart+9,pubDateEnd);
      // replace the degrees symbol with a quote - built in font only does first 128 chars
      desc = desc.replace("°","'").replace("°","'").replace("mb,","mb");
      // make sure things fit on the tiny screen!
      desc = desc.replace("Wind Direction","Wind").replace("Temperature:","Temp:");
      console.log("--- "+title);
      // draw one item per line
      var weather = desc.split(", ");
        weather.forEach(function(s) {console.log(s);});
      // Finally print the time from the HTTP request (so we know it's up to date!)
      // var d = new Date(date);
      // var timeStr = d.getHours()+":"+("0"+d.getMinutes()).substr(-2);
      console.log("PubDate: "+pubDate);
      console.log("---");
    }
    
    // Actually get weather off the net and display it
    function getWeather() {
      // do an HTTP request
      require("http").get(WEATHER_URL, function(res) {
        // console.log("Response: ",res);
        // read the whole response into a variable
        // note: this works here but isn't a great idea - big responses can
        // easily use up all the available memory
        var xml = "";
        res.on('data', function(d) { xml += d; });
        // when the connection closes, parse the weather and write to the LCD
        res.on('close', function(d) { parseWeather(xml, res.headers.Date); });
      });
    }
    
    // When we start up...
    function onInit() {
      // if we save()d to flash after we'd already run onInit() we need to clear existing intervals
      clearInterval();
      // Set up the ESP8266
      Serial2.setup(115200, { rx: A3, tx : A2 });
      console.log("Init ESP8266...");
      wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) {
        if (err) throw err;
        wifi.reset(function(err) {
          if (err) throw err;
          console.log("Connecting to WiFi");
          wifi.connect(WLAN_NAME, WLAN_KEY, function(err) {
            if (err) throw err;
            console.log("Connected");
            // Now start getting weather...
            setInterval(getWeather, 60000); // every 60s
            getWeather(); // do the first one right away
          });
        });
      });
      console.log("Please wait...");
    }
    
    onInit();
    
    
  • user56017 = profra
    ... I don't know why I have two accounts... and how to correct it...

  • Hi - If you have some wires and USB-UART convertor (3V3) see my contribution #6... you can flash new firmware in a while.... even though ESP8266-01 is soldered on the shim.

  • OK, at first I was a bit lost. I thought you meant flashing through the USB port of the pico, but in fact you are using 3 serial ports: One to the ESP-01 (on the first UART on pico), one to the PC with an extra USB to serial on the second UART, and one to the pc through the pico USB to serial. I'll try this tomorrow.

  • Just a quick note - if you're not running anything on the Pico then A2/A3 will be totally open circuit. You could plug USB-TTL directly to the ESP8266 and program it that way.

    I just checked, and on the latest Espruino Images (the USB HID ones - I haven't checked others), you can actually do the following:

    • Connect to Espruino
    • Copy and paste this code into the left-hand side:

      Serial2.setup(9600, { rx: A3, tx : A2 });
      Serial2.on('data', function(d) { USB.write(d); });
      USB.on('data', function(d) { Serial2.write(d); });
      Serial1.setConsole();
      
    • Disconnect from Espruino

    • Now take 2 wires and connect one side of them to GND. Then connect to GPIO0, while connecting and releasing to RST as well (see here for where the pins are).

    • finally, run this command using esptool and your firmware image: ./esptool.py -p /dev/ttyACM0 -b 9600 write_flash 0x00000 ../esptool_bin/AT25-SDK112-512k.bin

    It's slooow at 9600 baud, but I haven't tried anything else yet. It does work though.

  • Just to add, this won't work on the newest 1v79 firmware. You'll need to use a Git build, like this one

    And only use it if you've got a USB-TTL converter as well - in case it all goes wrong!

  • Lol, the 1.79 build was what I was using. It stops randomly flashing the ESP01. Trying with the Git build now.

  • OK, used the 1.79.210. Had to change some values in the ESPtool.py (if not, it led to an Invalid header somewhere in the flash process.) I also adjusted the baudrate.

    These are the values that worked:
    Baud set to 19200
    In ESPTool.py, make the following changes:

    # Maximum block size for RAM and Flash writes, respectively.
    ESP_RAM_BLOCK   = 0xc0
    ESP_FLASH_BLOCK = 0x20
    

    Higher values on any of the two variables, led to errors in the flashing.

  • Great! Thanks for the note about esptool.py - that's really good to know... Looks like it could be a good solution for flash upgrades then.

    I bet it's actually an issue with the buffer sizes - while USB should now be able to throttle, because the buffers are shared I wonder if you can get into a situation where the USB RX buffer gets full, and that then drops Serial RX data (which can't be throttled).

    I wonder if there's some simple way to reproduce it with just the Espruino so I can see if I can tweak the firmware.

  • I actually had two types of problems:

    one was where the ESPTool would report an "Invalid header". The solution of adjusting the ESP_XXX_Blocks I found on the net, although I can't seem to be able to find the link anymore

    The second one was where the ESPTool would just stop, probably waiting for eternity for the serial to come back.

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

What about new version of module ESP8266WiFi

Posted by Avatar for profra @profra

Actions