Avatar for benoit


Member since Apr 2018 • Last active Apr 2020
  • 5 conversations

Most recent activity

  • in Other Boards
    Avatar for benoit

    Hi !

    I use a 7-segment led display like this one on a custom board with a NRF52832 (it runs espruino v2.01).

    I have a setInterval that triggers a refreshDisplay function. This function calls three time the function turnDigitOn to display the hour.

    function turnDigitOn(digit) {
      digitalWrite([D6, D5, D4, D3, D2], digit);

    As the refreshDisplay is called with an interval of 2ms, I was wondering if I could write it in inlineC to speed up the thing. I tried the following:

    var c = E.compiledC(`
      // void turnDigitOn(int, int, int, int, int)
      void turnDigitOn(int ioDigit1Value, int ioDigit2Value, int ioDotsValue, int ioDigit3Value, int ioDigit4Value) {
        nrf_gpio_pin_write(6, ioDigit1Value);
        nrf_gpio_pin_write(5, ioDigit2Value);
        nrf_gpio_pin_write(4, ioDotsValue);
        nrf_gpio_pin_write(3, ioDigit3Value);
        nrf_gpio_pin_write(2, ioDigit4Value);

    but when I then I have the following error message.

                                     COMPILER MESSAGE
    out1069094144.cpp: In function 'void turnDigitOn(int, int, int, int, int)':
    out1069094144.cpp:59:26: error: 'nrf_gpio_cfg_output' was not declared in this scope
    out1069094144.cpp:65:40: error: 'nrf_gpio_pin_write' was not declared in this scope
         nrf_gpio_pin_write(6, ioDigit1Value);

    So is there a way to use these nrf functions (nrf_gpio_cfg_output and nrf_gpio_pin_write) and most importantly, will inlineC really increase performances?

    Thanks and best regards.

  • Avatar for benoit

    I understand, thanks for the details. I will look for other solutions.
    Best regards.

  • Avatar for benoit

    Thanks for the explanations.
    One last question: do you think this feature be implemented with inline C? Or is it too complicated?

  • Avatar for benoit

    Ok, sad =/

    Is it because of a webBluetooth limitation or because Espruino doesn't use Nordic sdk S132 or S140 ? --> https://infocenter.nordicsemi.com/index.­jsp?topic=%2Fcom.nordic.infocenter.sdk5.­v15.0.0%2Fble_sdk_app_multilink.html

    Is this feature planned in a future Espruino version ?

  • Avatar for benoit

    Sorry if it wasn't clear. My question is: is it possible - with one puck.js and using Espruino - to connect several BLE peripherals and subscribe to their characteristics ?

  • Avatar for benoit

    Hi guys,

    Any update on billsalt's question ? Is it still impossible yet ?

    Best regards.

  • in General
    Avatar for benoit

    Hi everyone, I had to work on other projects so I haven't had much time to investigate further, sorry for that. I'm back on that issue since a few days and I have new info :)

    I flashed the same code on the nrf52832 dev kit, made by Nordic. So no pull-up resistor that might act weird nor manufacturing problem. However, I have exactly the same issue : the dev board draws more than 7 mA when programmed.

    I manually copied-pasted my code function after function to see when it starts to draw 7 mA (it draws about 1.5 mA when connected with BLE, 0.5 mA in low power mode, so no hardware cause). I discovered that the current jumps to 7 mA when the free memory goes below 1300. Here is what I tried. I run espruino 2v01 for the record =)

    // I just copied-pasted my code before that lign, to fill the memory. The board draws about 1.5 mA up to now
    ={ free: 1302, usage: 948, total: 2250, history: 1189,
      gc: 0, gctime: 3.47900390625, "stackEndAddress": 536924016, flash_start: 0, "flash_binary_end": 390268,
      "flash_code_start": 442368, flash_length: 524288 }
    >var aa = "test"
    // it starts to draw more than 7 mA right at this moment
    ={ free: 1300, usage: 950, total: 2250, history: 1192,
      gc: 0, gctime: 3.47900390625, "stackEndAddress": 536924016, flash_start: 0, "flash_binary_end": 390268,
      "flash_code_start": 442368, flash_length: 524288 }

    So the problem is definitly not on the hardware side. It thus seems it's a memory issue and finally not a setwatch issue. Did somebody have the same issue ? Any idea how to fix it ?

    Thanks for your help :)

  • in General
    Avatar for benoit

    Does the current drop after the five second timeout?

    No, it stays at about 7 mA even after the 5 seconds timeout.

    Regarding the checkBatteryState(), I will get rid of the R2 resistor to definitely remove any current that could flow in R2/R3 (I made a mistake as Q1 is referenced to VBAT which is 6V, and I cannot turn it off with a 3.3V signal). However, this current is about 6V/(200K + 100K) = 20 uA and should be the cause of the 7 mA drain.

    Here some parts of the schematics.