Pisound on Tinker Board!

#1

Continuing the discussion from Pisound and Asus Tinker:

Hey guys, I got Pisound working with Tinker Board S, running 20181023-tinker-board-linaro-stretch-alip-v2.0.8.img image.

Pisound Module setup on Tinker Board

# Set up kernel sources so we can build the Pisound module, change 2.0.8 to the OS image version you're using.
sudo apt install libssl-dev
git clone --depth 1 -b 2.0.8 https://github.com/TinkerBoard/debian_kernel/ linux
cd linux
make ARCH=arm miniarm-rk3288_defconfig
make ARCH=arm modules_prepare
cd ..
sudo mv linux /usr/src/linux
sudo unlink /usr/src/linux /lib/modules/$(uname -r)/build
sudo unlink /usr/src/linux /lib/modules/$(uname -r)/source
sudo ln -s /usr/src/linux /lib/modules/$(uname -r)/build
sudo ln -s /usr/src/linux /lib/modules/$(uname -r)/source

# Download, build and install Pisound module and overlay
cd ~
git clone -b tinkerboard https://github.com/BlokasLabs/pisound
cd pisound/pisound-module
make ARCH=arm
ARCH=arm sudo -E make install

# Enable Pisound overlay
echo intf:dtoverlay=pisound | sudo tee -a /boot/hw_intf.conf

# Restart the system
sudo reboot

Afterwards, aplay -l, arecord -l and amidi -l should list Pisound, and it should be usable.

To disable Pisound, comment out or remove intf:dtoverlay=pisound line from /boot/hw_intf.conf

Please give it a go and let us know how it goes! If you confirm that it works well, we’ll go ahead and submit the code to Tinker Board’s Linux tree, so only enabling the Pisound overlay would be necessary.

Optional firmware upgrade to 1.02

I found a small issue with MIDI communication when Pisound is mounted on Tinker Board S, which did not occur with any of the Raspberry Pi’s, and a fix in the firmware was necessary to get it working well with the Tinker Board.

This update is not needed if you don’t use Pisound with Tinker Board. If you do upgrade, Pisounds running 1.02 firmware will continue to work with the Raspberry Pi boards.

The firmware upgrade must be performed using Raspberry Pi, as I was not able to get avrdude working on Tinker Board.

To do the upgrade, follow the instructions here: https://github.com/BlokasLabs/pisound-firmware

3 Likes

Pisound and Asus Tinker
Pisound Turns Two
#2

cool!

do you know if this is compatible with the original Tinkerboard?
… if you don’t I can give it a go.

does the image have pisound module setup already?
(so the module setup instructions are required for if im running an existing distro?)
so we just need to update the pisound firmware? (cool can do this before, taking it off the rPI :slight_smile: )

0 Likes

#3

Please give it a go. :slight_smile: I think that likely it will work, but let us know if you hit any issues along the way.

Pisound module is not integrated into Tinker Board’s OS images yet, but if your tests are successful, I’ll submit a pull request to integrate it.

Pisound will work on Tinker Board with 1.01 firmware too, the 1.02 fixes a MIDI reliability issue which didn’t occur on any of the Raspberry Pi boards.

0 Likes

#4

will do…
(just need to track down another microSD card, I seem to be going them at a fast rate these days :slight_smile: )

sorry, my mistake, I thought the mistakenly thought the img you posted was on your server, so was you build - cool, I’ll download that, and then follow your instructions.

firmware, cool, but given i have to pull the pisound of a rPI to test, I might as well update it first… if it works on the Tinkerboard , then I can order yet another PiSound (my 3rd!)

0 Likes

#5

Fantastic news!
It gives me hope that MODEP will be runnable on the Tinkerboard :slight_smile:

1 Like

#6

sorry @Giedrius only just around to this now… got sidetracked!

ok, instructions worked fine, except the unlink commands are wrong
they should be

sudo unlink /lib/modules/$(uname -r)/build
sudo unlink /lib/modules/$(uname -r)/source

it lists the devices fine.

linaro@tinkerboard:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: OnBoard [USB Audio OnBoard], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: OnBoard [USB Audio OnBoard], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: OnBoard [USB Audio OnBoard], device 2: USB Audio [USB Audio #2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: pisound [pisound], device 0: PS-39YDPH2 snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
linaro@tinkerboard:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: OnBoard [USB Audio OnBoard], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: OnBoard [USB Audio OnBoard], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: pisound [pisound], device 0: PS-39YDPH2 snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
linaro@tinkerboard:~$ amidi -l
Dir Device    Name
IO  hw:1,0    pisound MIDI PS-39YDPH2

but unfortunately, Im not getting any sound, and if I try to use the alsa device in Pure Data, it just tells me audio I/O is stuck, and closes

dmesg shows

[    9.064423] RTW: module init ret=0
[    9.072739] snd_soc_pisound: loading out-of-tree module taints kernel.
[    9.073562] rockchip-pinctrl pinctrl: unable to find group for node pisound_pins
[    9.073696] pisound: Searching for spi device...
[    9.073702] pisound: 	Found!
[    9.073731] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer reset
[    9.073737] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.073797] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/sound-ext-card[1]' - status (0)
[    9.073813] no flags found for reset
[    9.073820] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer data_available
[    9.073826] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.073853] of_get_named_gpiod_flags: parsed 'data_available-gpios' property of node '/sound-ext-card[0]' - status (0)
[    9.073864] no flags found for data_available
[    9.155749] pisound: Detected Pisound card:
[    9.155752] pisound: 	Serial:  PS-39YDPH2
[    9.155754] pisound: 	Version: 1.02
[    9.155756] pisound: 	Id:      1e93153555313630360a243e
[    9.155805] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer osr
[    9.155810] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.155901] of_get_named_gpiod_flags: parsed 'osr-gpios' property of node '/sound-ext-card[0]' - status (0)
[    9.155918] no flags found for osr
[    9.155924] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer osr
[    9.155929] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.155982] of_get_named_gpiod_flags: parsed 'osr-gpios' property of node '/sound-ext-card[1]' - status (0)
[    9.155992] no flags found for osr
[    9.155998] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer osr
[    9.156003] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.156071] of_get_named_gpiod_flags: parsed 'osr-gpios' property of node '/sound-ext-card[2]' - status (0)
[    9.156082] no flags found for osr
[    9.156088] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer reset
[    9.156092] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.156121] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/sound-ext-card[0]' - status (0)
[    9.156130] no flags found for reset
[    9.156136] snd-rpi-pisound sound-ext-card: GPIO lookup for consumer button
[    9.156141] snd-rpi-pisound sound-ext-card: using device tree for GPIO lookup
[    9.156170] of_get_named_gpiod_flags: parsed 'button-gpios' property of node '/sound-ext-card[0]' - status (0)
[    9.156179] no flags found for button
[    9.171224] snd-rpi-pisound sound-ext-card: snd-soc-dummy-dai <-> ff890000.i2s mapping ok

so it looks like its finding it but just not outputting audio…

similarly

linaro@tinkerboard:~$ aplay -Dhw:CARD=pisound,DEV=0 2015-05-13.wav 
Playing WAVE '2015-05-13.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

it says its playing but theres just nothing coming out :frowning:

its odd, no errors in dmesg etc when trying to play , just no audio…

thoughts?

Cheers
Mark


Notes:

  • this pisound was working on rPI before :slight_smile:
  • I have upgraded to fw 1.0.2
  • this is on an original Tinkerboard, not Tinkerboard-S
1 Like

#7

I think an unrelated issue, as i dont get it every time I boot but occasionally I see this

[ 9.078796] BUG: spinlock wrong CPU on CPU#2, systemd-udevd/251

[ 9.078896] lock: spilock+0x0/0xffffee88 [snd_soc_pisound], .magic: dead4ead, .owner: systemd-udevd/251, .owner_cpu: 3

[ 9.079026] CPU: 2 PID: 251 Comm: systemd-udevd Tainted: G O 4.4.132+ #1

[ 9.079117] Hardware name: Rockchip (Device Tree)

[ 9.079192] [&lt;c0110124&gt;] (unwind_backtrace) from [&lt;c010bddc&gt;] (show_stack+0x20/0x24)

[ 9.082226] [&lt;c010bddc&gt;] (show_stack) from [&lt;c050d04c&gt;] (dump_stack+0x84/0xa0)

[ 9.085264] [&lt;c050d04c&gt;] (dump_stack) from [&lt;c016f608&gt;] (spin_dump+0x8c/0xa0)

[ 9.088293] [&lt;c016f608&gt;] (spin_dump) from [&lt;c016f650&gt;] (spin_bug+0x34/0x38)

[ 9.091325] [&lt;c016f650&gt;] (spin_bug) from [&lt;c016f970&gt;] (do_raw_spin_unlock+0x9c/0xdc)

[ 9.094361] [&lt;c016f970&gt;] (do_raw_spin_unlock) from [&lt;c0c38374&gt;] (_raw_spin_unlock_irqrestore+0x1c/0x24)

[ 9.097450] [&lt;c0c38374&gt;] (_raw_spin_unlock_irqrestore) from [&lt;bf0004cc&gt;] (spi_transfer+0xd4/0x100 [snd_soc_pisound])

[ 9.100585] [&lt;bf0004cc&gt;] (spi_transfer [snd_soc_pisound]) from [&lt;bf000550&gt;] (spi_transfer16+0x58/0x70 [snd_soc_pisound])

[ 9.103785] [&lt;bf000550&gt;] (spi_transfer16 [snd_soc_pisound]) from [&lt;bf000984&gt;] (spi_read_info+0x44/0x19c [snd_soc_pisound])

[ 9.107005] [&lt;bf000984&gt;] (spi_read_info [snd_soc_pisound]) from [&lt;bf000ff0&gt;] (pisnd_probe+0x94/0x4c8 [snd_soc_pisound])

[ 9.110244] [&lt;bf000ff0&gt;] (pisnd_probe [snd_soc_pisound]) from [&lt;c064a87c&gt;] (platform_drv_probe+0x60/0xb0)

[ 9.113496] [&lt;c064a87c&gt;] (platform_drv_probe) from [&lt;c0648a08&gt;] (driver_probe_device+0x120/0x2a4)

[ 9.116780] [&lt;c0648a08&gt;] (driver_probe_device) from [&lt;c0648c04&gt;] (__driver_attach+0x78/0x9c)

[ 9.120081] [&lt;c0648c04&gt;] (__driver_attach) from [&lt;c0646f84&gt;] (bus_for_each_dev+0x7c/0xa0)

[ 9.123386] [&lt;c0646f84&gt;] (bus_for_each_dev) from [&lt;c0648518&gt;] (driver_attach+0x28/0x30)

[ 9.126688] [&lt;c0648518&gt;] (driver_attach) from [&lt;c06480a8&gt;] (bus_add_driver+0xe0/0x1f4)

[ 9.129982] [&lt;c06480a8&gt;] (bus_add_driver) from [&lt;c0649788&gt;] (driver_register+0xac/0xf0)

[ 9.133270] [&lt;c0649788&gt;] (driver_register) from [&lt;c064a7bc&gt;] (__platform_driver_register+0x40/0x54)

[ 9.136579] [&lt;c064a7bc&gt;] (__platform_driver_register) from [&lt;bf008018&gt;] (pisnd_driver_init+0x18/0x1000 [snd_soc_pisound])

[ 9.139933] [&lt;bf008018&gt;] (pisnd_driver_init [snd_soc_pisound]) from [&lt;c0101afc&gt;] (do_one_initcall+0x114/0x1c8)

[ 9.143312] [&lt;c0101afc&gt;] (do_one_initcall) from [&lt;c01ecd44&gt;] (do_init_module+0x6c/0x388)

[ 9.146718] [&lt;c01ecd44&gt;] (do_init_module) from [&lt;c01a473c&gt;] (load_module+0x18dc/0x1db4)

[ 9.150183] [&lt;c01a473c&gt;] (load_module) from [&lt;c01a4dd8&gt;] (SyS_finit_module+0x70/0x78)

[ 9.153652] [&lt;c01a4dd8&gt;] (SyS_finit_module) from [&lt;c0107760&gt;] (__sys_trace_return+0x0/0x10)

[ 9.167361
0 Likes

#8

I had a couple of these too, I think it’s the same issue as in MIDI CC overload? Pretty hard crash it seems, the same fix of replacing request_irq with request_threaded_irq should apply, I’ll get it out soon. It shouldn’t be impacting audio though.

I see that Tinker Board S has “enhanced I2S with Slave Mode” as one of advertised features. Pisound’s ADC is the I2S frame and bit clock master. Found one tidbit on Tinker Board on the net saying ‘there are 2 USB2 ports available on the SoC, however the dev team for this board decided to dedicate one to an “HD Audio codec” instead of using the dedicated I2S/PCM output to do that job.’. This could mean that indeed the original Tinker Board can only act as the I2S master, and it can’t be used with Pisound…

0 Likes

#9

Looking at Tinker Board schematics linked from here, I see direct connection of I2S capable pins from RK3288 to the 40 pin GPIO header at the right places.

So I’m not entirely sure why audio cards behaving as I2S master are declared as incompatible on the original Tinker Board, can’t find any technical details…

0 Likes

#10

sorry, im a bit confused by this :slight_smile: (which means Im struggling to thing what to check etc)

first, can you show me a dmesg from your tinker-s board, do you have these, warning about properties e.g.
[ 9.073562] rockchip-pinctrl pinctrl: unable to find group for node pisound_pins

or are you saying these are a result of the driver not loading due to be incompatible?
(seems an odd error, as the module does appear to be loaded, just not functioning)


onto the next part… im a bit confused about
are you saying that the pisound is required to be the I2S master, and so the Tinkerboard the slave.

presumably if thats the case, then no I2S masters can be used with a tinkerboard??!

0 Likes

#11

Here is the full dmesg log of booting up with Pisound, I do get the warnings - it seems the GPIO kernel module of Rockchip is a bit more verbose than Broadcom one, I think the messages printed are warnings.

This is confusing to me as well, I can find information on this without actual technical details on why I2S slave mode is not supported on original Tinker Board. This table is also not very re-assuring, every audio card listed there which has the host board in ‘slave’ mode has a comment saying ‘only support on Tinker Board S’, even though the hardware schematic shows correct connections of I2S pins…

I think the next steps would be to probe the I2S header pins with an oscilloscope, to see whether any data is being transferred.

0 Likes

#12

as you say, not a good sign…
also the fact that they pointed out an ‘enhanced slave mode’ in the new S ‘features’ indicates that something has been changed in hardware rater than software.

Ive got an analog discovery 2 which can logic probing, including i2s , but not sure what Id be looking for , or where :slight_smile:

hmm… I think Id have to have another play with the existing tinkerboard before id spring for a tinkerboard-s , its generally not been very well supported - and Im not sure Im getting that much more out of it than a rPI3+… that and all the discussions over at tinkerboarding about power and heat issues - is never very reassuring!

0 Likes

#13

Btw, the ‘slave’ and ‘master’ modes are selected by setting SND_SOC_DAIFMT_CBM_CFM or SND_SOC_DAIFMT_CBS_CFS in dai_fmt.

You may try switching to CBS_CFS, so that Tinker Board is then in master mode. There’s a chance that Pisound’s output would work - the DAC is in slave moved anyway, so if ADC, set in master mode, doesn’t interfere, then there might be some audio output…

The pins of interest are BCM 20, BCM 21, BCM 19 and BCM18, as shown on pinout.xyz, they should be at the same location of Tinker Board header. Seeing data flow through them would be a good sign :slight_smile:

0 Likes