rsta2 / circle

A C++ bare metal environment for Raspberry Pi with USB (32 and 64 bit)
https://circle-rpi.readthedocs.io
GNU General Public License v3.0
1.86k stars 249 forks source link

Is there a plan to support Bluetooth? #203

Open tadli opened 3 years ago

tadli commented 3 years ago

Bluetooth can be used for sharing network, it would be cool to use Bluetooth function.

rsta2 commented 3 years ago

There was some rudimentary BT support in Circle earlier, but it was removed for legal reasons. In my opinion it is not possible to develop BT support, without being a member of the BT SIG (Special Interest Group). Please see issue #90 for a discussion on this.

rsta2 commented 3 years ago

I had an idea, that it may be possible to port an existing BT stack (e.g. BlueZ) to Circle. BlueZ is GPL licensed and perhaps may be ported without using the BT core specs, which is prohibited for non-BT-SIG-members.

Unfortunately I'm not familiar with BlueZ and I don't know, if it would provide all required functions, which one would need to use BT with Circle. In any way it's probably a big effort to port it.

tadli commented 3 years ago

Can I use bluetooth by just apt install bluez without porting bluetooth driver? I'm testing raspberry pi and I installed bluez directly to use bluetooth

tadli commented 3 years ago

To avoid Bluetooth membership fees, I thought maybe I could use AdHocWiFi, which can also share the network.

sebastienNEC commented 3 years ago

Just my 2 cents: it's relatively easy to port nimble (https://github.com/apache/mynewt-nimble) to circle. I've done it (in a hacky way but it works) and it's only a matter of modifying nimble_hci.cpp to use CBTUARTTransport and writing the OS abstraction layer nimble_npl_os.cpp

rsta2 commented 3 years ago

@tadli I don't think, that any available BT stack will run on Circle without porting it. Unfortunately I don't expect the Circle WLAN support to work in a wireless ad hoc scenario.

@sebastienNEC Thanks for the info about nimble! This is very interesting. I will have a look on it.

rsta2 commented 3 years ago

I had a look on NimBLE and currently I can connect a RPi 4B running the NimBLE bleprph application with my desktop PC. I used an USB BT dongle so far, not the internal BT device. Unfortunately this is only a quick porting hack and the way to some useful application and support for all internal BT devices of the different RPi models is probably long. I'm currently not sure, if it is worth going this way. NimBLE does support BLE (BT Low Energy) only, so it wouldn't help for standard BT (BR/EDR) applications. And I have no idea, for what this can be used in the end. Honestly I'm not very familiar with BT applications.

sebastienNEC commented 3 years ago

Hello Rene, sorry for the very late reply ! I am personally using (nim)BLE for wireless MIDI but I guess other use cases include wireless mice/keyboards ? And potentially quite a few IoT devices. I agree though that it might not be worth continuing in this direction if there is not a big demand. It might be enough to just document your early efforts in e.g. /doc/nimble-support.txt so that people in need of BLE don't need to start from scratch? Just a suggestion of course :)

rsta2 commented 3 years ago

No problem. I would be interested in using NimBLE to communicate between multiple devices (e.g. some RPis Zero W) in a mesh, like the microbit does in the image at the end of this tutorial. Unfortunately I do not know, how to implement this from the point of view of a NImBLE application. NimBLE provides many services for applications, but which have to be used?

This is really a hack so far, what I have done and describing it wouldn't help very much probably. But if there would be an interesting application, I would think about improving it.

probonopd commented 12 months ago

To avoid Bluetooth membership fees

Isn't Raspberry Pi Trading Ltd. paying those, and hence we are paying them by buying the devices?

rsta2 commented 12 months ago

No, any usage of the BT core spec is prohibited, if you are not a member of the BT SIG. I cannot talk about others, but by myself I won't use it.

A possibility would be to use open source source code, which is ready to be ported, so that one does not need to look into the specs. I tried this with NimBLE earlier, but realized, that most of the Raspberry Pis, that I have here, do not support the necessary version of BLE yet. Even my RPi 4B would not work with it. I have a RPi 400, which would work, probably because it uses a newer revision of the wireless chip.

But, this discussion is currently difficult, because I won't have enough time left to deal with BT. I'm currently very busy, especially with the RPi 5. There is lots to do for it.