• What a coincidence: Just wanted to post a new conversation with a similar, if not exactly the same issue:

    RAK8212: ReferenceError: "RDY" is not defined

    I wrote a small data logger that reads temperature values from the BME280 and sends it via Quectel BG96 modem to an IoT dashboard (Cayenne myDevices).
    The code is written "Direct to Flash (Execute at boot)".

    As long I stay connected with the (native) Espruino IDE via Bluetooth LE, everything goes well. The code creates a socket connection to the IoT dashboard, and data is sent periodically.

    But as soon as I power cycle the RAK8212 and stay disconnected, the code starts, but then somehow the code execution is interrupted.

    I then tried to catch and store exceptions:

    // Deal with any uncaught exceptions
    process.on('uncaughtException', function (err) {
      console.log('Error', err);
      errorStore = err;

    One of the errors found is
    ReferenceError: "RDY" is not defined

    I think I guess what happens: As long as I am connected via Bluetooth LE, then the JavaScript interpreter/console is attached to the serial interface "Bluetooth". But as soon as the RAK8212 runs without something being connected to it, neither via USB nor with Bluetooth LE, then the JavaScript interpreter/console is attached to "Serial1". Unfortunately, when communicating with the modem, "Serial1" is connected with the modem. When the modem has finished booting up, it outputs "RDY" and this is interpreted by the JavaScript interpreter/console. I don't know if there is actually even more malicious interference between modem and JavaScript interpreter/console.

    The good news: If I use the following code, everything runs well, even without being connected to the RAK8212:

    function onInit() {
      Bluetooth.setConsole(true); // Don't want to have console on "Serial1" that is used for modem.

    Actually, that is the thing that Gordon recommended :)


Avatar for wklenk @wklenk started