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
BLE: additional features #5186
Comments
As a total BLE n00b I'm looking forward to the docs and samples :) |
How about Unix BLE support? I'd like to have that so that I can use my desktop for development. Of course Unix BLE is way different but that would be hidden behind the API. |
Is BLE support for STM32WB also planned? |
Should be easiest and most flexible to use the buffer protocol, then |
This would be good but no progress has been made yet.
Yes, but no timeline yet. |
From the PR request thread... ble.gap_advertise(100,'Micropython') There needs to a helper API for constructing advertising packets. Most people are not familiar with the BLE spec. |
I've been poking around looking at Unix support for Bluetooth. The easiest strategy looks to be using DBUS. Bluez always builds with dbus support so there is no getting rid of it. Buildroot contains the package 'dbus-python', http://dbus.freedesktop.org/releases/dbus-python So can micropython access this package? If it can, then an approach like Adafruit used should work. https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/master/Adafruit_BluefruitLE/bluez_dbus/provider.py Does not appear to be simple to get dbus-python working in micropython. Maybe python expert can comment on best way to achieve this? Looks like an attempt to implement a moddbus.c is here.... |
See #5212 for a start on this. |
Thanks for looking into this, definitely a good thing to work on. If Bluez is the way to go, then there are probably a few ways to interface with it:
2 and 3 are basically the same, just 2 is implementing it in pure Python, 3 in C. |
One goal of mine is to have API compatibility between my desktop and target systems (ESP32, Unix) to facilitate a common development environment. Desktop is running bluez and lots of stuff depends on that, so I don't see any obvious way to avoid it. Another reason for keeping Bluez is if the target system is implementing Bluetooth audio. I have not used Python much, which is a better approach, ffi or C module? Has anyone already coded micropython DBUS support using ffi? What about running the micropython pre-processor over the libdbus header file? All of this Bluez, dbus, glib, etc support is fairly large so I could also see someone porting code over from a microcontroller to directly access the BLE device. But doing that will lose the ability to run other Linux apps. I'm sure there are boards around running Linux that only have BLE hardware with custom drivers and no BlueZ. Of course these variations will be hidden below the common API. |
currently i do some test on esp32-20191011-v1.11-422-g98c2eabaf.bin with an esp32-wroom.
|
Try to specify scan interval and window - using the same value will start continuous scanning, e.g.: |
I guess i have to wait the next available binary build because on g98c2eabaf tag i have this error calling gap_scan |
You can build the binary yourself: |
Another way to do Linux support is to access the functions via a socket like this code from the Bluez source illustrates, it is a test program. ./configure --enable-testing will build it. The test program creates a peripheral device that I was able to access on my phone. Edit -- I see now that these commands are all available in ASCII form from bluetoothctl as mentioned earlier. |
I have tryed but miserably failed. I have and windows with msys2, xtensia and was able to build lopy4 custom firmware, but when i try micropython build i run into a lot of trouble. CC ../../extmod/modbtree.c I have no idea to what i have to do for to correcting this, . |
The littlevgl port should work for esp32 and BT. Set it to use the IDF 4 commit tag it will list for you. It is working for me |
Is this a bug ??
|
That should be: |
Oops, that's embarrassing, sorrie about that |
New idea on how to do Unix support... How about writing a transport driver for the Nimble Host piece that calls the Linux kernel BT API? Both of these APIs are HCI based. The Linux side needs to go through the kernel so that it won't disrupt other uses of the adapter like Bluetooth Audio. I am not familiar enough yet with the two APIs to understand what is involved. Anyone have more experience in this area? One issue is that both stacks implement L2CAP. Edit: Nimble people informed me it has already been ported. Can one of the micropython nimble experts look into enabling this? The downside is that it has to have exclusive use of the bluetooth device. For my use case I also need bluetooth audio running so that means I have to keep working on a DBUS/glib solution. |
Yes, this would be a good solution because 1) it's the simplest way to get the
Right, so it might also be a good idea to provide a dbus/other solution as an alternative on Linux. |
Quick solution for desktop is to just plug in an extra USB BT adapter. BlueZ can have one and micropython development can use the other. |
Can you please add the ability to:
Many Thanks |
How to make the nRF52 board support the ubluetooth library? |
What about descriptors? Thx |
Is "Get the RSSI of a connected device" anywhere in the pipeline :-) |
Does pairing and bonding support also includes Passkey authorization? |
Is "Get the RSSI of a connected device" anywhere in the pipeline ?? This would be useful :-) |
Internally change the representation of UUIDs to LE uint8* to simplify this. This allows UUIDs to be easily used in BLE payloads (such as advertising). Ref: micropython#5186
Waiting for pairing & bonding support |
Internally change the representation of UUIDs to LE uint8* to simplify this. This allows UUIDs to be easily used in BLE payloads (such as advertising). Ref: micropython#5186
The bluetooth module is now supported on unix builds, via btstack. See 7563d58 |
According to NimBLE Host GAP Reference, I'm trying to add pairing & bonding function, and its worked for me, but there's no way to auto reconnect.... Still waiting and hoping for pairing & bonding support |
Updates on pairing & bonding support? |
bump @pairing/bonding |
@dmazzella @street-grease-coder This was implemented in #6662 and will be in the 1.14 release for STM32 (e.g. PYBD and WB55). However it's not supported on ESP32 due to the need for synchronous event handlers. Looking for a volunteer to sort out the necessary plumbing on ESP32. Se notes in #6594 and #6651 |
Is there any chance to get an event on completed advertisment transmission, that can be evaluated by the handler that has been passed to BLE.irq()? |
@kt-work I'm not sure whether this is supported by either NimBLE or BlueKitchen (or any HCI controller?)... can you provide a link to documentation for another BLE implementation that supports this and I can look into it. I'm guessing you're looking at implementing some sort of data-over-advertising (e.g. mesh?). I had a look at NimBLE's mesh implementation and it works by starting advertising and sleeping for a number of intervals (i.e. it will always send more than one beacon). |
Hi Jim,
I'm trying to introduce a sequence number into advertisements for an end of
line test.
In the past I did work on a meshing implementation based on a feature like
this. The device was a BCM20736. Broadcom/Cypress/Infineon provides an SDK
called WICED SDK that contains an application framework lets call it, that
supports a callback for finished advertisements.
It is quite possible that it will be impossible to implement if it is not
supported on the HCI layer of the STM32WB55.
I also considered starting advertising and stopping it to modify the next
advertisement. This might work if I can be certain that advertising starts
right after the call to start advertising or after a fixed amount of time.
If you could look into that it would help me too.
Best Regards,
Kilian Timmler
Am Mi., 24. Feb. 2021 um 04:25 Uhr schrieb Jim Mussared <
notifications@github.com>:
… Is there any chance to get an event on completed advertisment
transmission, that can be evaluated by the handler that has been passed to
BLE.irq()?
@kt-work <https://github.com/kt-work> I'm not sure whether this is
supported by either NimBLE or BlueKitchen (or any HCI controller?)... can
you provide a link to documentation for another BLE implementation that
supports this and I can look into it.
I'm guessing you're looking at implementing some sort of
data-over-advertising (e.g. mesh?). I had a look at NimBLE's mesh
implementation and it works by starting advertising and sleeping for a
number of intervals (i.e. it will always send more than one beacon).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5186 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOAX3XBQOXRHCV3APSZ74UDTARWTJANCNFSM4I52JO2A>
.
|
Hi! @jimmo, when can we expect to have bonding capabilities for the ESP32 port? Thanks! |
Hey, I don't think this is how open source works. They're already doing an amazing job. The way to accelerate this is by contributing, not by asking for deadlines that people can't keep because many are doing it in their free time and the process is usually nonlinear |
Hey yourself! Yes, That is why I supported @jimmo and started paying 3 days ago. Using micropython, asking questions in order to develop my knoledge further, even though I am very new in micropython and low-level stuff, and hopefully, in the near future, start contributing to this community as well. I am not pressuring anyone. As a matter of fact my question was just a question. You might have imprinted a tone that was not even there to begin with. I re-read my question 10 times, with an open mind, in case there was something I was not seing. It was just a request for information, as I know he is actively developing A LOT of things, for which I am very grateful. Not pressuring anyone here. I am not like that. Cheers, |
You should add how future readers can support Jimmo, I'd be in on that :) The rest is not my place to say - and further I'm also a newbie here |
We'd all love to see bonding-on-ESP32, of course – but there appear to be soft blockers in the ESP32 SDK API that sadly complicate this:
Ideally, Espressif themselves would either financially sponsor or supply in-house PR manpower for this community effort that economically benefits them. That isn't happening, so... here we are. Meanwhile, I'm just delighted that the workhorse AIOBLE framework continues to receive timely commits. Keep up all the incumbent greatness, @jimmo. You're a living embedded systems legend. |
NRF5x BLE support would be phenomenal as well. Indeed, this would probably make a great first issue for someone with enthusiasm! so, not me Why? Because Adafruit have already done the hard work by adding full support for BLE (including pairing and bonding, crucially) to CircuitPython's existing NRF5x port. Unsurprisingly, the So that's a mostly solved problem. Phew! 😅 |
@dpgeorge @jimmo any new about implementing BLE.config() to set ble txpower. on wemos c3 mini v1.0, ble was unuseable because of antenna/hardware design. The wifi part can be workaround using lower txpower. ble scan result comparison:
|
The text was updated successfully, but these errors were encountered: