BeaglePlay + BeagleConnect Freedom#
BeaglePlay and BeagleConnect Freedom are the first boards with the aim to provide seamless BeagleConnect™ Technology support over 6lowpan network which can have a range upto 1km. The support for mikroBUS add-on boards on BeagleConnect Freedom provide endless possibilties of peripherals. Let us go over some of the internal details that might be useful for developers who would like to get involved.
Architecture#
Note
This section assumes that you are familiar with terminology introduced in Overview.
BeaglePlay single-board computer contains 2 processors, an AM62x running Debian Linux and a CC1352P7 co-processor. The AM62x processor acts as the AP in Greybus architecture while CC1352P7 acts as the SVC. The sub-1 ghz networking present in CC1352P7 is used as transport. This means all greybus messages between AP and Node are routed through CC1352P7.
BeagleConnect Freedom serves as the Greybus module, running ZephyrRTOS. It has 2 mikroBUS ports which enables compatibility with over 1,000 mikroBUS add-on sensors, acutators, indicators and additional connectivity and storage options.
Here is a visual representation of the architecture:
Demo#
Important
The current setup is in heavy development. In case of any problems feel free to reach out to us at Discord or BeagleBoard Forum.
BeagleConnect™ Greybus demo using BeagleConnect™ Freedom and BeaglePlay
Here is a video of BeaglePlay + BeagleConnect Freedom in action:
Components Involved#
gb-beagleplay Linux Driver: Mainline Linux Kernel since v6.7.0
mikroBUS Linux Driver: Out of tree
greybus-node-firmware: Out of tree
greybus-host-firmware: Out of tree
Demo#
Using Pre-built Images#
The pre-built images for both BeaglePlay and BeagleConnect Freedom are available at here.
Build Images from Source#
Note
The following steps are for building the images from source. If you want to use pre-built images, you can skip this section.
Todo
Use upstream Zephyr. The current support in Zephyr upstream has some performance problems which are being worked on. For now, we are using a custom fork based on Zephyr v3.4
Setup Zephyr#
Note
Checkout Zephyr Getting Started Guide for more up to date instructions.
Install the required packages:
sudo apt install --no-install-recommends git cmake ninja-build gperf \ ccache dfu-util device-tree-compiler wget \ python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 python3-venv
Create a new virtual environment:
python3 -m venv ~/zephyrproject/.venv
Activate the virtual environment:
source ~/zephyrproject/.venv/bin/activate
Install west:
pip install west
Get the Zephyr source code:
west init -m https://openbeagle.org/ayush1325/zephyr.git --mr demo-new ~/zephyrproject cd ~/zephyrproject west update
Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west zephyr-export
Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip.
pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt
Download and verify the Zephyr SDK bundle:
cd ~/.local/opt wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5-1/zephyr-sdk-0.16.5-1_linux-x86_64.tar.xz wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5-1/sha256.sum | shasum --check --ignore-missing
Extract the Zephyr SDK bundle archive:
tar xf zephyr-sdk-0.16.5-1_linux-x86_64.tar.xz rm zephyr-sdk-0.16.5-1_linux-x86_64.tar.xz
Note
If trying to build on BeaglePlay, use zephyr-sdk-0.16.5-1_linux-aarch64_minimal.tar.xz instead of full Zephyr SDK.
Run the Zephyr SDK bundle setup script:
cd zephyr-sdk-0.16.5-1 ./setup.sh
Install udev rules, which allow you to flash most Zephyr boards as a regular user:
sudo cp ~/zephyr-sdk-0.16.5-1/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d sudo udevadm control --reload
Install cc1352-flasher
pip install cc1352-flasher
Build and Flash BeagleConnect Freedom#
Build Greybus for node
west build -b beagleconnect_freedom modules/greybus/samples/subsys/greybus/net/ -p -- -DOVERLAY_CONFIG=overlay-802154-subg.conf
Connect Beagleconnect Freedom and flash the firmware
west flash
Build and Flash BeaglePlay CC1352#
Build Greybus for host
west build -b beagleplay_cc1352 modules/greybus-host/ -p
Start BeaglePlay with bcfserial overlay. If you are using USB to UART cable to connect to BeaglePlay, you can select BeaglePlay eMMC disable BCFSERIAL option. Else run the following command and reboot.
sed -i '5d' /boot/firmware/extlinux/extlinux.conf sed -i '5idefault BeaglePlay eMMC disable BCFSERIAL' temp2
Copy compiled image to BeaglePlay:
scp build/zephyr/zephyr.bin debian@beagleplay.local:~/greybus/zephyr/zephyr.bin
Install cc1352-flasher on BeaglePlay
pip install cc1352-flasher
Flash the firmware
cc1352-flasher --play ~/greybus
Enable bcfserial overlay. (Skip this step if you used Uboot menu in step 2):
sed -i '5d' /boot/firmware/extlinux/extlinux.conf sed -i '5idefault BeaglePlay eMMC (default)' temp2
Blacklist bcfserial Linux driver. This is required only in 5.x kernels:
sed -i '28s/$/ modprobe.blacklist=mikrobus/' /boot/firmware/extlinux/extlinux.conf
Reboot
BeaglePlay Driver#
Note
This section is only required for 5.x kernels.
Clone the driver:
git clone https://git.beagleboard.org/gsoc/greybus/beagleplay-greybus-driver.git cd beagleplay-greybus-driver
Install kernel headers:
sudo apt install linux-headers-$(uname -r)
Build gb-beagleplay driver:
debian@BeaglePlay:~/beagleplay-greybus-driver$ make make -C /lib/modules/5.10.168-ti-arm64-r111/build M=/home/debian/beagleplay-greybus-driver modules make[1]: Entering directory '/usr/src/linux-headers-5.10.168-ti-arm64-r111' CC [M] /home/debian/beagleplay-greybus-driver/gb-beagleplay.o MODPOST /home/debian/beagleplay-greybus-driver/Module.symvers CC [M] /home/debian/beagleplay-greybus-driver/gb-beagleplay.mod.o LD [M] /home/debian/beagleplay-greybus-driver/gb-beagleplay.ko make[1]: Leaving directory '/usr/src/linux-headers-5.10.168-ti-arm64-r111'
Load the driver:
sudo insmod gb-beagleplay.ko
Check iio_info. Sensors from beagleconnect freedom should show up here:
debian@BeaglePlay:~$ iio_info Library version: 0.24 (git tag: v0.24) Compiled with backends: local xml ip usb IIO context created with local backend. Backend version: 0.24 (git tag: v0.24) Backend description string: Linux BeaglePlay 5.10.168-ti-arm64-r111 #1bullseye SMP Tue Sep 26 14:22:20 UTC 2023 aarch64 IIO context has 2 attributes: local,kernel: 5.10.168-ti-arm64-r111 uri: local: IIO context has 2 devices: iio:device0: adc102s051 2 channels found: voltage1: (input) 2 channel-specific attributes found: attr 0: raw value: 4068 attr 1: scale value: 0.805664062 voltage0: (input) 2 channel-specific attributes found: attr 0: raw value: 0 attr 1: scale value: 0.805664062 No trigger on this device iio:device1: hdc2010 3 channels found: temp: (input) 4 channel-specific attributes found: attr 0: offset value: -15887.515151 attr 1: peak_raw value: 28928 attr 2: raw value: 28990 attr 3: scale value: 2.517700195 humidityrelative: (input) 3 channel-specific attributes found: attr 0: peak_raw value: 43264 attr 1: raw value: 41892 attr 2: scale value: 1.525878906 current: (output) 2 channel-specific attributes found: attr 0: heater_raw value: 0 attr 1: heater_raw_available value: 0 1 No trigger on this device
Conclusion#
While BeagleConnect™ technology is still in development, we are excited to see the possibilities it brings to the table. We are continuously working on improving the technology and adding more features. Fee free to reach out to us at Discord or BeagleBoard Forum.