Avatar for wklenk


Member since Sep 2018 • Last active Oct 2018
  • 3 conversations

Creating smart IoT solutions in the Stuttgart (Germany) area.

Blog: wolfgangklenk.wordpress.com

Most recent activity

  • in Other Boards
    Avatar for wklenk

    Just wrote a small blog entry at https://bit.ly/2Eq15Pk

    1. Why to better use a BLE connection instead of the serial USB connection
    2. How to interface the modem using the "AT" Espruino module
    3. How to create a NB-IoT (NB1) connection in german radio networks (Vodafone, 1NCE)

    Feel free to comment there if you like to give feedback.

  • in Other Boards
    Avatar for wklenk

    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 :)

  • in Other Boards
    Avatar for wklenk

    You made it :)

    Thanks a lot for all the support.

  • in Other Boards
    Avatar for wklenk

    Hello Gordon,

    these are really good news :)
    For RAK8212 I can see the cutting-edge build


    But shouldn't there be another hex file that contains the complete Espruino firmware?
    I can't wait to try it out ...

    Best regards,

  • in Other Boards
    Avatar for wklenk

    I'm sure you try to save the code before even somethings started to run, correct?

    Thanks for the idea with the state machine. In fact, in the end the code has to run unsupervised and therefore it has to be more robust and resilient.

    The idea is to build a basic data logger that runs directly from flash when the device is powered on. The data should be sent using protocols like MQTT, CoAP or HTTP.

  • in Other Boards
    Avatar for wklenk


    I am connecting through Bluetooth.
    I removed setupExternalHardware() from onInit(), but it still freezes.

    Then I started with a tiny module BG96NB1.js, adding more and more lines of code step by step.
    I ended up in just adding lines like console.out("XXXXXXXXXXXXXXXXXXX") to find out the module size that still worked, while adding just one more line of console.out made save() freeze again.

    The largest size of the overall program I could see was 12261 (0x2FE5) bytes.

    Setting up external hardware. Please wait ...
    BME280 wiring set up.
    Quectel BG96 wiring set up.
    Compacting Flash...
    Calculating Size...
    Compressed 40000 bytes to 12261
    Running onInit()...

    This makes me assume that there must be some kind of limit at about 12288 (0x3000) bytes.
    Could this actually be true?
    I can't believe why the application should fit into RAM, but not into flash.

    ={ free: 1620, usage: 880, total: 2500, history: 421, gc: 0, gctime: 5.09643554687, "stackEndAddress": 536927056, flash_start: 0, "flash_binary_end": 382804, "flash_code_start": 471040,
    flash_length: 524288 }

    Found this in https://github.com/espruino/Espruino/blo­b/master/boards/RAK8212.py :

    chip = {
      'part' : "NRF52832",
      'family' : "NRF52",
      'package' : "QFN48",
      'ram' : 64,
      'flash' : 512,
      'speed' : 64,
      'usart' : 3,
      'spi' : 3,
      'i2c' : 2,
      'adc' : 1,
      'dac' : 0,
      'saved_code' : {
        'address' : ((118 - 3) * 4096), # Bootloader takes pages 120-127, FS takes 118-119
        'page_size' : 4096,
        'pages' : 3,
        'flash_available' : 512 - ((31 + 8 + 1 + 3)*4) # Softdevice uses 31 pages of flash, bootloader 8, FS 1, code 3. Each page is 4 kb.

    Does this mean 3 * 4096 byte only for saved code?
    Compared with the Nordic NRF52832 (https://github.com/espruino/Espruino/blo­b/master/boards/NRF52832DK.py) why does this have 10 pages a 4096 byte for saved code?

  • in Other Boards
    Avatar for wklenk

    I am currently playing around with a RAK8212 and wrote a module to interface with the Quectel BG96 that is aimed at Narrowband IoT (NB-IoT) communication. I tried my best, but I am a newbie and possibly the code quality is bad ...

    But the actual issue is that when I call "save();" the RAK8212 freezes up and I need to press the reset button to get it back into live.

    I would appreciate some hints what I am doing wrong or how the issue can be solved.

    I have placed the code into a github repository at https://github.com/wklenk/rak8212-esprui­no-nb-iot


     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     1v99 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    >Setting up external hardware. Please wait ...
    BME280 wiring set up.
    Quectel BG96 wiring set up.
    Compacting Flash...
    Calculating Size...
  • in Pico / Wifi / Original Espruino
    Avatar for wklenk

    I have the same behaviour with 1v99 on a RAK8212.
    After outputting to console "Calculating Size ..." the execution of the save() function just freezes.
    I have set up a function that periodically blinks a LED, but even this blinking stops.
    I need to press the reset button and re-connect to get an espruino prompt again.

    In my case, I have found out that save() works most of the time, but in this particular case my software has registered a callback on incoming data from Serial1 (in my case from the Quectel BG96 modem). I am working with Bluetooth as console. If I throw out the code section that registers that read callback on Serial1, save() works correctly.

    So my guess it that save() somehow interferes with Serial1 and then the callback in my software is executed and the complete JS interpreter is blocked.

    I currently don't know how to go on finding out what the problem is.