1 1
FergusL

NanoHat PCM5102A for Nano Pi NEO Air

Recommended Posts

I received NanoPi NEO and NEO Air boards along with the NanoHat PCM5102a that FriendlyArm is selling: http://www.friendlyarm.com/index.php?route=product/product&product_id=169

It's a good quality audio stereo out addon board compatible with NEO and NEO Air.

 

I got it working with Armbian on NEO Air!

 

I adapted commits from FA's repo to match Armbian's tree and get that DAC working, (original commits here: https://github.com/friendlyarm/h3_lichee/search?utf8=%E2%9C%93&q=pcm5102a+&type=Commits). 

 

Add these to 'userpatches/kernel/sun8i-default`: https://gist.github.com/Simon-L/c8c119c86d7d3fe4316387c3ae818379

Add this config to 'userpatches' to have the driver built-in: https://gist.github.com/Simon-L/56bf6a3ec423e37973ee0da0bc16979f

Then run './compile.sh'

 

The fex file also needs to be modified, you can use this one: https://gist.github.com/Simon-L/f0c88190814f0f482773e81512e56553

 

This should be all that's needed!

Test it with 'aplay /usr/share/sounds/alsa/Noise.wav'

and install madplay if you want to try with mp3 files.

 

Can I safely share the content of the /boot folder and expect it to work for user copy-pasting it to the /boot folder on their sdcard? It has the kernel and the fex which are the only files the process has modified.

Obviously you'd still have to trust me :)

 

I'm trying to turn this into a more straightforward way. Do I need to commit to modify defconfig and .fex file or is it supported in userpatches/ folder as well?

 

There is one issue reported in syslog that doesn't seem to prevent it from working, here's the relevant part of the log:

[    1.598532] pcm5102a_probe
[    1.607823] asoc: snddaudio <-> pri_dai mapping ok
[    1.610531] ------------[ cut here ]------------
[    1.610583] WARNING: at fs/sysfs/dir.c:508 sysfs_add_one+0x8c/0xac()
[    1.610604] sysfs: cannot create duplicate filename '/devices/platform/snddaudio'
[    1.610625] Modules linked in:
[    1.610694] [<c0016a20>] (unwind_backtrace+0x0/0xe8) from [<c0617cc0>] (dump_stack+0x20/0x24)
[    1.610742] [<c0617cc0>] (dump_stack+0x20/0x24) from [<c0029750>] (warn_slowpath_common+0x5c/0x74)
[    1.610788] [<c0029750>] (warn_slowpath_common+0x5c/0x74) from [<c00297a8>] (warn_slowpath_fmt+0x40/0x48)
[    1.610833] [<c00297a8>] (warn_slowpath_fmt+0x40/0x48) from [<c017aab8>] (sysfs_add_one+0x8c/0xac)
[    1.610877] [<c017aab8>] (sysfs_add_one+0x8c/0xac) from [<c017acb8>] (create_dir+0x70/0xc4)
[    1.610917] [<c017acb8>] (create_dir+0x70/0xc4) from [<c017b0bc>] (sysfs_create_dir+0xc4/0xe4)
[    1.610965] [<c017b0bc>] (sysfs_create_dir+0xc4/0xe4) from [<c0306bf0>] (kobject_add_internal+0xdc/0x1d0)
[    1.611013] [<c0306bf0>] (kobject_add_internal+0xdc/0x1d0) from [<c0306ef8>] (kobject_add+0x78/0x90)
[    1.611064] [<c0306ef8>] (kobject_add+0x78/0x90) from [<c03b0078>] (device_add+0xf8/0x578)
[    1.611114] [<c03b0078>] (device_add+0xf8/0x578) from [<c03b4208>] (platform_device_add+0x110/0x16c)
[    1.611161] [<c03b4208>] (platform_device_add+0x110/0x16c) from [<c03b47a4>] (platform_device_register+0x30/0x34)
[    1.611214] [<c03b47a4>] (platform_device_register+0x30/0x34) from [<c08f6f94>] (sunxi_snddaudio0_init+0x54/0xa4)
[    1.611263] [<c08f6f94>] (sunxi_snddaudio0_init+0x54/0xa4) from [<c000867c>] (do_one_initcall+0xa8/0x164)
[    1.611313] [<c000867c>] (do_one_initcall+0xa8/0x164) from [<c08d1a74>] (kernel_init+0x168/0x254)
[    1.611364] [<c08d1a74>] (kernel_init+0x168/0x254) from [<c000f1b0>] (kernel_thread_exit+0x0/0x8)
[    1.611455] ---[ end trace bd16a9742f20e8dd ]---
[    1.611481] ------------[ cut here ]------------
[    1.611509] WARNING: at lib/kobject.c:198 kobject_add_internal+0x180/0x1d0()
[    1.611533] kobject_add_internal failed for snddaudio with -EEXIST, don't try to register things with the same name in the same directory.
[    1.611560] Modules linked in:
[    1.611601] [<c0016a20>] (unwind_backtrace+0x0/0xe8) from [<c0617cc0>] (dump_stack+0x20/0x24)
[    1.611644] [<c0617cc0>] (dump_stack+0x20/0x24) from [<c0029750>] (warn_slowpath_common+0x5c/0x74)
[    1.611686] [<c0029750>] (warn_slowpath_common+0x5c/0x74) from [<c00297a8>] (warn_slowpath_fmt+0x40/0x48)
[    1.611732] [<c00297a8>] (warn_slowpath_fmt+0x40/0x48) from [<c0306c94>] (kobject_add_internal+0x180/0x1d0)
[    1.611778] [<c0306c94>] (kobject_add_internal+0x180/0x1d0) from [<c0306ef8>] (kobject_add+0x78/0x90)
[    1.611825] [<c0306ef8>] (kobject_add+0x78/0x90) from [<c03b0078>] (device_add+0xf8/0x578)
[    1.611870] [<c03b0078>] (device_add+0xf8/0x578) from [<c03b4208>] (platform_device_add+0x110/0x16c)
[    1.611915] [<c03b4208>] (platform_device_add+0x110/0x16c) from [<c03b47a4>] (platform_device_register+0x30/0x34)
[    1.611962] [<c03b47a4>] (platform_device_register+0x30/0x34) from [<c08f6f94>] (sunxi_snddaudio0_init+0x54/0xa4)
[    1.612007] [<c08f6f94>] (sunxi_snddaudio0_init+0x54/0xa4) from [<c000867c>] (do_one_initcall+0xa8/0x164)
[    1.612052] [<c000867c>] (do_one_initcall+0xa8/0x164) from [<c08d1a74>] (kernel_init+0x168/0x254)
[    1.612098] [<c08d1a74>] (kernel_init+0x168/0x254) from [<c000f1b0>] (kernel_thread_exit+0x0/0x8)
[    1.612125] ---[ end trace bd16a9742f20e8de ]---

Any hint? The codec still works fine. There is no control in alsamixer.

 

Thanks to @tkaiser and @Igor for their help on IRC.

Share this post


Link to post
Share on other sites

IMO the best way would be to send a pull request with all your changes minus fex changes (since if I understand correctly then analog audio won't work any more?). Then this HAT would be supported out of the box with next kernel update and we just need a few bits of documentation how to modify fex?

Share this post


Link to post
Share on other sites

I just did this on a NanoPi NEO, there is no hardware control of the NanoDAC, however it worked out of the box with the fex changes listed in Da Alchemists Orange Pi thread.  I'm not sure what the warning above means, truthfully, in MPD using the software mixer appears to work just fine

 

I used Da Alchemist's OrangPi thread for my fex changes, and had all 3 audio devices available:

 

**** List of PLAYBACK Hardware Devices ****
card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

If I'm not mistaken, however, the NanoPi NEO Air has no analog line out built in, it was a casualty of the Wifi footprint.

Share this post


Link to post
Share on other sites

Aha!  I didn't see it hiding there!  I'll have to update my how-to.  Thank you for the heads up!  The audio from the built-in codec actually seems pretty decent, all things considered.  I'm tempted to build a tiny cMOY headphone amplifier to fit onto the thing.  The PCM5102A has been a pleasant surprise as well, given the price.

Share this post


Link to post
Share on other sites

Today I did get my PCM5102A Hat for the NanoPi Neo and edited the .fex of the legacy Armbian_5.35_Nanopineo_Debian_jessie_default_3.4.113

like in the following thread

 After bin2fex / editing / fex2bin & reboot I also got the additional soundcard:

 

card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
 

After that I created a /etc/asound.conf for the "card 1" and now its working fine with mpg123 and mplayer as Internetradio via Node-Red :)

But like the other users no volume-control :(

 

PS: The Hat ( http://www.friendlyarm.com/index.php?route=product/product&product_id=169&search=pcm&description=true&category_id=0&sub_category=true ) 
did come with the audio-cable :)

 

But this Hat does cover the serial-TTL-Debug-Port :(

 

NanoPi_Neo_PCM5102A_Hat_1.jpg

NanoPi_Neo_PCM5102A_Hat_2.jpg

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
1 1