Sunday, September 21, 2025

0

Bluetooth 6.0 on Raspberry Pi featuring LE Audio w/ Auracast

Summary:

In a previous blog post, I shared my experience integrating the Intel AX210 WiFi + Bluetooth module into my Raspberry Pi 5 to to experiment with the Bluetooth LE Audio feature. After that I started looking out for addiotnal Bluetooth modules supporting the latest Bluetooth standard, has Lnux support and can interface with the Raspberry Pi over USB or UART.

After doing some reasearch, I came accross the Infenion (CYW55513 CYW55573) chipsets, which according to their specs support Bluetooth 6.0 standards and are LE Audio capable. The CYW55573 in particular supports Auracast which is the next big thing in Bluetooth technology allowing audio sharing / broadcasting among LE Audio capable devices.

After deciding on the chipsets I wanted to use, I ordered them in the form of M.2 embedded modules and started the experiment journey. At the end, I was able to attach the Bluetooth module to the Pi via the dedicated UART interface and control it via BlueZ (Linux Bluetooth protocol stack). I ran some tests to check if the audio sharing is working using a Pixel 8 phone having latest version of Android supporting Auracast

Hardware Setup: 

The following components were used:

 Software Setup:

I flashed the latest Raspbian OS (12 bookworm) on the SD card of the Pi and enabled SSH for remote access. I updated the OS to the latest available software by running the following in the terminal:

  • sudo apt update

  • sudo apt upgrade 

The Linux kernel version used is 6.12.34+rpt-rpi-2712

To have LE Audio support, I installed the latest stable releases of BlueZ 5.83, Pipewire 1.4.6 and WirePlumber 0.5.10 directly from source.

Experimental features need to be enabled in BlueZ "main.conf" file by setting the following options:

  • ControllerMode = le # use low energy mode

  • Experimental = true # enable experimental features

  • KernelExperimental = 6fbaf188-05e0-496a-9885-d6ddfdb4e03e # enable ISO sockets

For WirePlumber, I created a configuration file: "~/.config/wireplumber/wireplumber.conf.d/80-bluez-properties.conf" according to the wiki documentation to set the Bluetooth audio profiles.

Afterwards a reboot of the Pi is required so changes would take effect.

Attaching Bluetooth over UART and flashing firmware:

Bluetooth module UART Interface:

I placed the IF573 M.2 module into the adapter board and referred to the uSD-M2 Adapter LBEE0ZZ1WE-uSD-M2 datasheet to locate the UART interface pins. Furthermore, I need one GND connection and the module could be powered from a 5V USB connection. 

After going through the data sheet, I learned that the UART interface is 4-wire type and so following singals are required for communication: TX, RX, RTS, CTS

The next step is to connect the M.2 adapter board to the Pi through the FTDI UART - USB adapter. One could perhaps connect directly to the UART interface on the Pi. However, you would need to reserve some GPIO pins on the Pi for that.

The connection singals would be as follows:

M.2 Adapter   <---->  FTDI USB adatper

RTS <----> CTS

CTS <----> RTS

TX <----> RX

RX <----> TX

GND <----> GND

Finally I connected the FTDI UART - USB adapter to the Pi via USB and also connected the M.2 adapter board via USB such that the IF573 module could be powered from 5V USB connection.

Flashing the Bluetooth firmware patch to the IF573:

Now that everything is connected, we still need to perform a very important step which is applying the required Bluetooth firmware for the controller so we can enable underlying functionality and also control the HCI interface via BlueZ. To save you sometime looking for the firmware files, you could find them avaialbe under this Github repo. Note that these may not be the latest firmware releases for the CYW55573 and perhaps one could refer to Infenion website to check for latest updates.

Anyway, I downladed the following package for the firmware files: summit-if573-pcie-firmware-12.103.0.5.tar.bz2 and since I am only interested in the Bluetooth functionality, I just needed to locate the .hcd patch file as shown below:

   

 

To apply the firmware patch file above to the device, it was not sufficent to use the btattach utility tool from BlueZ (the one usually used to attach Bluetooth devices over serial port). The CYW55573 according to its datasheet has some sort of secure upload mechanism where the chip needs to be placed in "autobaud" mode. You can read here for more details. Anyhow, What I had to do in the end is to do a reset for the Bluetooth core via a GPIO pin while the upload procedure is started. When the chip is out of reset, the firmware download into the chip RAM wokrs and the Bluetooth device is sucessfully connected and it is up and running !.

To apply the firmware patch, I used the following tool (brcm_patchram)  from Broadcom acquired later by Cypress and later on Infenion :). You simply need to trigger the executable as follows:

./brcm_patchram_plus --no2bytes --autobaud_mode --baudrate 115200 --use_baudrate_for_download --enable_hci --patchram /lib/firmware/cypress/CYW55560A1_v001.002.087.0225.0065.hcd /dev/ttyUSB0                                                             

After few seconds you should see the following in your terminal and you can confirm the Bluetooth device is connected and running via the "hciconfig" command as show below:

 

 

Testing of LE Audio & Auracast:

Now that the IF573 controller is up and running with BlueZ. I performed two experiments, one to check if we could stream audio from the Pi to a LE Audio capable headset and the second was to connect the Pi with an Android phone that supports Auracast audio sharing with the latest Android 16 update. Please note that in both scenraios, the main goal was to check if the interface is working and did not inveset much time looking into audio link quality and latency issues so do not expect something perfect =) 

Bluetooth LE Audio Unicast streaming to an audio headset:

I was able to pair and connect my LE Audio headset device to the Pi using CYW55573 chipset without probelms. After connection I see two LE Audio related endpoints are registerd which means they are also now recognised as media source/sink devices by wireplumber as shown below

Now when I start some audio play from the Pi, I see the related profiles being activated and they come back to idle when I pause / stop the stream so the interface seems to be working.  
 
If you look in parallel to the HCI logs using BlueZ btmon utility you will see alot of LE Audio data packets being sent as the stream is running.
 

Bluetooth LE Audio Sharing (Auracast) with Android phone:

In this test, I configured the Bluetooth controller (i.e CYW55573) to be discoverable and advertising so I could connect to it from my Pixel 8 phone and see if audio sharing is supported. I was able to see two settings enabled for my controller in BlueZ: (iso-broadcaster and sync-receiver)
 
Once the Pi is paired and connected with my Pixel 8 phone, I could see that it supports audio sharing !. Great now it seems I can share audio over Bluetooth using my Pi and Android phone :) 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 

Since audio sharing is now enabled. I can pair additional LE Audio devices to share ongoing audio stream from the phone. What I did here is to configure my Intel AX210 controller (also connected to the Pi via USB) to act as a peripheral via BlueZ and enabled discovery so it could be seen by the Pixel phone. Now when refreshing the audio sharing window on Android, I can add my Intel AX210 chip (advertising here under the name "LE_Audio"). 
Amazing!, Now I established a shared audio stream from Pixel phone to two Bluetooth devices running in parallel on the Pi.
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To check whether sharing is working, I played a test sound from Android as shown in the menu above and observed the playing status notifications in BlueZ for my two connected Bluetooth devices

 

Encountered Problems:

Currently the setup has couple of issues that require additional investigation / optimizations:

  • When attaching the IF573 module to the Pi over UART, it only connects when I set the baudrate to 115200. Given that the module supports high speed UART, I want to have a faster UART link. This becomes important also for audio applications, otherwise, the audio quality is really bad. 

  • When attempting to stream audio from Pixel phone to the Pi, the BlueZ stack notifies me that audio play has started. However, no audio is recieved on the Pi. I checked the HCI logs and it shows that the stream disconnect shorty after the play starts. This needs more investigation for sure.


Friday, September 5, 2025

1

Automating Power Supply Measurements with PyVisa & Pytest

Summary:

In this post, I share my experience with the automation of professional electronics lab equipment, in particular power supplies and source measure units. 

Such equipment is valuable for testing power managment features of IoT products in R&D environment. Example tests include: (power consumption measurements, battery charging and runtime tests, DC-DC converter effeciency, etc)

To boost the experience of using such equipment, I created a small Python library to automate most of their functions. Therfore, manual testing effort is reduced. At the same time, more complex testing scenarios could be run where multiple instruments are controlled via Python. 

In additon, mesurements could be plotted and documented in a nice form using Python Matplotlib, Numpy libraries.

Hardware: 

I had access to the following two instruments:

Keysight U3606B: Combination of a 5.5 digit digital multimeter and 30-W power supply in a single unit
Keysight U2723A: Modular source measure unit (SMU) Four-quadrant operation (± 120 mA/± 20 V)

Both have USB programming access and support SCPI standard, which means they could directly be detected and used via PyVisa given their required VISA drivers are installed. 

Now knowing that such equipment can be expensive and difficult to obtain, you can still refer to my other expierment post where I use more cheaper / student freindly kits.  

 Software:

For automating the functions of  the above instruments, I used Python for its simplicity, wide adoption in the industry for automation and I can directly start using its PyVisa library to control the instruments.

The next step was to create wrapper classes that implement the control and measurement functions for the instruments and test them. For that, I looked for their SCPI programming manuals that list all supported commands by the interface and their syntax. 

So it was just a matter of going through the manuals to get the required SCPI commands / queries for a given instrument function and then sending it over to the instrument using PyVisa write and query functions.

The last step was to craete pytest-fixtures that could be used for testing. The fixtures simplify the instruments configuration (i.e. setup and tear down) in testing context. 

For example, a common workflow that could be implemented as a fixture is to connect to a target power supply at the beginning of a test session, configure its output mode (constant voltage or constant current), set the output value and enable its output. The same fixture could reset the power supply configuration to a default state and disable its output at the end of a testing session. Thus, making the testing experience with the power supply really neat.

The result of all this work is packaged in my small Python library: pypm-test which includes the wrappers to control the above instruments, pytest fixtures and most important usage examples / tests

Example Measurement: 

DC-DC Conversion Test:

A classical example application with a power supply and source measure unit is to evaluate the efficiency of DC-DC conversion for a given system (e.g. IoT product powered via Li-ion battery and having a low power MCU that requires 1.2 V supply). 
 
In such scenario the power supply and source mesure unit are connected to the respecitve voltage rails. The source measure unit is used as an electronic load to simulate constant current loads at the output, while the power supply is used to supply a sweep of varying input voltages.
 
So this example becomes a nice candiate parameteric study for automation to see how does the output power compares to the input power (i.e. effeciency) at different inputs voltges / sink currents.
 
P.S: I had additionally an Analog Discovery 3 scope to capture any voltage oscillations on the input and output that might be interesting. Checkout my pytest-analog python library if you are interested in automating your Analog Discovery functions.
 

 

You can view the code behind this test directly from my repo here . An example result which could be generated from such a test is shown below:
 

Tuesday, August 5, 2025

0

Bluetooth LE Audio on Raspberry Pi with BlueZ

 Summary

In this post I share my experience testing LE Audio (next generation Bluetooth audio broadcasting) on Raspberry Pi 5 with an external Bluetooth module and utilizing recent developments in BlueZ (Linux Bluetooth stack) and PipeWire (Linux multimedia framework) which brings the support for LE Audio

Raspberry Pi  - LE Audio Experimental Setup 

  •  Hardware

For this experiment I aimed for the Raspberry Pi due to its low cost. In addition I can run Linux with BlueZ on it for free and do not have to buy any software. I had already a Raspberry Pi 5 lying around which has an on-board RF module supporting both Bluetooth Low Energy and Bluetooth Classic. However, it only supports Bluetooth 5.0 and hence LE Audio was not available.

Then the search process started for a RF module which supports LE Audio and could run on the Pi. I came accross an interesting post on PipeWire wiki page providing info on LE Audio support. There the Intel AX210 was mentioned as an example Bluetooth adapter supporting LE Audio.

By doing more research on the Intel AX210, I found out that someone on YouTube already tested the Wifi functionality of the same module on the Raspberry Pi and it worked with the latest Linux kernel.

This motivated me to purchase the Intel AX210 module (costed me around 35 Euros) integrate it into my Raspberry Pi 5 and try to get the Bluetooth functionality to work. 

In order to connect the new RF module, I had to get a special PCIe M.2 adapter which supplies the RF module with power from the Pi along with PCIe and USB connections so Wifi and Bluetooth would work.

  • Software 

After assembling the required hardware components it was time to start the Pi and install required drivers and software to test the Bluetooth functionality with the new RF module. First I flashed the latest Raspbian OS version on the SD card of the Pi and enabled SSH for remote access.

After logging in to the Pi via SSH. I made sure that I am on the latest stable kernel by upgrading to the latest software. so simply running in bash terminal:

  • sudo apt update
  • sudo apt upgrade

Following the update process, I checked whether the new Bluetooth module is recognized on the USB interface by running: lsusb command and I found it listed which indicate that my hardware setup is correctly connected.

 The next step then was to make sure the Bluetooth driver (firmware) is available for the module to run. This was a bit tricky as the Intel firmware files were not available on the Raspbian OS distribution and had to download them manually from the Linux kernel repository and copy them to the required location on the Pi. In short I had to perform the following steps:

  • Download the Intel firmware files named: ibt-0041-0041.sfi , ibt-0041-0041.ddc

  • Create a directory named "intel" inside the /lib/firmware folder on the Pi

  • Copy the above downloaded files to the respective directory: 

    • sudo cp ibt-0041-0041.sfi /lib/firmware/intel

    • sudo cp ibt-0041-0041.ddc /lib/firmware/intel

  • Restart the Pi: sudo reboot now

After reboot, the Intel AX210 Bluetooth adapter is up and running!.

We can confirm that using the following command and reading the adapter status: hciconfig -a

Now that the Intel AX210 Bluetooth adapter is running with the Pi, we still need to install the latest version of BlueZ , PipeWire , WirePlumber  and configure them to test the LE Audio functionality. 

To do that, I simply built and installed those libraries from source (latest stable releases). You can find the build instructions on the respective libraries github repositories. At the time of making this post. I used the following versions: BlueZ 5.83, Pipewire 1.4.6 and WirePlumber 0.5.10.

  • Configuration & Testing

Following the assembly of hardware and installation of required software components, I needed to do some configurations for BlueZ and Wireplumber so LE Audio streaming would work.

For BlueZ, the following options need to be set in the "/etc/bluetooth/main.conf" file:

  • ControllerMode = le # use low energy mode

  • Experimental = true # enable experimental features

  • KernelExperimental = 6fbaf188-05e0-496a-9885-d6ddfdb4e03e # enable ISO sockets

For WirePlumber, I created a configuration file: "~/.config/wireplumber/wireplumber.conf.d/80-bluez-properties.conf" according to the wiki documentation to set the Bluetooth audio profiles. For LE Audio streaming: bap_sink needs to be available.

After performing the above configurations, I restarted the Pi and began testing !. 

For testing my goal was to stream audio from the Pi to a headset device supporting LE Audio. 

To do so I had to pair and connect my headset to the Pi via bluetoothctl (BlueZ interactive command lines tool)

From the above logs, you could see that the device is successfully paired and connected. In addtion, the controller (i.e: Intel AX210 Bluetooth adapter) discovers the UUID service: Published Audio Capabilities (00001850-0000-1000-8000-00805f9b34fb) which means LE Audio is supported and recognized by BlueZ!

After connection is successful with the headset, I see the following endpoints are registered which indicate that BlueZ recognizes the headset as an audio source and sink simulatenously. I can also see the same thing when checking available audio devices in the system.

To test audio streaming to the headset, I simply played a wav file to the target node of the headset and observed the status info in BlueZ:

pw-play -v --target "bluez_output.DE_AD_BE_EE_EE_EF.1" path/to/wav/file.wav

 Great now my Raspberry Pi is successfully streaming LE Audio. Goal accomplished !

References

https://www.bluetooth.com/learn-about-bluetooth/feature-enhancements/le-audio/

https://www.analog.com/en/resources/design-notes/the-basics-of-bluetooth-le-audio.html 

https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/LE-Audio-+-LC3-support

https://www.intel.com/content/www/us/en/products/docs/wireless/wi-fi-6e-ax210-module-brief.html 

Saturday, August 2, 2025

0

pytest-analog a python plugin for electronics experiments and test automation

Introduction

pytest-analog is a python library / pytest plugin for simple experimentation with electronics and embedded systems.

It is also a great tool for low cost test automation of low power IOT devices.

The library provides an easy to use wrapping layer to perform mulitple measurement and testing workflows utilizing two multifunctional instruments:

Supported Workflows: 

  • Power measurements:

    • The ADALM1K two SMU channels (A, B), can power up your project and measure its power consumption simulatenously. the ADALM1K channels cuurent operation ranges from -200 to +200 mA. The voltage range operation is from 0 to 5 V 

    • The Analog Discovery Supplies channels (V+, V-) you can supply both positive and negative voltages with the range of (0.5 V to 5 V , -0.5 V to -5 V) . In the Analog Discovery 3, each supply raile can supply up to 800 mA

    •  Due to ADALM1K (2-quadrant) operation, its two SMU channels (A, B) could be used to source and sink currents ± 200 mA. This could particulaly be useful for testing batteries charge and discharge profiles and DC characterstics of a circuit

  • Analog Inputs / Outputs:

    • When configured in high impedance modes, ADALM1K analog channels (A, B) could be used to probe analog signals 

    • The Analog Discovery Supplies channels (V+, V-) you can supply both positive and negative voltages with the range of (0.5 V to 5 V , -0.5 V to -5 V) . In the Analog Discovery 3, each supply raile can supply up to 800 mA

    •  Due to ADALM1K (2-quadrant) operation, its two SMU channels (A, B) could be used to source and sink currents ± 200 mA. This could particularly be useful for testing batteries charge and discharge profiles and DC characteristics of a circuit

Example Setup with Raspberry Pi 5: 

To demonstrate a practical application of the pytest-analog plugin, I built a small test setup with the Raspberry Pi 5 acting as a low cost computer. 

Below is the list of used hardware and software components for reproducibility:

  • Hardware

  1. Raspberry Pi 5 Model as the test station mini PC 
  2. ADALM M1K Board as a mini power supply / source measure unit (SMU) 
  3. Analog Discovery 3 as a USB Oscilloscope, Waveform Generator, Logic Analyzer, and Variable Power Supply
  • Software 

    1.Raspbian OS: 12 (bookworm) 64 bit lightweight Linux distribution for ARM architecture

    2. Python: 3.11.2 Python interpreter which is shipped as part of Raspbian OS
    3. libsmu: 1.0.4 library and python bindings for ADALM1K SMU
    4. WaveForms: 3.23.4 GUI application for measurements with Analog Discovery devices
    5. Adept: 2.27.9  Runtime library for communication with Analog Discovery devices
    6. pytest-analog: 0.2.0  python library / pytest plugin for test automation with the above hardwae