• Getting Started
  • CTAG Face - speaker-test error - unable to set hw parms, no such device

Hi,

I change /etc/rc.local as following which is only one change switching it from default BEAST '16CH' to FACE '8CH'

root@beaglebone:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo 81 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio81/direction
echo 0 > /sys/class/gpio/gpio81/value
sleep 1
echo 1 > /sys/class/gpio/gpio81/value
sleep 1
echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots

exit 0

And then I reboot the system, after login as root, I perform ALSA test, but error is no such device.

root@beaglebone:~# speaker-test -D hw:0 -c 2 -r 48000 -t sine -f 1000

speaker-test 1.0.28

Playback device is hw:0
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 1000.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 256 to 32768
Period size range from 128 to 16384
Using max buffer size 32768
Periods = 4
Unable to set hw params for playback: No such device
Setting of hwparams failed: No such device



root@beaglebone:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Black [TI BeagleBone Black], device 0: davinci-mcasp.0-i2s-hifi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@beaglebone:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
DAC1
ADC1
DAC2
ADC2
DAC3
ADC3
DAC4
ADC4
DAC5
DAC6
DAC7
DAC8
dmixer
dsnooper
duplex
sysdefault:CARD=Black
    TI BeagleBone Black, 
    Default Audio Device
dmix:CARD=Black,DEV=0
    TI BeagleBone Black, 
    Direct sample mixing device
dsnoop:CARD=Black,DEV=0
    TI BeagleBone Black, 
    Direct sample snooping device
hw:CARD=Black,DEV=0
    TI BeagleBone Black, 
    Direct hardware device without any conversions
plughw:CARD=Black,DEV=0
    TI BeagleBone Black, 
    Hardware device with all software conversions

@henrix I also tried the following (failling):

$ aplay -D sysdefault:CARD=Black Untitled.wav
Playing WAVE 'Untitled.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1297: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 48000
PERIOD_TIME: 125000
PERIOD_SIZE: 6000
PERIOD_BYTES: 12000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 24000
BUFFER_BYTES: 48000
TICK_TIME: 0

or

$ ./scsynth_start.sh
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 75
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:0|hw:0|128|2|48000|4|8|nomon|swmeter|soft-mode|32bit
configuring for 48000Hz, period = 128 frames (2.7 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: cannot set channel count to 4 for capture
ALSA: cannot configure capture channel
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

or

$ ./alsaloop.sh
underrun for playback hw:0
underrun for playback hw:0
underrun for playback hw:0
underrun for playback hw:0

or

./jack_start.sh
debian@beaglebone:~$ jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 75
self-connect-mode is "Don't restrict self connect requests"
creating alsa driver ... hw:0|hw:0|128|2|48000|4|8|nomon|swmeter|soft-mode|32bit
configuring for 48000Hz, period = 128 frames (2.7 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: cannot set channel count to 4 for capture
ALSA: cannot configure capture channel
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

or

$ ./multichannel-delay.sh
snd_rawmidi_open hw:1 failed: -2
#### Soundcard info ####
Name:		hw:AudioCape Rev B,0
Inputs:		2
Outputs:	2
Samplerate:	48 kHz
Buffer size:	64 frames
Added Midi client. Queue size: 1
Added Midi client. Queue size: 2

Hi moseswong001,

It seems that the wrong drivers are loaded. The audio cards listed via aplay don't correspond to CTAG audio cards. Hence you get errors when playing audio.
Could you please comment the echo... line in /etc/rc.local and reboot the BeagleBone.
Please attach the output of aplay -l. Afterwards, manually load the driver with:
echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots
and attach the output here as well.
Furthermore, please attach the last lines of the kernel log, which correspond to the audio system (dmesg) and you uEnv.txt. Thanks.

  • Commented out the line from /etc/rc.local
  • _
    debian@beaglebone:~$ aplay -l
    aplay: device_list:268: no soundcards found...
    debian@beaglebone:~$ sudo su
    root@beaglebone:/home/debian# echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots
    root@beaglebone:/home/debian# dmesg
    ...
    [   99.392046] bone_capemgr bone_capemgr: part_number 'BB-CTAG-SW-8CH', version 'N/A'
    [   99.392133] bone_capemgr bone_capemgr: slot #4: override
    [   99.392176] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
    [   99.392225] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override Manuf,BB-CTAG-SW-8CH'
    [   99.429389] bone_capemgr bone_capemgr: slot #4: dtbo 'BB-CTAG-SW-8CH-00A0.dtbo' loaded; overlay id #0
    [   99.601595] snd_ctag_face_2_4 ocp:sound: using only one audio codec (no daisy chain).
    [   99.601686] snd_ctag_face_2_4 ocp:sound: mclk not found.
    [   99.601743] snd_ctag_face_2_4 ocp:sound: ASoC: CODEC DAI ad193x-hifi not registered
    [   99.609651] snd_ctag_face_2_4 ocp:sound: snd_soc_register_card failed (-517)
    [   99.731613] snd_ctag_face_2_4 ocp:sound: using only one audio codec (no daisy chain).
    [   99.731700] snd_ctag_face_2_4 ocp:sound: mclk not found.
    [   99.731904] davinci-mcasp 48038000.mcasp: Trying to bind component to card "CTAG face-2-4 8CH" but is already bound to card "AudioCape Rev B"
    [   99.744886] snd_ctag_face_2_4 ocp:sound: ASoC: failed to instantiate card -19
    [   99.782402] snd_ctag_face_2_4 ocp:sound: snd_soc_register_card failed (-19)
    root@beaglebone:/home/debian# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: B [AudioCape Rev B], device 0: davinci-mcasp.0-tlv320aic3x-hifi tlv320aic3x-hifi-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

The issue seems to be that the BB-AUDI overlay is loaded by default and this conflicts with it?
@henrix there is #disable_uboot_overlay_audio=1 in /boot/uEnv.txt

  1. commented the line 'echo...' from /etc/rc.local

the file /etc/rc.local now look like this

cat /etc/rc.local

#!/bin/sh -e
#

rc.local

#

This script is executed at the end of each multiuser runlevel.

Make sure that the script will "exit 0" on success or any other

value on error.

#

In order to enable or disable this script just change the execution

bits.

#

By default this script does nothing.

echo 81 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio81/direction
echo 0 > /sys/class/gpio/gpio81/value
sleep 1
echo 1 > /sys/class/gpio/gpio81/value
sleep 1

#echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots

exit 0

  1. reboot

  2. aplay -l output

aplay -l

* List of PLAYBACK Hardware Devices *
card 0: Black [TI BeagleBone Black], device 0: davinci-mcasp.0-i2s-hifi i2s-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

4.

echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots

It hang up there for more than 5 minutes, during which nothing shows up on screen

I try to see what is happening 'ps ax' show nothing special, 'top' is here

top - 18:20:12 up 11 min, 2 users, load average: 0.00, 0.22, 0.29
Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.7 us, 1.3 sy, 0.0 ni, 97.7 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st
KiB Mem: 499152 total, 134180 used, 364972 free, 11996 buffers
KiB Swap: 0 total, 0 used, 0 free. 51408 cached Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

2814 debian 20 0 4560 1768 1440 R 1.6 0.4 0:00.36 top

9 root 20 0 0 0 0 S 0.3 0.0 0:01.31 rcuc/0

76 root -51 0 0 0 0 S 0.3 0.0 0:00.12 irq/162-44e+
1681 www-data 20 0 228832 3296 1912 S 0.3 0.7 0:01.21 apache2

2782 root 20 0 0 0 0 S 0.3 0.0 0:00.99 kworker/0:1

5.

I restarted the device

6.

last part of dmesg

[ 49.208638] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[ 50.229932] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[ 50.295844] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[ 53.485034] ti_am3359-tscadc 44e0d000.tscadc: chan 0 step_avg truncating to 16
[ 53.485068] ti_am3359-tscadc 44e0d000.tscadc: chan 1 step_avg truncating to 16
[ 53.485078] ti_am3359-tscadc 44e0d000.tscadc: chan 2 step_avg truncating to 16
[ 53.485089] ti_am3359-tscadc 44e0d000.tscadc: chan 3 step_avg truncating to 16
[ 53.485098] ti_am3359-tscadc 44e0d000.tscadc: chan 4 step_avg truncating to 16
[ 53.485108] ti_am3359-tscadc 44e0d000.tscadc: chan 5 step_avg truncating to 16
[ 53.485117] ti_am3359-tscadc 44e0d000.tscadc: chan 6 step_avg truncating to 16
[ 54.318195] asoc-simple-card sound: i2s-hifi <-> 48038000.mcasp mapping ok

7.

/boot/uEnv.txt

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

#uname_r=4.4.62-ti-r99
uname_r=4.4.62+
#uuid=
dtb=am335x-bonegreen-ctag-face.dtb

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_uio (mainline kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks...
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768@60e

##Example v3.8.x
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=

##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
#cape_enable=bone_capemgr.enable_partno=

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

8.

I try again

echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots

still hang up

The wrong drivers are loaded.
The correct output should be something like:
* List of PLAYBACK Hardware Devices *
card 0: C16CH [CTAG face-2-4 16CH], device 0: TDM ad193x-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #

Are you using the recent SD card image of CTAG?
https://github.com/ctag-fh-kiel/bela-ctag/releases

Yes, we are using the image that was there until 2 days ago.

So, with the loading of the overlay commented out in /etc/rc.local, dmesg shows:

[   63.461939] asoc-simple-card sound: i2s-hifi <-> 48038000.mcasp mapping ok

then if you try to load the dtb manually:

# echo BB-CTAG-SW-8CH > /sys/devices/platform/bone_capemgr/slots

the command does not return, and you get the following in dmesg:

[  296.210569] bone_capemgr bone_capemgr: part_number 'BB-CTAG-SW-8CH', version 'N/A'
[  296.210624] bone_capemgr bone_capemgr: slot #4: override
[  296.210886] bone_capemgr bone_capemgr: slot #4: auto loading handled by U-Boot

so something hangs there. I guess some of the overlays loaded by uboot (those that are loaded automatically, unless you tell uEnv.txt not to do it) conflict with this one.

Workaround:

place the following file in/uEnv.txt:
(this - incidentally - also allows to boot from the SD card without pressing the USR button, when a Bela image is flashed on the eMMC).
Then the loading will work fine:

[   58.915180] bone_capemgr bone_capemgr: part_number 'BB-CTAG-SW-8CH', version 'N/A'
[   58.915265] bone_capemgr bone_capemgr: slot #4: override
[   58.915309] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
[   58.915357] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override Manuf,BB-CTAG-SW-8CH'
[   59.053079] bone_capemgr bone_capemgr: slot #4: dtbo 'BB-CTAG-SW-8CH-00A0.dtbo' loaded; overlay id #0
[   59.584700] snd_ctag_face_2_4 ocp:sound: using only one audio codec (no daisy chain).
[   59.584793] snd_ctag_face_2_4 ocp:sound: mclk not found.
[   59.584851] snd_ctag_face_2_4 ocp:sound: ASoC: CODEC DAI ad193x-hifi not registered
[   59.592868] snd_ctag_face_2_4 ocp:sound: snd_soc_register_card failed (-517)
[   59.695695] snd_ctag_face_2_4 ocp:sound: using only one audio codec (no daisy chain).
[   59.695791] snd_ctag_face_2_4 ocp:sound: mclk not found.
[   59.695850] snd_ctag_face_2_4 ocp:sound: ASoC: CODEC DAI ad193x-hifi not registered
[   59.703804] snd_ctag_face_2_4 ocp:sound: snd_soc_register_card failed (-517)
[   60.157446] snd_ctag_face_2_4 ocp:sound: using only one audio codec (no daisy chain).
[   60.157525] snd_ctag_face_2_4 ocp:sound: mclk not found.
[   60.163127] snd_ctag_face_2_4 ocp:sound: Using audio routing configuration from dt overlay.
[   60.163193] snd_ctag_face_2_4 ocp:sound: Using 8 TDM slots.
[   60.170472] snd_ctag_face_2_4 ocp:sound: ad193x-hifi <-> 48038000.mcasp mapping ok

and

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: C8CH [CTAG face-2-4 8CH], device 0: TDM ad193x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

and speaker-test -D hw:0 -c 2 -r 48000 -t sine -f 1000 works as expected.

henrix I've created a new SD card image based on the recent BeagleBone IoT image:
https://github.com/ctag-fh-kiel/bela-ctag/releases/tag/v0.1.2
Please follow the instructions as shown in release description.

Ok thanks that works. I'd still recommend placing the uEnv.txt above in /uEnv.txt so that it can boot from the SD card even if there is a Bela image on the eMMC. However I am not 100% sure what happens when there is a stock BB.org image on the eMMC.