• Disclaimer: This Vendor's Forum is a paid-for commercial area. Unlike the rest of diyAudio, the Vendor has complete control of what may or may not be posted in this forum. If you wish to discuss technical matters outside the bounds of what is permitted by the Vendor, please use the non-commercial areas of diyAudio to do so.

Support for Botic Linux driver

Member
Joined 2007
Paid Member
Sorry James, I am not able to help at this time. Coincidently, I’m working on a USB-fed Buffalo 3Pro project involving programming a custom RPi isolation board that will enable full I2C DAC control, signal mux, and player capability. The RPi control functions will operate simultaneously via either direct HTML web access or any tcp/udp remote control application. ... Plus, I’m only a ‘hobby programmer’... Whenthis job is done I have upgrade plans for theBBB system, but none of these g-streamer possibilities can be tried till then.
 
I'm using Beaglebone Green Wifi.
I installation the Debian 10 Buster Console, then patch the Botic 7. But Botic 7 are disable the Wifi Capes of BBGW. I using USB Wifi TP-Link external are normal.
Pls help me the turn on/enable the Wifi Capes on BBGW. Tks all.
 

Attachments

  • FB_IMG_1592977963451.jpg
    FB_IMG_1592977963451.jpg
    169.3 KB · Views: 462
  • FB_IMG_1592968911417.jpg
    FB_IMG_1592968911417.jpg
    55.7 KB · Views: 477
  • FB_IMG_1592968813291.jpg
    FB_IMG_1592968813291.jpg
    30.9 KB · Views: 447
Last edited:
Good news for those who would like to refresh their botic system.
coroner21 rewrote the original botic driver as a separate modules. Thank you coroner21.
Now you can build your kernel 5.4 Non RT (Real Time) or 5.4 RT and then build and install the botic module. I've been listening to 5.4 RT for a few days and it sounds good.:)
I promised to share my experience. Therefore, below is my short tutorial, which I divided into 3 stages:
  • A. Preparation of the newest minimal debian image.
  • B. Kernel build (Non RT or RT)
  • C. Botic modules build
Stage 2 is very time consuming (about 20 h), so the impatient users can use the RT kernel in the form of .deb files that I built. It will be valid for some time.
Just download the archive, extract the content and go to point B.8 and continue through stage C. Also those who would like keep existing system and only switch to a new kernel should start from B.8 and and finish on point C.8. (before install packages from A.7)
https://www.dropbox.com/s/03rh89bmhekpmlg/5.4.47_RTkernel.tgz?raw=1

A. Preparation of the newest minimal debian image.
Code:
#1. Download and extract the newest debian buster 10.4 image for beaglebone. 
#For BBB and SD card select 'bone-debian-10.4-console-armhf-2020-07-06-1gb.img.xz'.
[url=https://rcn-ee.com/rootfs/bb.org/testing/2020-07-06/buster-console/?C=S;O=D]Index of /rootfs/bb.org/testing/2020-07-06/buster-console[/url]
#When I'm writing this the newest image is from 2020-07-06. 
#Browse and change the path accordingly when you read this later and there are newer images:  [url=https://rcn-ee.com/rootfs/bb.org/testing/?C=M;O=D]Index of /rootfs/bb.org/testing[/url]
Select 'buster-console' directory and 'bone-debian-..-console-armhf' image

#2. Write downloaded image to the microSD card. Use for example Image writer/Win32 Disk Imager (when you use windows).

#3. Boot from the new image (when you earlier booted from eMMC remember to press onboard 'Boot button')

#4. When you plan to use SD card only (and no onboard eMMC storage) expand file system partition on a microSD (see instruction):
[url=https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Expanding_File_System_Partition_On_A_microSD]Beagleboard:BeagleBoneBlack Debian - eLinux.org[/url]

#5. When you plan using onboard eMMC storage flash eMMC (see instruction):
[url=https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC]Beagleboard:BeagleBoneBlack Debian - eLinux.org[/url]

#6. To run ‘sudo’ command without each time password confirmation for default 'debian' user change /etc/sudores (by using visudo). Add:
debian  ALL=(ALL) NOPASSWD:ALL
#line at the end of the edited file and save the file by pressing ctl+x and 'y' and enter
sudo visudo

#7. Install required debian packages:
sudo apt-get update
sudo apt-get install screen bison libssl-dev flex lzop git build-essential alsa-utils device-tree-compiler

B. Kernel build (Non RT or RT)
Code:
#1. Checkout Non-RT or RT  linux kernel source. Select one you prefer:
cd /opt
#for Non-RT
git clone -b 5.4 --depth 1 [url=https://github.com/beagleboard/linux.git]GitHub - beagleboard/linux: The official BeagleBoard and BeagleBone kernel repository[/url]
#or for RT
git clone -b 5.4-rt --depth 1 [url=https://github.com/beagleboard/linux.git]GitHub - beagleboard/linux: The official BeagleBoard and BeagleBone kernel repository[/url]

#2. Change directory and download configuration file:
cd linux
sudo wget -O '.config'  [url]https://www.dropbox.com/s/z2n0ps33sfrvpoz/.config?raw=1[/url]

#3. Build your own kernel (and headers) for beglebone in the form of .deb packages. 
#The kernel build process is very slow on BBB (take about 20h) so it will be better to do this in the background using screen (virtual console).
#You can detach from screen session with the combination of “Ctrl + a” followed by “d”. 
#To check build progress you should reattach to screen typing 'screen -r'
screen -S build
cd /opt/linux
sudo make bindeb-pkg

#4. At the beginning of the build process you can be asked a few configuration things. 
#In case of RT kernel and preemption model select the last option you can accept default values for the rest.
 
#5. When the build process is over leave screen session typing
exit

#6. Check the build products (.deb packages should be created in the parent directory) 
cd /opt
ls

#7.Remove kernel source directory:
sudo rm -r /opt/linux

#8. Install new headers and kernel. For example:
sudo dpkg -i linux-headers-5.4.47_5.4.47-1_armhf.deb
sudo dpkg -i linux-libc-dev_5.4.47-1_armhf.deb
sudo dpkg -i linux-image-5.4.47_5.4.47-1_armhf.deb

#9. Reboot
sudo reboot

C. Botic modules build.
Code:
#1. clone botic modules source for example to /opt directory:
cd /opt
sudo git clone -b 5.4 [url]https://github.com/coroner21/botic-modules.git[/url] 

#2. Create missing directories
sudo mkdir /lib/modules/$(uname -r)/extramodules
sudo mkdir /lib/modules/$(uname -r)/updates

#3. Edit /opt/botic-modules/Makefile to get used to commands: modules, modules_clean, modules_install, modules_uninstall, dtbs, dtbs_install, clean

#4. If you use other clocks than 49152000 and 45158400 you can edit botic-modules/dts/src/arm/BOTIC-00A0.dts and change frequencies accordingly. 
#(I'm not tested this since I'm using default 49.152/45.1584MHz clocks)

#5. Change directory, build botic modules and install
cd botic-modules
sudo make
sudo make modules_install

#6. Build and install dtbs
sudo make dtbs
sudo make dtbs_install

#7. Edit and complete /boot/uEnv.txt:
#comment:
enable_uboot_cape_universal=1
#line,
#Add following lines:
dtb_overlay=/usr/lib/firmware/BOTIC-00A0.dtbo
optargs=snd_soc_botic.dai_format=16385 snd_soc_botic.blr_ratio=64

#8. Reboot
sudo reboot

In new Botic only blr_ratio and dai_format are valid parameters.
Serconfig is always "MMMM" by default.
The clock frequencies are specified in the device tree overlay file. See point C.4
There is no longer shutdown-on-power-button-press-or-power-loss patch

Of course you should install favorite player software (e.g. MPD, squeezelite...)
Uff a lot of writing. Is enough. Enjoy!:)
 
Last edited by a moderator:
As for #3124 I forgot to add how to check the installation correctness.
So to check the kernel version use:
Code:
debian@beaglebone:~$ uname -a
Linux beaglebone 5.4.47 #1 SMP PREEMPT_RT Sun Jul 12 18:15:02 UTC 2020 armv7l GNU/Linux
and device output
Code:
debian@beaglebone:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Botic [Botic], device 0: external botic-hifi-0 [external botic-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
and installed botic modules:
Code:
debian@beaglebone:~$ lsmod | grep "snd"
snd_soc_botic          16384  1
snd_soc_davinci_mcasp    28672  2
snd_soc_ti_edma        16384  1 snd_soc_davinci_mcasp
snd_soc_botic_codec    16384  1
 
Dear bern,

I triend to install the RT kernel going through stage 2 completely ... started yesterday ;-)

I did this as I did not know where to get the by you created .deb packages.
For my convenience ... how can I get your .deb packages too ?

Thank you.

P.S. the versions of the .deb packes after my build are 5.4.52 ... not sure if using your .deb 5.4.47 later will create issues.

PS2: for testing i am not using external clocks ... so I need snd_soc_botic.ext_masterclk=0
I add this too to the optargs settings in /boot/uEnv.txt but it does not show this when I enter: grep . /sys/module/snd_soc_botic/parameters/* it does show the blr_ratio:64 and dai_format:16385 but not ext_masterclk=0
What I am doing wrong ?
 
Last edited:
P.S. the versions of the .deb packes after my build are 5.4.52 ... not sure if using your .deb 5.4.47 later will create issues.
You should use the newer version (if your kernel build was successful/without errors)
PS2: for testing i am not using external clocks ... so I need snd_soc_botic.ext_masterclk=0
I add this too to the optargs settings in /boot/uEnv.txt but it does not show this when I enter: grep . /sys/module/snd_soc_botic/parameters/* it does show the blr_ratio:64 and dai_format:16385 but not ext_masterclk=0
What I am doing wrong ?
I'm afraid that 'snd_soc_botic.ext_masterclk' is no longer valid and is fixed as external clocks for 44k1 and 48k.
 
Micro Linux - buildroot + kernel 4.9.146-Botic7-rt
http://puredsd.ru/botic7-image.gz or if the site is unavailable - MEGA

Contains:
  1. MPD 0.20.23 rt patch
  2. Aprenderer 2.02 (AlbumPlayer upnp renderer)
  3. Network Audio Adapter (HQPlayer Sygnalist)
  4. RoonBrige

Very small core, fast turn on, very many audio protocol.
Tks you ��
botic7-image_latest.gz https://puredsd.ru/botic7-image_latest.gz are problem with MPD(uPnP) can't selected now. Please repairs it.
Can you have add the Wifi Module for BBBW, BBGW, BBE or USB Wifi!?
 
Last edited:
You can get acquainted with the beta versions: Botic7 — Yandex.Disk

Description and changelog in Russian. But for the release, I will prepare documentation in English.
Temporarily support for this firmware on the Russian forum:
Сетевой плеер на Beaglebone Black — чистое удовольствие - Цифровые источники - DA Stereo

Can you have add the Wifi Module for BBBW, BBGW, BBE or USB Wifi!?
In the near future I will make partial support for WiFi USB.
 
Last edited:
Trouble Integrating Coroner21 Botic Driver in Yocto Linux Distro

I am developing a custom Yocto (Dunfell release) Linux distro for a BeagleBone Black (BBB) to capture/playback multi-channel audio (up to 16 channel, 32-bit samples) over the McASP0 interface of the BBB. It's based on TI's latest (stable) linux kernel (v 5.4.58) and the clock/data pins of the serializer are directly connected to an external DSP (e.g. there is no cape or on-board codec). I've chosen to do TDM8 on four serializer pins (2 TX, 2 RX). The default basic device tree (am335x-boneblack.dtb) it loaded by U-Boot and the BOTIC-00A0.dtbo overlay is successfully applied. Only a few minor changes were made to the overlay to support the increased channel count:

Code:
--- git.orig/dts/src/arm/BOTIC-00A0.dts
+++ git/dts/src/arm/BOTIC-00A0.dts
@@ -173,8 +173,10 @@
 			status = "okay";
 			pinctrl-0 = <&mcasp0_custom_pins>;
 			serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
-				1 1 1 1
+				1 2 1 2
 			>;
+            		op-mode = <0>;
+			tdm-slots = <8>;
 			tx-num-evt = <32>;
 			rx-num-evt = <32>;
 		};

Likewise botic-codec.c was modifified to accomodate the increased maximum channel count:

Code:
--- git.orig/codecs/botic-codec.c
+++ git/codecs/botic-codec.c
@@ -34,7 +34,7 @@ static struct snd_soc_dai_driver botic_c
     .name = BOTIC_CODEC_DAI_NAME,
     .playback = {
         .channels_min = 2,
-        .channels_max = 8,
+        .channels_max = 16,
         .rate_min = 22050,
         .rate_max = 384000,
         .rates = BOTIC_RATES,
@@ -42,7 +42,7 @@ static struct snd_soc_dai_driver botic_c
     },
     .capture = {
         .channels_min = 2,
-        .channels_max = 8,
+        .channels_max = 16,
         .rate_min = 22050,
         .rate_max = 384000,
         .rates = BOTIC_RATES,

The TI kernel defconfig was modified to suppress building the default (in-tree) McASP driver provided by the kernel and instead the one built by Coroner21's Botic driver was substituted. After bootup the modules are dynamically loaded and I see the following:

Code:
root@beaglebone:~# lsmod | grep snd
snd_soc_botic          16384  0
snd_soc_botic_codec    16384  1
snd_soc_davinci_mcasp    32768  1
snd_soc_ti_sdma        16384  1 snd_soc_davinci_mcasp

And dmesg does not report anything unusual:

Code:
root@beaglebone:~# dmesg | grep botic
[    4.315636] asoc-botic-card sound: GPIO lookup for consumer enable
[    4.315650] asoc-botic-card sound: using device tree for GPIO lookup
[    4.315733] asoc-botic-card sound: GPIO lookup for consumer dsd
[    4.315738] asoc-botic-card sound: using device tree for GPIO lookup
[    4.316193] asoc-botic-card sound: botic-hifi <-> 48038000.mcasp mapping ok
[    4.383833] asoc-botic-card sound: ASoC: no DMI vendor name!

Both arecord/aplay see the installed Botic card:

Code:
root@beaglebone:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Botic [Botic], device 0: external botic-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Unfortunately, all calls to open the card fail. Specifically this call
Code:
snd_pcm_open (&capture_handle, "hw:0,0", SND_PCM_STREAM_CAPTURE, 0))
fails with a code 34 (Invalid argument). This impacts all the ALSA utilities (aplay, arecord, alsacap), etc.. Digging deeper I ran arecord with strace and see the following:

Code:
. . .
openat(AT_FDCWD, "/dev/snd/controlC0", O_RDWR|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
ioctl(3, SNDRV_CTL_IOCTL_PVERSION, 0xbeb3702c) = 0
ioctl(3, SNDRV_CTL_IOCTL_CARD_INFO, 0xbeb3717c) = 0
close(3)                                = 0
openat(AT_FDCWD, "/dev/snd/controlC0", O_RDONLY|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
ioctl(3, SNDRV_CTL_IOCTL_CARD_INFO, 0xbeb37414) = 0
close(3)                                = 0
openat(AT_FDCWD, "/dev/snd/controlC0", O_RDWR|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
ioctl(3, SNDRV_CTL_IOCTL_PVERSION, 0xbeb375b4) = 0
ioctl(3, SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE, 0xbeb375f4) = 0
openat(AT_FDCWD, "/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EINVAL (Invalid argument)
close(3)                                = 0
write(2, "arecord: main:828: ", 19arecord: main:828: )     = 19
write(2, "audio open error: Invalid argume"..., 34audio open error: Invalid argument) = 34
write(2, "\n", 1
)                       = 1
exit_group(1)                           = ?

I am an ALSA noob but it looks like there is a issue with the ALSA mixer interface (/dev/snd/pcmC0D0c"). The path exists but any attempt to read it fails:

Code:
root@beaglebone:~# cat /dev/snd/pcmC0D0c 
cat: /dev/snd/pcmC0D0c: Invalid argument

My /etc/asound.conf is empty but I have (successfully) been able to connect USB headphones to the BeagleBone Black and run the ALSA speaker-test application. The audio sounded fine to I believe basic ALSA services must be configured correctly.

I'm hoping someone might take pity and offer either a reason why I'm seeing the error or a recommendation on how to troubleshoot this problem further. Am I attempting to do something the Coroner21 Botic driver does not support? Any guidance or assistance would be greatly appreciated.

Thanks . . .
 
First of all, since I am using my BBB only for audio playback, I have never tested capturing of audio. However, in general I see no reason why what you are trying to do should not work.
  1. Since this seems to be mixer related and since the botic-codec.c code seems to specify a Master Playback Volume but no capture volume control, it could be worth trying to simply adjust the specification of the volume controls and add another dummy capture control.
  2. I note that the TI kernel is heavily modified and my repo is pretty much based on linux mainline. It might also be some issue that the modified MCASP driver is not compatible with the TI kernel for some reason.

Note additionally the following: The MCASP driver supplied with the repo should not be needed as long as you do not want to playback / capture higher sample rates than 192khz or DSD.
 
I'm afraid that 'snd_soc_botic.ext_masterclk' is no longer valid and is fixed as external clocks for 44k1 and 48k.


Actually, using the existing 48k clock and only feeding 44k1 externally (with a switch) should still be feasible with some minor edits of the code and the DTS overlays. If there is sufficient interest and someone willing to test, I can try to put something together if I have some time.
 
First of all, since I am using my BBB only for audio playback, I have never tested capturing of audio. However, in general I see no reason why what you are trying to do should not work.
  1. Since this seems to be mixer related and since the botic-codec.c code seems to specify a Master Playback Volume but no capture volume control, it could be worth trying to simply adjust the specification of the volume controls and add another dummy capture control.
  2. I note that the TI kernel is heavily modified and my repo is pretty much based on linux mainline. It might also be some issue that the modified MCASP driver is not compatible with the TI kernel for some reason.

Note additionally the following: The MCASP driver supplied with the repo should not be needed as long as you do not want to playback / capture higher sample rates than 192khz or DSD.

I tried the ALSA speaker-test program (which should be playback only) and get the same error. From strace:

Code:
. . . 
ioctl(3, SNDRV_CTL_IOCTL_PVERSION, 0xbea6061c) = 0
ioctl(3, SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE, 0xbea6065c) = 0
openat(AT_FDCWD, "/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EINVAL (Invalid argument)
close(3)                                = 0
write(1, "Playback open error: -22,Invalid"..., 42Playback open error: -22,Invalid argument
) = 42

As you can see, it's trying to open the PCM playback stream (pcmC0D0p) so it must go deeper than just omitting a capture control.

Just to be clear, with the generic Botic codec driver, you are able to do simple
Code:
speaker-test
and
Code:
aplay
commands, correct?

I can try to use the default McASP platform driver and see if it makes a difference. I don't need DSD or higher rates . . . 48K is just fine. I'm just trying to use the TDM interface to pass arbritrary data - not necessary audio only but also telemetry. I'm just trying to leverage the high-speed serial interface and I hoped the Botic driver would provide me an easy way (with the ALSA APIs) to get at that data.

I'll investigate more. Let me know if you had any issues with
Code:
speaker-test
or
Code:
aplay
using the generic codec dirver.

Thanks for the help.
 
Just an update. As suggested, I used the default McASP platform driver that came with my TI kernel along with the Botic machine and codec drivers. I can now at least call arecord/aplay/speaker-test without getting the "Invalid argument" error.

Next, I intend to verify that I can playback/receive audio data through the driver. This will take a bit more work to make sure my hardware connections, clocks, etc... are working correctly. Baby steps . . . but at least I'm moving forward.

Thanks for the help up to this point . . .
 
aplay and speaker-test always work just fine for me also with the generic codec driver. I believe it is really using the TI kernel then which makes the MCASP code included in the repo not compatible anymore.


If you want to continue to use the TI kernel then that should be just fine, as long as you do not need higher sample rates or DSD.
 
Trouble Integrating Coroner21 Botic Driver in Yocto Linux Distro

aplay and speaker-test always work just fine for me also with the generic codec driver. I believe it is really using the TI kernel then which makes the MCASP code included in the repo not compatible anymore.


If you want to continue to use the TI kernel then that should be just fine, as long as you do not need higher sample rates or DSD.

I'm now trying to get my head wrapped around the internal/external clocking options that are supported by your Botic driver port. Looking at the card driver code and device tree ovelay (assuming I understand it correctly), it seems that it may only support external clock sources. Is this assumption correct? I ran aplay as described below

Code:
aplay -r 49000 -c 16 -f S32_LE -D "hw:0,0" sound_c16.wav

and hooked up a logic analyzer to P9.31 (BCLK), P9.29(FSYNC), and P9.25 (MCLK) looking for clock transitions but didn't see any. I'd expect to see some activity if the Beaglebone was the clock master - thus my assumption that the driver expects an external clock source.

In my use case, I'd like to be either a clock master or slave. For now I only need to support 44.1K and 48K rates. Is it possible to add a parameter to the card driver to allow clock master/slave to be configured from the command line like what is done with blr_ratio and dia_format? Would anything need to be modified in the device tree overlay to support such an option?

I'll investigate this but any help you could offer with regards to sketching out the necessary changes would be greatly appreciated. Of course if you see it as a worthy feature to support I would be happy to apply the patch.