0

CPX and Wifi or BLE
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: CPX and Wifi or BLE

by l8throp on Thu Mar 18, 2021 12:52 am

The CircuitPython building for the CPX does not list "_bleio" as a built-in module (which is used by the adafruit_ble library) on the CircuitPython page for this board: https://circuitpython.org/board/circuit ... d_express/ (Compared to, as an example, the ItsyBitsy M4, which does list it)

As such, it seems like you'll likely need to build a custom build of CircuitPython, but I'm not sure if the SAMD21 on the CPX will be good at support it as other SAMD21 boards also lack it.

l8throp
 
Posts: 10
Joined: Wed Feb 20, 2013 4:54 pm

Re: CPX and Wifi or BLE

by lamachine on Fri Mar 19, 2021 6:54 pm

Same error here. When I run help("modules") the _bleio shows up in a feather nRF52840 but NOT in the Circuit Playground Express.

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: CPX and Wifi or BLE

by mikeysklar on Mon Mar 22, 2021 5:35 pm

Looking at the docs for adafruit_ble you might be out of luck. I know this library is looking for native BLE hardware on startup. There is an argument for a device to be specificed when initializing BLERadio(), but it still might not work on the SAMD21 hw.

https://github.com/adafruit/Adafruit_Ci ... __.py#L141

Code: Select all | TOGGLE FULL SIZE
class BLERadio:
    """
    BLERadio provides the interfaces for BLE advertising,
    scanning for advertisements, and connecting to peers. There may be
    multiple connections active at once.
    It uses this library's `Advertisement` classes and the `BLEConnection` class."""

    def __init__(self, adapter=None):
        """If no adapter is supplied, use the built-in `_bleio.adapter`.
        If no built-in adapter is available, raise `RuntimeError`.
        """
        if adapter is None and _bleio.adapter is None:
            raise RuntimeError("No adapter available")
        self._adapter = adapter or _bleio.adapter
        self._current_advertisement = None
        self._connection_cache = {}


The more elegant option would be of course to use the Bluefruit CPX.

https://www.adafruit.com/product/4333

mikeysklar
 
Posts: 4996
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.