Just flashed Espruino V2... questions/remarks

Posted on
  • I just found the latest version of Espruino (herehttps://www.espruino.com/binaries/esprui­no_2v00_esp32/) and flashed it to a ESP32 DoIt NodeMCU.

    When I connect the IDE I see a warning: setsockopt(SO_REUSPORT) failed. Is that expected?

    I try to connect it to my router and see that the following is not working:

    1. setHostname
    2. setConfig

    For both functions I see a "Uncaught error: function not found!" Is it correct that these are not yet supported? If so, is there any documentation on what is supported or not. I searched, but couldn't find it. Both functions don't seem to work on the previous version too!

    Thank you!

    Edit: found this page that says that setHostname is not supported yet.

  • When I connect the IDE I see a warning: setsockopt(SO_REUSPORT) failed. Is that expected?

    @opichals made changes to this area recently
    I have not personally tested the new build

    I try to connect it to my router and see that the following is not working:


    This has not been implement at this stage. It requires using the mDNS library - and there was a move to do this in JS as a library rather than coding specifically for the ESP32 using esp-idf.
    It could be added.


    I believe this is ESP8266 specific - I'm not sure other ports support it.

    When the ESP32 was release there was not power mode options - there might be now - I have not looked recently.

  • I think you maybe tried to link it - but just wanted to add that the reference at http://www.espruino.com/Reference usually tells you what is and isn't available on different boards. If it doesn't for a board then that's something I could fix if I know about it.

  • @Wilberforce Did it ever work for your change at https://github.com/espruino/Espruino/com­mit/5c9c7b5c561eda7408b2e5d8194f8127a6a5­d5f6#diff-1b4afc5c5771734770c516012233e6­9c on the ESP32 board itself?

    @CrashingDutchman IMO the warning should be harmless. However it looks like we should get rid of trying to set it on ESP32 as the https://github.com/espressif/arduino-esp­32/blob/master/tools/sdk/include/lwip/lw­ip/sockets.h#L185 states that it is unimplemented.

  • @opichals
    It seems the change you recently made force the PORT option to be used, and it wasn't in the past....
    So I have removed that in a bleeding edge build - that used the esp-idf 3.1 binary:


  • @Wilberforce Yes, I changed that to happen for the TCP servers. Thanks for removing it.

    Before it was present for dgram.createSocket({ reuseAddr: true }) where it should have filed the same way provided the 'unimplemented' note in the headers is correct.

  • Sorry for the late response, I was away for a couple of days. Thank you all for the replies, for the moment I am fine with your replies. The setHostname() has never worked for me anyway (with the ESP8266). I will ignore the warning!

  • @CrashingDutchman The setHostname() should work once this https://github.com/espruino/Espruino/iss­ues/1376 is done (considering it will probably eat quite a lot of RAM which is scarse on the ESP8266).

  • Okay, I understand. Thank you @opichals

  • Something else I notice is that the IDE doesn't find board information if the ESP32 has been connected for a while to my PC through the serial port.

    When connecting Espruino to the COM port, I see:
    Unable to retrieve board information. Connection error?
    Connected to COM7 (no response from board)

    Below is a log from the console, including the part where I disconnected and reconnected the ESP32 from/to the port:

    We have chrome.serial - not using 'serialport' module serial_audio:
    Audio Sample rate : 48000 serial_audio: Audio Serial Baud 9600 Bit
    time 5 GET chrome.storage.sync =
    Use code below to configure a new device. Steps:\n\n- edit theHostname
    below\n- flash code to device (nodemcu, esp8266)\n- type
    'startConnect' in console window \n\n*/\nvar
    wifi=require(\"Wifi\");\nvar theHostname=\"temp-sensor-server\";
    \n\nvar startConnect = function() {\n\tconsole.log('start connect
    {\n\t\tpassword: \"tarigan01\"\n\t}, \n\tfunction()
    {\n\n\t\tconsole.log('connected to wifi');\n\n\t\tvar ipInfo =
    wifi.getIP();\n\t\tprint(\"Current IP address is: \" +
    \n\t\t\tipInfo.ip + ':' +\n\t\t\tipInfo.netmask);\n\n\t\t//
    Wifi.stopAP();\n\t\t// wifi.setConfig({ powersave:
    Initialising SettingsConsole Initialising Utils Initialising Config
    Initialising Notifications Initialising Status Initialising App
    Initialising File Initialising Code Initialising Serial

    • Initialising Serial Chrome Serial
    • Initialising Serial Chrome Socket
    • Initialising Serial Web Audio
    • Initialising Serial Web Bluetooth Initialising Terminal Initialising CodeWriter Initialising Modules Initialising Env
      Initialising Flasher Initialising EditorBlockly Initialising
      EditorJavaScript Initialising Send Initialising MenuPortSelector
      Initialising MenuSettings Initialising MenuFlasher Initialising
      SettingsAbout Initialising SettingsFlasher Initialising BoardJSON
      Initialising VersionChecker Initialising Compiler Initialising
      Assembler Initialising GetGitHub Initialising Unicode Initialising
      Minify Initialising SaveOnSend Initialising SetTime Initialising
      Tutorial Initialising Webcam Initialising FontSize Initialising UiMode
      Initialising URLHandler Initialising CodeLink Initialising Project
      Initialising Testing Initialising Notification_Sound Initialising Tern
      Initialising Debugger Initialising Tour Initialising SettingsProfile
      Initialising HelpLinks Initialising Offline Loaded code from storage.
      GET chrome.storage.local.OFFLINE_DATA = 0 bytes No navigator.bluetooth
    • Web Bluetooth not enabled
      >>> Connecting... Set Slow Write = true [object Object] Connected [object Object] ERROR: RECEIVE ERROR:
      {"connectionId":1,"error":"overrun"} Disconnect callback... WARNING:
      [notify_warn] Disconnected
      >>> Disconnected Got "\r\n" No Prompt found, got "\n" - issuing Ctrl-C to try and break out Still no prompt - issuing another Ctrl-C WARNING:
      No result found for "process.env" - just got "" ERROR: [notify_error]
      Unable to retrieve board information. Connection Error? Device found
      [success] Connected to COM7 (No response from board)
      >>> Connected to COM7 (No response from board)
      >>> Connecting... Set Slow Write = true [object Object] Connected [object Object] Got "" No Prompt found, got undefined - issuing Ctrl-C
      to try and break out Splitting for Ctrl-C, delay 250 Still no prompt -
      issuing another Ctrl-C Splitting for Ctrl-C, delay 250
      >>> Sending...
      ---> "\u0010print(\"<\",\"<<\",JSON.stringify­(process.env),\">>\",\">\")\n"
      >>> Sent Got "\u001b[?7l\r\n ____ _ \r\n| |_ ___ ___ _ ||___ ___ \r\n| |_ -| . | _| | | | | . |\r\n||_| || |_|||_||\r\n || espruino.com\r\n 2v00 (c) 2018 G.Williams\r\n\r\nEspruino is Open Source. Our work is
      supported\r\nonly by sales of official boards and
      setsockopt(SO_REUSPORT) failed\r\n\r\n>< <<
      >> >\r\n>" [notify_info] Found ESP32, 2v00 Loading http://www.espruino.com/json/ESP32.json Board JSON loaded Set Slow
      Write = true FIRMWARE: Current 2v00, Available 2v00 Device found
      [success] Connected to COM7
      >>> Connected to COM7

  • How long is a while?

    It is possible that the USB port gets turned off for power saving after a period of inactivity.

  • I am not yet sure how long a while is. I connected the ESP32 probably on Thursday and left the IDE open, computer was powered on at all times. When I wanted to connect the IDE to the port yesterday (Tuesday) evening (around 8 pm) I got the messages.

    I disconnected and reconnected the device yesterday and was able to connect through the IDE. This morning I found that my computer had rebooted. I tried to connect again from the IDE and saw the same messages. It seems that only a power cycle of the ESP32 allows me to connect successfully.

    I will keep an eye on this and report back when I have more information.

    Thank you @Wilberforce

  • It might be the ESP32 has crashed for some reason. The IDE will say it couldn't get the board info if the board is unresponsive.

    You could try connecting with some other terminal program and seeing if you have any joy.

  • I tested the following:

    1. Start Espruino IDE
    2. Connect ESP32
    3. Connect to COM port (which worked)
    4. Close the IDE
    5. Start the IDE
    6. Connect to COM port (I get the "Connected to COM7 (No response from board)" message)
  • And what about connecting with another terminal app?

  • When I get this error in the IDE, connecting with Putty results in an: Putty Fatal Error: Error reading from serial device.

    In the putty dialog I see this:
    ets Jun 8 2016 00:22:57
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:2
    entry 0x40078c4c

  • This is normal behaviour for me. It seems the USB port gets in an odd state and physically disconnecting and reconnecting are nescessary.

    This is why I usually connect WiFi and connect via IP address. I only use usb for flashing.

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

Just flashed Espruino V2... questions/remarks

Posted by Avatar for CrashingDutchman @CrashingDutchman