You are reading a single comment by @fanoush and its replies. Click here to read the full conversation.
  • there is the microbit v1 and there is some thread about NRF51TAG here http://forum.espruino.com/conversations/­320879/ also some fitness tracker attempts here http://forum.espruino.com/conversations/­342982/

    Is anyone still using it?

    Just made a fresh 2.10 build for bare nrf51 module with 16K RAM and found it somehow broken. Also the number of variables in Microbit V1 board file proved to be quite unrealistic, I had to go far below 300 to let webide connect and read board info as the board JSON would not print due to low stack.

    I tried some additional trimming to enable some other features (like native code via inline C or arrow functions to enable button to view storage files in WebIDE - It calls require('Storage').list().forEach(x=>pri­nt(JSON.stringify(x))); ). Again with that complex expression I had to reduce variables even more to 250 to allow even more stack so the JSON.stringify(x) inside that forEach would still produce some data instead of " ... "

    Then with various builds I triggered unaligned jsVars array so it would crash completely at startup with new compact variables code. And when I got it somehow into shape and tried some bluetooth scanning code (NRF.findDevices, NRF.setScan) it again crashed/freezed/disconnected randomly so I noticed that nrf51 code path disables interrupts completely when working with JS variables which the SoftDevice doesn't like. After fixing that, NRF.findDevices would still not work correctly. It triggers low memory condition making console unusable with flood of "interrupted" messages even with simple NRF.findDevices((x)=>print(x),1000) with ~15 devices around. So looked into .data and .bss segment size usage and managed to reduce some usage to go up with variable to current 286 and 8 flash pages for Storage.

    Now pasting simple code like

    E.setFlags({pretokenise:1});
    
    function findDevices(cb){
      var devs = {};
      var nonew=0;
      function add(x){
        if (!devs) return;
        if (x.id in devs) {
          if (++nonew>30) {NRF.setScan(undefined);setTimeout(()=>{­cb(devs);devs=undefined;},0);}
        } else {devs[x.id]=x.name;nonew=0;}
      }
      NRF.setScan(add,{active:true});
    }
    
    findDevices((x)=>print(x));
    

    does not crash or produce console errors and finds all my devices around even when the function is in RAM. But adding any more code pushes it over the edge (like enabling watchdog and kicking it from setInterval). Moving the code to flash would certainly make it better, however not sure whether with ~290 variables I could e.g. draw to small OLED display while also having some bluetooth code there (=51822 fitness tracker usage).

    Anyway, wanted to ask, is anyone still trying to use microbit v1 or any other 51822 device with Espruino? If yes, what use cases still work for you? Maybe some old Espruino versions are better?

    I found there are some cheap 51822 boards on aliexpress claiming to have the QFAC 32K RAM variant so ordered few to test how usable that would be. However the 16K version module I have seems barely usable for any a bit more advanced code.

    EDIT: boards from aliexpress arrived, they have QFAA with 16kB despite description and images claiming QFAC/32kB :-(
    item link removed

About

Avatar for fanoush @fanoush started