[B-L475E-IOT01A] BLE support

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
rcanonico
Posts: 1
Joined: Sat Feb 06, 2021 10:35 am

[B-L475E-IOT01A] BLE support

Post by rcanonico » Sat Feb 06, 2021 12:08 pm

Hello all.
I succesfully managed to compile MicroPython v1.14 for the B-L475E-IOT01A ST board.
I transferred the firmware onto the board with openocd.
My objective is to use BLE on the board.
In the REPL, when I import ubluetooth I get:

Code: Select all

MicroPython v1.14-9-g9dedcf122 on 2021-02-06; B-L475E-IOT01A with STM32L475
Type "help()" for more information.
>>> import ubluetooth
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'ubluetooth'
>>> help("modules")
__main__          micropython       uasyncio/stream   urandom
_onewire          network           ubinascii         ure
_uasyncio         onewire           ucollections      uselect
builtins          pyb               uctypes           usocket
cmath             stm               uerrno            ustruct
dht               uarray            uhashlib          usys
framebuf          uasyncio/__init__ uheapq            utime
gc                uasyncio/core     uio               utimeq
lcd160cr          uasyncio/event    ujson             uzlib
lcd160cr_test     uasyncio/funcs    umachine
math              uasyncio/lock     uos
Plus any modules on the filesystem
>>> 
I wonder what is needed to use BLE on this board:
  • if it's a matter of transferring the wireless stack firmware to the device in the secure flash area
    as suggested for a different board here in the forum, or
  • the functionality may be obtained by communicating with the BLE module in the board by means of I2C as Vjmorrison has done here for reading 3D accelerometer and 3D gyroscope data from the LSM6DSL.
Any suggestion to understand the nature of the problem and the effort required to solve it would be very much appreciated.
Thanks in advance

User avatar
jimmo
Posts: 2244
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [B-L475E-IOT01A] BLE support

Post by jimmo » Mon Feb 08, 2021 6:50 am

The IOT01A board is a STM32L4 MCU with a separate SPBTLE-RF module on the same board. I don't know much about this module, but hopefully it functions as an HCI controller over a UART.

In order to enable ubluetooth, MicroPython needs to be configured with which UART to use for the HCI, and then it will enable the NimBLE stack and the ubluetooth bindings.

This is how it works on the pyboard-d for example (it's an STM32F7 MCU with an external BCM wifi/ble module).

See this thread for more info viewtopic.php?f=2&t=9478&p=53529

I'm unsure if perhaps this device might actually implement a host stack rather than being just the controller. In which case MicroPython will need a different implementation of ubluetooth that talks to whatever HCI commands the SPBTLE device requires (which will be higher-level things like GATT operations etc).
rcanonico wrote:
Sat Feb 06, 2021 12:08 pm
I wonder what is needed to use BLE on this board:
if it's a matter of transferring the wireless stack firmware to the device in the secure flash area
as suggested for a different board here in the forum, or
The first link is for the the WB55... this works a bit differently because the BLE controller shares the same package and the communication is done over IPCC rather than UART. Your module also might not require firmware to be loaded to it.
rcanonico wrote:
Sat Feb 06, 2021 12:08 pm
the functionality may be obtained by communicating with the BLE module in the board by means of I2C as Vjmorrison has done here for reading 3D accelerometer and 3D gyroscope data from the LSM6DSL.
Yep, just like this, except it's likely UART not I2C.

Post Reply