Page 1 of 1

Bluetooth library for B_L475E_IOT01A1

Posted: Wed May 13, 2020 6:32 pm
by walecka
1) Is there a library that enables use of the stm32 B_L475E_IOT01A1's onboard SPBTLE-RF bluetooth module? I can see that there is a library in "Micropython-specific libraries" called ubluetooth that looks like exactly what I am after, but I am unable to import it onto my board from the REPL.
That leads me to my next two questions:

2) What does it mean to be "Micropython-specific" in this case? I am fairly sure that this does not designate the library as specific to a particular port (although some boards may have on board bluetooth libraries while most do not). Aren't all of the libraries in the micropython repo Micropython-specific?

3) In general, if I want to see the libraries available to my board/the port I am using, where should I look? For basic peripheral access, I know that I should use the general structure "from pyb import [I2C/SPI/etc...]", which loosely correspond to the C libraries found in the ports/stm32/ subdirectory (python implementation guides available online). If there are other libraries openly available, where should I look?

Re: Bluetooth library for B_L475E_IOT01A1

Posted: Thu May 14, 2020 7:35 pm
by patrickw
Hi Walecka,

I'll take a swing and let others correct me. I think you're struggling with some of the same base concepts I did when I got into MP a few months ago, so I'll be a little long-winded in the hopes it helps more than a yes\no.

Does Bluetooth work on your board?
If you type help("modules") into your REPL and you see ubluetooth then you can use that library. If not then it has not been ported to your specific chip\board. For libraries which make hardware services available to MicroPython they take new C code to make them available and show up as a library on your board. These come with the MP you flash onto your board. I could not find out the specifics for your board. But, I had to use nightly builds (unstable) to use Bluetooth on my ESP32 boards. I'm not even sure where your builds are posted, but try a nightly build. If you're not sure ask in the Other Boards forum, and be sure to read the pinned posts in that forum on how your should title your posts.

MicoPython Specific Libaries?
In the MP Docs they use this term "MicroPython-specific libraries". I think it would be better to say MicroPython framework or core libraries. These libraries are part of the core language.

Then there are port-specific libraries which are included in your MP firmware that enable you to use hardware on that board. uBluetooth would be port specific I guess because not all chips have bluetooth AND not all hardware manufactures would have the same interface for MP to expose to us in the ubluetooth library.

Then there are MicroPython Libraries from the community at-large. MicroPython is a subset of Python so in order for a library to work within MicroPython it has to live within those limits. I copy these libraries to my microcontroller (using rhsell, or Mu Editor) and then you import them as you would in Python. I've yet to find a Python library I could use in MicroPython.

I hope that helps!

Re: Bluetooth library for B_L475E_IOT01A1

Posted: Thu May 14, 2020 8:34 pm
by pagano.paganino
some time ago I wrote this library:

Hope this can Help!

Re: Bluetooth library for B_L475E_IOT01A1

Posted: Thu May 21, 2020 8:43 pm
by walecka
Sorry for the late reply. Thanks for the thoughtful response and awesome library. Both insanely helpful!