Espruino build for nRF52832 board with external low-frequency 32678 kHz crystal #7637
Replies: 1 comment
-
Posted at 2021-07-08 by @gfwilliams I think you just need this in BOARDNAME.py:
Posted at 2021-07-08 by sebi Thank you so much! I will do some digging... What about D0 being P0.00/XL1 and D1 being P0.01/XL2. Is this true? Posted at 2021-07-08 by @fanoush also your image comes from reference circuit https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/ref_circuitry.html?cp=4_2_0_52_0#schematic_qfn48_ldo Posted at 2021-07-08 by @fanoush the software config is here https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L2365 If you would use Nordic SDK directly, LF source it is typically chosen in the SDK config file https://github.com/espruino/Espruino/blob/master/targetlibs/nrf5x_12/nrf52_config/sdk_config.h#L262 (in newer SDKs there are actually two settings there to change, one generic and one for the softdevice) Posted at 2021-07-08 by sebi It is very clear. Thank you very much! So I guess I have to reassign the Espruino DFU/reset Pin to something other than D0 to have this feature working? Posted at 2021-07-08 by @fanoush Oh, so you want to add crystal to existing MDBT42Q board? And now I also noticed
How much of power you expect to save? It may not be that much and it is likely other components on board may draw more. See e.g. this https://devzone.nordicsemi.com/f/nordic-q-a/25540/is-external-crystal-neccessary-at-all-on-52832/100707#100707 so it is really not much. Was thinking you already have board with the crystal and just want to enable it so it is not sitting there wasted. And BTW there is also the builtin DCDC converter, it could save more if used , that is however more complicated to enable as it needs more components. see https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=4_2_0_17_0#topic and https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/ref_circuitry.html?cp=4_2_0_52_1#schematic_qfn48_dcdc just googled and here https://www.programmersought.com/article/18503111047/ someone claims enabling DC/DC can save 40% and crystal 1-2% Anyway, yes those board file changes will help freeing D0 pin, however you need to build and update also the bootloader as that is where the button is actually checked. Posted at 2021-07-08 by sebi Sorry for being that little clear: I don't have a MDBT42Q board. I want to define my own definition board, and I thought Indeed I do have a board with a low-frequency crystal (actually it is still in the mail) and I want to enable it so it is not sitting there wasted + to save some power. I have 2 nRF52832 boards I would like to use as beacons:
I used the standard
I did some power measurements on nRF51822 boards programmed as beacons (not nRF52832 boards though, not Espruino based) using the NORDIC Power Profiler Kit II, and I came out with this comparison chart:
Thus I expect to save about 14%. This result corroborates this discussion on Nordic DevZone Q&A. Once I successfully generate an optimised Esprino firmware for my FEASYCOM board, I would like to do the same comparison... I did some measurements on the Holyot board programmed as a beacon using Espruino and was impressed by its low power consumption already! However I also noticed little current spikes here and there in-between two broadcasting emissions (the board was sleeping?) that might be due (I have no clue though) to the use of the RC internal oscillator. This is why I would like to try the same code on the FEASYCOM board which Espruino firmware is built enabling its low-frequency crystal (+ redefining the reset pin to be able to exit the
Posted at 2021-07-08 by @fanoush That post you linked is excellent summary, thank you. Of course the calibration takes power, nice someone took care to compute that part too. BTW if schematics in the Holyot YJ-17095 page is correct the DCDC should be supported there. It saves most power when current is high = bluetooth transmit. Now found source for information in that article I linked previously here https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/optimizing-power-on-nrf52-designs For enabling DCDC define Posted at 2021-07-08 by sebi Great that the Holyot YJ-17095 board supports the DC/DC regulator! I will compare power consumption of the FEASYCOM FSC-BT630 used as a beacon, programmed using Espruino, for all the different setting combinations (as soon as I receive it). AVERAGE POWER CONSUMPTION (in uA @ 3V):
To let the bootloader take into account the new reset pin definition D3, I modified my board definition file with The Espruino documentation is top-notch and the file entitled Espruino Internals: Build Process explains how to enable the low-frequency crystal and the DC/DC converter as well:
@gfwilliams : Can you tell me how to get the Donated badge under my name in the forum? I did donate during the Bangle.js Kickstarter campaign and I own official Espruino boards (Pico, Puck.js) + your book. Posted at 2021-07-09 by @fanoush
The line Posted at 2021-07-09 by sebi Thank you! I am currently experimenting with my Holyot YJ-17095 board and will try it enabling the DC/DC regulator. I will make screenshots to observe the current spikes I was talking of and to compare power consumptions. Posted at 2021-07-09 by @gfwilliams Hi @SEBI! You mean you donated extra on the KickStarter campaign? The badge is semi-automated and I hadn't actually added those who'd contributed in the campaign (just by http://www.espruino.com/Donate) so that's why you didn't show up. I'll add you on the list, and the next website update should have that in. Thanks! Posted at 2021-07-09 by sebi @gfwilliams : I bought a pixel during the Bangle.js campaign. It is peanuts but I made sure to buy official boards and your book. I thought the donated badge was automatic when buying something during the campaign and it could be a mistake... I realise buying/donating are two different things. Additionally it is not worth putting that badge for peanuts. Posted at 2021-07-09 by sebi @MaBecker pointed out to me that I can get inspired from the Bangle.JS2 board definition file to tweak my boards' settings. Posted at 2021-07-14 by sebi It seems enabling the DC/DC regulator doesn't improve (always?) performances: check my post on GitHub where I compare different settings on a nRF51 board programmed to be a beacon in C. Enabling the low-frequency crystal does improve power consumption thought. I am planning to do the same comparison with my FEASYCOM FSC-BT630 (nRF52) as soon as I get it. Additionally I would like to compare the beacon when programmed using Espruino (see this post for the original code). But from my current tries with my Holyiot YJ-17095 board, it seems the Espruino version consumes about 45uA so about 5 to 6 times more than the beacon version in C. I can't explain this as I thought
required restarting the BLE stack with different settings (disabling the communication with the IDE, etc) that would make this code running very similar to the code directly generated from C. Posted at 2021-07-14 by sebi EDIT: I moved the content of this post to another thread in the forum as I plan to publish the code on Espruino App loader once it is finalized and refer to it for explanations. Posted at 2021-07-15 by sebi
It seems something was wrong with my preliminary tests on the Holyiot YJ-17095 board since today I measured an average power consumption on the Puck.js acting as a beacon of only 6.30uA @ 3V (see this post on the forum). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-08 by sebi
I have a nRF52832 board equipped with an external low-frequency 32678 kHz crystal.
Is there a way to switch the low-frequency oscillator from:
...to generate an espruino build?
I would like to use the external low-frequency 32678 kHz crystal to improve the board power consumption when used as a beacon.
The external low-frequency crystal is connected between P0.00/XL1 and P0.01/XL2 (see enclosed picture).
D0 and D1 are used on the Esprino MDBT42Q board to switch to DFU/reset modes and to light an LED.
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions