You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Which board are you using? The normal Espruino one?

    Sometimes this happens because the code you're sending takes a while to execute. For instance:

    for (var i=0;i<10000;i++);
    // Lots and lots of program code
    ...
    // Lots and lots of program code
    

    Will lose characters, because data is being sent but Espruino is too busy to consume it. It can also sometimes happen when loading modules as well. As @DrAzzy says, turning on 'throttling' should really help - but you might also be able to tweak your code so it doesn't do any calculations until the onInit function.

    Annoyingly Chrome doesn't let me use XOn/XOff flow control for serial communications, so it's a bit hard to make sure the buffer doesn't fill up. Espruino tries its best to throttle the data coming down USB, but if it 'nacks' the USB packets for too long then the PC gives up sending that packet and you lose characters.

    I'll be switching over to a newer USB implementation for Espruino in the next month or so, and hopefully after that I can make it emulate hardware flow control - which would be a massive help.

About

Avatar for Gordon @Gordon started