-
-
-
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 ?
-
-
-
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 >process.memory() ={ 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" ="test" // it starts to draw more than 7 mA right at this moment >process.memory() ={ 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 :)
-
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.
-
Thank @allObjects for the explanation regarding the save() command, it's very interesting. I will remove it from my code and enter it manually as you suggest.
To achieve absolute low power use the pins need to be re-configured to not cause any load - current flow - on the pins. Could you measure what is going on in regard to current sourcing/sinking by (all) your pins?
Thanks for the suggestion, however as I tried to show with the clearWatch() command, the problem must be located in the code (or in the way Espruino handles low-power mode on the NRF52832) and not in the hardware. Since entering the clearWatch() instruction doesn't change any pin configuration, the issue must be elsewhere.
As I'm reading this, at normal operation, 100uA is observed and during a BLE event, 1mA is consumed. Where, when is the 7mA drain observed as this value is far in excess of normal operation? Are the readings before or after the LDO? What are the values of the pullups?
The 7 mA drain is observed when the setWatch() are "active". If I clear them, the current decreases to 100 uA. This current is measured with a multimeter directly from the laboratory voltage source, which is at 6V to simulate two 3V batteries in serie. I will post the schematic tomorrow.
Do you get the high power draw if you upload just the setWatch commands, or what if you make the functions they call empty?
I will try tomorrow.
Thanks guys for your inputs :-)
-
-
Hi everyone,
I made a cooking timer with Espruino 2v01 based on a NRF52832 on a custom PCB. It has 2 buttons and a 7-segment led display. The display is off until the user presses any button. It then turns on and the user can set the timer and then start it. The display turns off after a few seconds, but can be turned on again if the user presses any button (so he/she can know when the timer will end). When the timer is finished, some leds on the PCB blink a few times to alert the user. He/she then has to press any button to stop the alarm.
My cooking timer works functionally well but consumes a lot of energy. About 7 mA at 6V (I have a LDO lowering the voltage to 3.3V then). I'm sure it's due to my code because I can go below 100 uA if only the GPIO are configured correctly. I have noticed that if I clear the 4 setWatch() I have with the clearWatch() command, it goes back to normal (less than 1 mA when connected by BLE, about 100 uA when disconnected). I'm not familiar with the way Espruino handles low-power modes on the NRF52832, but it seems that the device cannot turn off the external quartz nor decrease its frequency, thus consummating the 7 mA.
Can someone help me to understand what's happening ? I need the setWatch() to turn the display on when the user presses a button, so just removing them is not an option ;-) There is maybe another way to implement the behavior I need, I'm open to any suggestion.
The code is optimized with "simple optimization" and is minifyed from 20530 bytes to 11597 bytes. Here are the process.memory() results when it consumes 7 mA (first and second lines), I then clear all setWatch() at line 3 and call process.memory() again. At this point, the whole board consumes 1 mA (because of the BLE connexion), then about 100 uA after a few seconds.
>process.memory() ={ free: 1093, usage: 1157, total: 2250, history: 1000, gc: 0, gctime: 4.79125976562, "stackEndAddress": 536924016, flash_start: 0, "flash_binary_end": 390268, "flash_code_start": 442368, flash_length: 524288 } >clearWatch() =undefined >process.memory() ={ free: 1157, usage: 1093, total: 2250, history: 1006, gc: 0, gctime: 4.57763671875, "stackEndAddress": 536924016, flash_start: 0, "flash_binary_end": 390268, "flash_code_start": 442368, flash_length: 524288 }
The code is in copy if needed.
Thank you and best regards.
-
-
-
Hi,
I have a strange bug when I compile Espruino for the Mikro2 clicker 2 (see here for more information about this board). It is based on the STM32F407VGT6, the same MCU that is on the F4discovery board. Thus I started with the STM32F4DISCOVERY.py file to modify the pin names, and I change the prescalers in the system_stm32f4xx.c file located in targetlibs/stm32f4/lib, because the quartz on the mikro2 board is a 25 MHz quartz (it's a 8MHz quartz on the F4DISCO board).
Everything compiles well and I'm indeed able to run Espruino on the clicker2 board through the USB port. My problem appears when I try to connect a UART module: the effective baud rate I get is not the one I set, it is multipled by a factor 3.125 ?!? So I have to set the baudrate to 18432 to have it at 57600.
Serial3.setup(18432, { tx:D8, rx:D9 });
Knowing that 3.125 = 25/8, I guess this issue is related to the fact that there is an "8" MHz lost somewhere in the Espruino files to compile.
My question is then: is there another file where I have to change the quartz frequency, in addition to the system_stm32f4xx.c file ?
Thanks for your help :)
-
-
Hello,
I want to access the TI TRF7960 (a 13.56MHz RFID reader/writer) with Espruino running on a nucleo STM32F401RE. The TI chip can be accessed with SPI, but with an exotic trick : clock polarity has to change between a write and a read instruction. Below is a drawing from the application report "Using the SPI Interface With TRF7960" (http://www.ti.com/lit/an/sloa140a/sloa140a.pdf).
How could I do that ? I tried the following but it doesn't work.
var spi = new SPI(); spi.setup({sck:B6, miso:A6, mosi:A7, mode:integer=0, order:'msb'}); digitalWrite(SS, 0); spi.write(0b01000100); spi.setup({sck:B6, miso:A6, mosi:A7, mode:integer=3, order:'msb'}); d = spi.write(0b01000100); digitalWrite(SS, 1);
Thank you :)
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.
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:
but when I then I have the following error message.
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.