Serial1.setConsole() is not working

Posted on
  • Hello..

    I attach a serial device to the Serial1 on ESP8266.
    To retain the connection of the serial device, I put a code of

    function onInit() {
       Serial1.setConsole();
    }
    

    at the begining of the program.

    However, data from the serial device can't be obtained.
    But, if we connect the ESP8266 using TCP in espruino web IDE, then
    the data from the serial device has appeared.

    Is there any instruction that can activate the serial device connection ?

    Regards,
    Maman

  • you do not have to set the console to serial, because this is default.
    After connections over tcp/ip it switches back when when connection closes, hope this helps.

  • Hello @MaBe,

    Yes, I have tried using software serial, but the serial data is not reliable, although I set the baud-rate at 4800. And, after one or 3 hours, the ESP8266 will crash.

    Using hardware serial, the data is more reliable. However, after disconnection over tcp/ip,
    there is no data coming from the device, as seen in a server application.
    I use MQTT protocol to send data from device to the server.

    Regards,
    Maman

  • Is there any instruction that can be executed by the ESP8266 to change the REPL console to connect over TCP/IP ?

  • And, after one or 3 hours, the ESP8266 will crash.

    Check your vars, send process.memory() as JSON via mqtt every 5sec to be sure your code has no memory leak.

  • Hello @MaBe,

    The problem of using software serial is the success rate of serial data. It is very low, only 30%, we get the proper data, although using a low baud rate at 4800. While using the hardware serial, we get more than 90% success rate. So, I discontinue using software serial.

  • I found this issue :
    https://github.com/espruino/Espruino/iss­ues/830

    I inject this instruction : LoopbackA.setConsole(), via mqtt protocol to the device,
    then the serial data is coming to the server app.

  • it is very low, only 30%, we get the proper data, although using a low baud rate at 4800. While using the hardware serial, we get more than 90% success rate. So, I discontinue using software serial.

    Are you using the latest Espruino firmware?
    Because there is a implementation of a stable software serial coming with 2.01 see
    ChangeLog and the test results.

  • Yes, i use 2v01.49

  • Can you please share some details how you use the serial connection?

  • Yes, sure.

    I want to develop ESP-Now gateway, based on this work
    https://github.com/HarringayMakerSpace/E­SP-Now.
    Using espnow, it is possible to develop battery-powered devices for sensors,
    using less IP-address devices.

    For the gateway, I use 2 ESP8266, one is for connection with the esp-now network,
    and the other is for connection to the internet via wifi. For the first device, I use arduino IDE,
    while for the second device, I use espruino.
    Communication between devices is using UART. Now, both device is using hardware serial.
    I use ESP-07.

    Regards,
    Maman

  • esp-now is not implemented for the Espruino ESP firmware.
    It looks very usefull for esp-wifi-devices on battery using sleep mode.

    A implementation would be a benefit for EspruinoWifi, ESP8266 and ESP32
    because esp-now is available with espressif AT firmware and SDK, starting with version 2.1

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

Serial1.setConsole() is not working

Posted by Avatar for maman @maman

Actions