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.

  • Hi, happy new year 2023 to every one!
    Almost 10 years since this thread started and I have this very same problem:
    Dropped characters in the terminal and at upload time via BLE.
    This happens on a Pixljs with espruino 2v16, a pc on Windows 11, and I tried, with no luck, differents settings:
    +Bluetooth smart (BTLE) via 'noble': on or off,
    +Bluetooth smart (Web Bluetooth): on or off,
    +Software Flow Control: on or off,

    The screen below is a upload time or after a reboot, dump and reset...

    I also, with no results:

    • reflashed the Pixljs from Android and nrfConnect...
    • cleared the Flash and just upload to RAM.

      >dump()
      =undefined
      >reset()
      =undefined
      _ _|_|___ ___        _
      |  __|_ -| . |
      |____|___|  _|_| |___|_|_|_|___pruino.com
      2v16 (c) 2021 G.Wil
      > 
      

    and this one is a dump of data, all lines should have the same structures, they obviously don't.

    >getData()
    {
      "time": Date: Thu Jan 1 0100,
      "pulseNumber": 1, "pul"power": 2510 }
    {
      "time": D0 17:10:54 GMT+0100,
      "pulseNuration": 3, "power": 1220 }
    { Thu Jan 1 1970 17:10:57 GMT+0100": 3, "pulseDuration": 2.4, "pow "time": Date: Thu Jan 1 1970 17
      "pulseNumber": 4, "pulseDurat: 5190 }
    {
      "time": Date: Th:34 GMT+0100,
      "pulseNumber":": 1, "power": 3620 }
    {
      "ti 1 1970 17:18:38 GMT+0100,
      "pulseDuration": 2.1, "power": 17: Date: Thu Jan 1 1970 17:18:40 seNumber": 7, "pulseDuration": 2
    =undefined
    > 
    

    It is reproductible: issueing the same command produces the very same dump.

    Finally, It also happens if I paste some code on the right pane of the native editor: lost chars and randomly placed edit cursor on the edited line only while attempting to paste from elsewhere, say a web page.

    The full code below is hill named but at the end I expect this to run on an old original espruino board.

    So what could be the cause?
    Maybe another BLE device?

    Thanks for your attention...


    1 Attachment

  • Hi,

    I just tried this on a Pixl and I don't see anything from getData() - is there something I have to do to get it to record data?

    Are you connecting from https://www.espruino.com/ide/ or the Native IDE? I have seen issues with lost data using the Native IDE, but not with Web Bluetooth on https://www.espruino.com/ide

  • Hi,

    I use the native ide on windows 11.

    getData() reads the data stored in 4 arrays Uint16 or 32 bits.
    This data is stored when a watch, initialised by initWatchs(), launches one, depending on the board used, of sALcd(d2,p2) for Pixljs or sALcd(d2,p2) for the original espruino.
    The sensor is an LDR and data is: a counter, the date, the time between falling edges of LDR, and a computed power.
    As a result I expect to upload data either with usb from the original espruino board or with ble advertising from Pixljs: This is yet to be added as I found a third project here.
    Ble advertising is steep a learning curve for me so far: choosing a standard UUID in the table and setting up the formatted data value.

    Basically, this is an extension of your puckjs ldr based tutorial wired just as you did and some other data logger tutorial...
    Indeed, I am trying to catch the very same power meter diode flashes while my solar panels over produce energy and the apparent power gets down to 0.
    In this case, there is a 0 apparent power provided but the power meter's serial link, while the led flashes at each Wh, so ...
    This information is officially provided by a serial uart names TIC (teleinfo) here in France. It takes an opto isolation and 1,N,8 at 1200 bauds to get some data which would allow me to measure each reinjected Wh and the time between those pulses to know what power is beeing reinjected to the grid right in real time. This link is well known here and there are many schematics and ready made interfaces for USB devices. I have run it on a raspberry pi since 2014 "almost" uninterupted.
    There is an equivallent serial link in Belgium and the Netherland as far as I know.

  • Ok, I used Web ide with Chrome, it works immediatly better... Apparently nothing is lost in transmission.
    And, by the way, Brave doesn't connect as BLE is not available...

  • Confirmed, works as a charm with Chrome, not with Firefox, Brave as BLE is missing to them.

    Sorry having disturbed you..

  • OK, great! No problem.

    I think I should probably start to deprecate the Native IDE - I'm not sure there's a great deal of use for it at the moment as it's really only for Windows 7 and earlier BLE. espruino.com/ide can still be installed and will work offline too!

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

Espruino Serial Terminal drops characters.

Posted by Avatar for IdeaShaker @IdeaShaker

Actions