-
Notifications
You must be signed in to change notification settings - Fork 216
cordio: lower power polling with timeout #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cordio: lower power polling with timeout #15
Conversation
Ok, so I've done some more testing on this, setup is cutting the 3.3V pad on the back and supplying a direct 3.3V input. This reference sketch, seems to consume ~0.93 mA:
With and without this patch, the following sketch is ~6.95 mA:
So I think the patch is fine to merge, but still think something in Cordio is consuming power. cc/ @facchinm |
src/utility/HCICordioTransport.cpp
Outdated
@@ -103,6 +103,9 @@ extern "C" void wsf_mbed_ble_signal_event(void) | |||
} | |||
#endif //CORDIO_ZERO_COPY_HCI | |||
|
|||
#undef WSF_MS_PER_TICK | |||
#define WSF_MS_PER_TICK 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facchinm I'm not sure if this should be changed in the core instead?
WSF_MS_PER_TICK
defaults to 10ms: https://github.com/arduino/ArduinoCore-nRF528x-mbedos/blob/beac74ca3cd9d07363f66cf9cda6b143e4385cd2/cores/arduino/mbed/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/wsf/include/wsf_timer.h#L40 - but in the Nano 33 BLE variant it's set to 1 ms for some reason (https://github.com/arduino/ArduinoCore-nRF528x-mbedos/blob/a1816cd20de39ffc03a9cfd6b378e7b63b210a89/variants/ARDUINO_NANO33BLE/mbed_config.h#L336).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively I think we can rename it in the file, as it doesn't seem to be compiled in mbed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming it here should work just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facchinm great, just pushed. This is ready for review now.
Later on we could be a bit smarter and change the poll interval dynamically based on the connection, advertising or scan intervals. However, let's see how feedback from customers goes.
@facchinm so much better results with the last commit I've pushed, the following sketch uses ~1.6 mA of current while advertising and powered directly via 3.3V (jumper sliced):
|
Does the code put the board into sleep between the polling intervals? |
Hi @ixj111,
The behaviour is as follows for the Nano 33 BLE: |
Sandeep, thank you for the reply. I tested the code by BLE.setAdvertisingInterval(5000) |
Is it possible to share a picture of the board setup (jumper sliced)? |
This is the intended behaviour there is no sleep, the power consumption is just lower between radio events.
I don't have the board with me, however here's an annotated photo. You will need to cut the trace and supply 3.3V to the right pad. Including when programming. |
For those asking to see what 'cut the trace' means. You need to cut the connection between the two jumpers on the bottom of the board as mentioned (see picture). To test if the connection has been severed, put in the USB cable again. Notice that it no longer powers the board, if it does, you need to cut a bit deeper. You will now need to power the board using the 3.3v pin, even when uploading code. If you later wish to go back to using the board through the USB cable, simply solder up the joint that was severed by the cut. |
If you want to keep the above configuration and flash the board again, you have to solder the Vusb traces and power the board using the 3.3v pin. Is that true? |
You don't need to solder the VUSB jumper. That is only used to connect Vusb to the +5V pin (it's disconnected by default to emphasize to the user that, unlike the classic Nano, this is a 3.3 V board). To upload to the Nano 33 BLE after cutting the 3.3 V jumper, you only need to power the board via the 3.3 V pin, connect the USB cable, and upload as usual. You will not be able to upload with only the USB cable attached because the nRF52840 is no longer powered via USB. |
Sorry I wasn't clear here - yes you can still use the USB cable after the cut, it simply won't power the board. You will need to do that by supplying power to the 3.3v pin. If you wish for the USB cable to power the board at a later stage you can solder the cut connection. |
When using the 3.3v pin, do I still need to provide 5v over the USB cable when I want to program the Arduino (33 BLE Sense)? No matter what I do, I can't get my computer to detect the Arduino after powering it from the 3.3v pin - it doesn't even show up under USB devices. However, the |
It will still recognize the Arduino it will simply not be able to power the board, so you will need to provide it with a power source somehow. Alternatively, you might want to try putting the board into 'development mode' by pressing the 'reset' button twice in quick succession. |
I'm powering it with a 3v3 LDO, which is powered through the same USB cable I'm connecting the Arduino to the computer with. I can see that the Arduino does enter the development mode, but unfortunately, it still don't show up in the device list at all. |
The power from the USB will no longer reach the MCU once the cut has been made. So your power source will need to come in from the 3.3 pin. |
Hi, I was wondering if there is any news on this. |
You need to update the ArduinoBLE library on your IDE. The library might be old and not having new commits for your case. |
Hey billiyz,
|
This comment has been minimized.
This comment has been minimized.
Hey guys, I am using the Arduino nano 33 ble and I am powering it with 3.3 volt and I cut the jumper to make that possible. However if I start the board (peripheral) with 3v3 it will not be visible to the clients when they scan for bluetooth. However if i plugin the 5v cable (micro usb) it will be visible, I can then plug it out again and it will still be visible. It is like if the Arduino nano 33 ble need the 5v initially provided through the usb port to start up and then it can be constantly powered by 3v3. Do you have any knowledge about this behaviour? Idealy I would like to power the board with 3v3 and then see it (as an peripharal device) on my clients withoput having to initalize it by pluggin in the 5v cabl one time. |
Did this ever make it into the library as the above code still draws ~7mA and looking at the code in the library it does not seem to have changed (I have the latest version 1.3.6). But if I change WSF_MS_PER_TICK in mbed_config.h to 10, the same code only draws ~2mA |
I've been testing this with the
Examples -> Peripheral -> LEDCallback
example, with two changes:while (!Serial);
fromsetup()
BLE.poll();
inloop()
toBLE.poll(60000);
Unfortunately, in my brief testing it doesn't seem to be lower power (using a USB supply input).
@facchinm any thoughts on this?