Espruino Serial Terminal drops characters.

Posted on
  • Hi, all

    We just got our Espruino board; it's currently running Espruino 1v40.
    The Serial Terminal in Chrome is great, but writing programs in the window to the right and clicking "Send to Espruino" results in some strange behavior. It report JavaScript errors that appear to be caused by characters in the code being dropped.

    Example:

        var l = false;
        setInterval(function() {
            l = !l;
            if (l) turnOn();
            if (!l) turnOff();
        }, 1000);
        
        function turnOn() {
          digitalWrite(LED1, 1);
              
          setTimeout(function () {
            digitalWrite(LED2, 1);
          }, 100);
          
          setTimeout(function () {
            digitalWrite(LED3, 1);
          }, 200);
        }
        
        function turnOff() {
          digitalWrite(LED1, 0);
          
          setTimeout(function () {
            digitalWrite(LED2, 0);
          }, 100);
          
          setTimeout(function () {
            digitalWrite(LED3, 0);
          }, 200);
        }
    
    Results in:
    
        ERROR: Function not found! Skipping. at line 2 col 7
        digitalWrte(LED3, 0);
    

    I'm not crazy! That 'i' was definitely there. Has anyone else seen this?
    Is it already fixed in another build of Espruino?

  • Hi, thanks for letting us know. What operating system are you using?

    Could you try plugging in the USB to serial dongle that you have (instead of the Espruino), and then connecting one strand of the wire up such that RX and tx are connected?

    That way, if you connect with the terminal and do the same thing, you should get the data sent right back to you and we can see if it is an Espruino problem or a web app one.

    You could also try using a different terminal app and copying and pasting code in - I believe there are some other examples on http://www.espruino.com/Quick+Start

  • I'm using Mac OSX 10.7.5

    I'm not getting very far with the dongle; "ls /dev/tty.*" comes up empty.

    If I use the micro-USB port, do "screen /dev/tty.usbmodem-whichever" and start pasting code into the Mac OSX terminal to send to Espruino, the problem persists. Doing it one function at a time works okay, but characters are still getting dropped when I try to paste in the entire program.

  • Ok, thanks - I'll check it out. Pasting via 'screen' shouldn't drop characters - it doesn't seem to on Linux - but I'll do some tests with Mac OS.

    For now I'll add some kind of delay into the Web UI on Monday - which should patch up any problems until I fix this properly.

  • By the way - you may need drivers for the USB-TTL dongle: https://forum.espruino.com/conversations­/202/#comment1239

    I wouldn't worry about it though - hopefully you won't need it now.

  • also observed as documented above (just to reinforce that you are not crazy IdeaShaker). I am using Windows 7 with Espruino board v1.1, code v40and the chrome app as posted on the chrome app store

    Also observe that random characters get dropped midline

    eg. SPI2.send (0xf, B6)

    becomes
    SPI2.end(0xf,B6)

    and a subsequent syntax error.
    Line by line copy and paste seems to be the only way in at present

  • Hi Neil, can you confirm that this doesn't happen when pasting code in via putty? (Eg, that it is only a web app problem).

    I think there are two problems here - web terminal losing characters (on some platforms) and then Espruino USB losing chars on Mac OS.

    It's a strange one because the USB code has been in use for over a year and I haven't had any reports of lost characters (it only seemed to happen on boards that used serial, or non-f103 chips)

  • Ok, Just checked. Current state is:

    OS Web App Local App
    Windows Lost chars Ok
    Mac Os Lost chars Lost chars
    Linux Lost chars Ok

    So when I fix the Web App, that'll just leave local apps on Mac OS that have problems...

  • Hi Gordon

    just tried with putty on Windows 7 with espruino 1.1 v40: this method is certainly more robust than the web app - I can paste multi-line functions without issue. However, if I paste in a full file (into a console that has been first reset() and using code that has been verified to be ok), then something is still amiss as the ">" prompt never turns and stays at ":" as if expecting a closing bracket of some sort, which I don't believe to be the case. This can be verified using the MAX7219 code example I have sent you privately Gordon.

    Thanks

    Neil

  • I have the same problem when pasting code. I use windows-7, putty, some dev board based on STM32F103vet6, espruino_1v39_hystm32_24_ve.bin.
    It seems it interprets each new character on-fly and if a string is long enough it loses some character. I think so because it loses same character each time. Pasting code in small chunks helps.
    You can try to reproduce the issue using the code from my screenshot:

  • Hi user6065,

    Can you start a new thread for your problem, as we're trying to sort out an issue with the Espruino KickStarter board here.

    In your case I'd be 90% sure that your problems will be fixed by just trying the other USB port on your board (there is no flow control on the standard serial port, and as Espruino sends more characters back than it receives, after some time it will run out of buffer space).

  • I've just updated the terminal app to fix a bunch of outstanding issues (including - hopefully - this one). The new version is 1v29 and should be appearing in the next hour or so.

    Please let me know if it updates automatically or not - you may have to uninstall and reinstall it from https://chrome.google.com/webstore/detai­l/espruino-web-ide/bleoifhkdalbjfbobjack­fdifdneehpo.

    Note that serial writes are now throttled so should be more reliable - but will be slower. I'll look into whether I can modify Espruino's USB implementation (as it looks like it is something strange in there) - but for now I hope you won't hit this any more.

  • The new terminal app looks good; it updated automatically for me when I relaunched Chrome. No more dropped characters!

    Mac OSX local app obviously still has the problem. If it would help, I can still spend some time playing around with that and the USB dongle.

  • Great!

    It's ok - it looks like an issue with USB flow control on the Espruino Board itself (in fact on all operating systems). It is something I'll be trying to look at, but there isn't so much urgency now.

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

Espruino Serial Terminal drops characters.

Posted by Avatar for IdeaShaker @IdeaShaker

Actions