一直想自己动手做一套多房间音频组播系统,研发硬件产品得选择电子器件,而其中很重要的器件就是主控CPU。搜集了不少资料,最终选择全志R329,因为它内置双核A53作为Linux主控性能够强大,此外还集成专业音频处理核HiFi4 DSP(不需要额外硬件就能实现音响产品必须的调音量、调EQ等功能)以及AI核Zhouyi NPU(满足个性化语音控制等智能化需求)。
选好了主控,接下来该弄块电路板玩玩,最快捷的方式是买开发板。全志官方推出了R329 evb5开发板,板载WiFi模组、MIC阵列、喇叭接口,还几乎引出了所有IO,是我想要的。在全志官方淘宝店咨询了客服,没有现货,多问几次后给了我在线官方交流群号,让我找产品经理提购买需求,加群后成功买到开发板,还特意送了我一块。
开发板到手,按照官方指引测试了点灯、WiFi联网和录音与播放都正常。但我更关注WiFi和音频的性能:WiFi连接下的ping值和吞吐量,音频的声道数、采样率和采样精度。
1 WiFi性能测试
R329 evb5开发板、Dell Ubuntu笔记本和Lenovo win10一体机都通过无线连接到路由器,将Ubuntu作为对照组来评估R329开发板WiFi性能。为排除干扰因素保证测试准确性,路由器WAN口未上联到任何网络。
1.1 ping值测试
R329 evb5 ping路由器
root@TinaLinux:/# ping 192.168.2.1 -c 20
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=6.348 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=7.485 ms
64 bytes from 192.168.2.1: seq=2 ttl=64 time=6.894 ms
64 bytes from 192.168.2.1: seq=3 ttl=64 time=5.353 ms
64 bytes from 192.168.2.1: seq=4 ttl=64 time=8.104 ms
64 bytes from 192.168.2.1: seq=5 ttl=64 time=19.801 ms
64 bytes from 192.168.2.1: seq=6 ttl=64 time=7.150 ms
64 bytes from 192.168.2.1: seq=7 ttl=64 time=6.628 ms
64 bytes from 192.168.2.1: seq=8 ttl=64 time=7.348 ms
64 bytes from 192.168.2.1: seq=9 ttl=64 time=6.825 ms
64 bytes from 192.168.2.1: seq=10 ttl=64 time=7.057 ms
64 bytes from 192.168.2.1: seq=11 ttl=64 time=6.887 ms
64 bytes from 192.168.2.1: seq=12 ttl=64 time=7.128 ms
64 bytes from 192.168.2.1: seq=13 ttl=64 time=7.208 ms
64 bytes from 192.168.2.1: seq=14 ttl=64 time=7.008 ms
64 bytes from 192.168.2.1: seq=15 ttl=64 time=6.811 ms
64 bytes from 192.168.2.1: seq=16 ttl=64 time=2.825 ms
64 bytes from 192.168.2.1: seq=17 ttl=64 time=7.661 ms
64 bytes from 192.168.2.1: seq=18 ttl=64 time=8.144 ms
64 bytes from 192.168.2.1: seq=19 ttl=64 time=6.582 ms
--- 192.168.2.1 ping statistics ---
20 packets transmitted, 20 packets received, 0% packet loss
round-trip min/avg/max = 2.825/7.462/19.801 ms
Ubuntu ping路由器
gmei@dell:~$ ping 192.168.2.1 -c 20
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=3.59 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=3.46 ms
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=3.43 ms
64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=3.51 ms
64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=3.40 ms
64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=6.13 ms
64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=3.48 ms
64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=3.53 ms
64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=3.50 ms
64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=2.88 ms
64 bytes from 192.168.2.1: icmp_seq=11 ttl=64 time=2.90 ms
64 bytes from 192.168.2.1: icmp_seq=12 ttl=64 time=2.95 ms
64 bytes from 192.168.2.1: icmp_seq=13 ttl=64 time=3.64 ms
64 bytes from 192.168.2.1: icmp_seq=14 ttl=64 time=5.46 ms
64 bytes from 192.168.2.1: icmp_seq=15 ttl=64 time=3.92 ms
64 bytes from 192.168.2.1: icmp_seq=16 ttl=64 time=3.94 ms
64 bytes from 192.168.2.1: icmp_seq=17 ttl=64 time=3.68 ms
64 bytes from 192.168.2.1: icmp_seq=18 ttl=64 time=3.37 ms
64 bytes from 192.168.2.1: icmp_seq=19 ttl=64 time=3.19 ms
64 bytes from 192.168.2.1: icmp_seq=20 ttl=64 time=3.32 ms
--- 192.168.2.1 ping statistics ---
20 packets transmitted, 20 received, 0% packet loss, time 19031ms
rtt min/avg/max/mdev = 2.880/3.664/6.130/0.770 ms
结论:R329开发板ping值是Dell笔记本的2倍??
1.2 吞吐量测试
R329开发板作为服务端,win10台式机作为客户端。
TCP:
F:\sw\it\iperf-2.0.9-win64>iperf -c 192.168.2.31 -i 1 -t 30 -p 5001 -b 1000M
------------------------------------------------------------
Client connecting to 192.168.2.31, TCP port 5001
TCP window size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.2.11 port 65519 connected with 192.168.2.31 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 2.85 MBytes 23.9 Mbits/sec
[ 3] 1.0- 2.0 sec 2.97 MBytes 24.9 Mbits/sec
[ 3] 2.0- 3.0 sec 3.16 MBytes 26.5 Mbits/sec
[ 3] 3.0- 4.0 sec 1.70 MBytes 14.3 Mbits/sec
[ 3] 4.0- 5.0 sec 3.45 MBytes 29.0 Mbits/sec
[ 3] 5.0- 6.0 sec 2.10 MBytes 17.6 Mbits/sec
[ 3] 6.0- 7.0 sec 2.30 MBytes 19.3 Mbits/sec
[ 3] 7.0- 8.0 sec 2.68 MBytes 22.5 Mbits/sec
[ 3] 8.0- 9.0 sec 3.02 MBytes 25.3 Mbits/sec
[ 3] 9.0-10.0 sec 2.75 MBytes 23.1 Mbits/sec
[ 3] 10.0-11.0 sec 3.53 MBytes 29.6 Mbits/sec
[ 3] 11.0-12.0 sec 3.60 MBytes 30.2 Mbits/sec
[ 3] 12.0-13.0 sec 3.32 MBytes 27.8 Mbits/sec
[ 3] 13.0-14.0 sec 3.50 MBytes 29.4 Mbits/sec
[ 3] 14.0-15.0 sec 3.34 MBytes 28.1 Mbits/sec
[ 3] 15.0-16.0 sec 1.14 MBytes 9.53 Mbits/sec
[ 3] 16.0-17.0 sec 2.46 MBytes 20.7 Mbits/sec
[ 3] 17.0-18.0 sec 3.26 MBytes 27.3 Mbits/sec
[ 3] 18.0-19.0 sec 3.63 MBytes 30.5 Mbits/sec
[ 3] 19.0-20.0 sec 3.31 MBytes 27.8 Mbits/sec
[ 3] 20.0-21.0 sec 3.21 MBytes 26.9 Mbits/sec
[ 3] 21.0-22.0 sec 2.97 MBytes 24.9 Mbits/sec
[ 3] 22.0-23.0 sec 3.08 MBytes 25.9 Mbits/sec
[ 3] 23.0-24.0 sec 3.52 MBytes 29.6 Mbits/sec
[ 3] 24.0-25.0 sec 2.48 MBytes 20.8 Mbits/sec
[ 3] 25.0-26.0 sec 2.22 MBytes 18.6 Mbits/sec
[ 3] 26.0-27.0 sec 3.27 MBytes 27.4 Mbits/sec
[ 3] 27.0-28.0 sec 3.09 MBytes 25.9 Mbits/sec
[ 3] 28.0-29.0 sec 1.94 MBytes 16.3 Mbits/sec
[ 3] 29.0-30.0 sec 2.59 MBytes 21.7 Mbits/sec
[ 3] 0.0-30.0 sec 86.5 MBytes 24.2 Mbits/sec
F:\sw\it\iperf-2.0.9-win64>
UDP:
root@TinaLinux:/# iperf -u -s -i 1 -p 5001
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 224 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.2.31 port 5001 connected with 192.168.2.11 port 57044
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0- 1.0 sec 2.05 MBytes 17.2 Mbits/sec 1.282 ms 639/ 2104 (30%)
[ 3] 1.0- 2.0 sec 2.41 MBytes 20.2 Mbits/sec 1.165 ms 5324/ 7041 (76%)
[ 3] 2.0- 3.0 sec 2.15 MBytes 18.1 Mbits/sec 0.712 ms 3982/ 5518 (72%)
[ 3] 3.0- 4.0 sec 2.26 MBytes 19.0 Mbits/sec 0.928 ms 5366/ 6979 (77%)
[ 3] 4.0- 5.0 sec 2.26 MBytes 19.0 Mbits/sec 2.296 ms 4061/ 5674 (72%)
[ 3] 5.0- 6.0 sec 2.04 MBytes 17.1 Mbits/sec 1.324 ms 4636/ 6089 (76%)
[ 3] 6.0- 7.0 sec 2.29 MBytes 19.2 Mbits/sec 0.931 ms 5174/ 6807 (76%)
[ 3] 7.0- 8.0 sec 2.39 MBytes 20.0 Mbits/sec 1.682 ms 4343/ 6046 (72%)
[ 3] 8.0- 9.0 sec 1.96 MBytes 16.5 Mbits/sec 0.640 ms 3504/ 4903 (71%)
[ 3] 9.0-10.0 sec 2.60 MBytes 21.8 Mbits/sec 0.922 ms 4491/ 6345 (71%)
[ 3] 10.0-11.0 sec 2.55 MBytes 21.4 Mbits/sec 1.571 ms 2774/ 4592 (60%)
[ 3] 11.0-12.0 sec 2.04 MBytes 17.1 Mbits/sec 1.242 ms 2751/ 4209 (65%)
[ 3] 12.0-13.0 sec 2.21 MBytes 18.6 Mbits/sec 0.632 ms 5089/ 6668 (76%)
[ 3] 13.0-14.0 sec 2.32 MBytes 19.4 Mbits/sec 1.602 ms 4464/ 6116 (73%)
[ 3] 14.0-15.0 sec 2.35 MBytes 19.7 Mbits/sec 0.825 ms 4585/ 6263 (73%)
[ 3] 15.0-16.0 sec 2.37 MBytes 19.9 Mbits/sec 1.590 ms 4099/ 5790 (71%)
[ 3] 16.0-17.0 sec 2.19 MBytes 18.4 Mbits/sec 0.402 ms 3852/ 5417 (71%)
[ 3] 17.0-18.0 sec 2.54 MBytes 21.3 Mbits/sec 2.604 ms 3999/ 5811 (69%)
[ 3] 18.0-19.0 sec 2.09 MBytes 17.5 Mbits/sec 0.871 ms 3217/ 4705 (68%)
[ 3] 19.0-20.0 sec 1.85 MBytes 15.5 Mbits/sec 1.224 ms 4089/ 5409 (76%)
[ 3] 20.0-21.0 sec 2.58 MBytes 21.7 Mbits/sec 1.067 ms 5517/ 7360 (75%)
[ 3] 21.0-22.0 sec 2.43 MBytes 20.4 Mbits/sec 1.182 ms 3624/ 5359 (68%)
[ 3] 22.0-23.0 sec 2.35 MBytes 19.7 Mbits/sec 1.085 ms 4552/ 6227 (73%)
[ 3] 23.0-24.0 sec 2.37 MBytes 19.9 Mbits/sec 0.519 ms 3974/ 5662 (70%)
[ 3] 24.0-25.0 sec 2.30 MBytes 19.3 Mbits/sec 0.930 ms 4587/ 6229 (74%)
[ 3] 25.0-26.0 sec 2.36 MBytes 19.8 Mbits/sec 0.795 ms 4314/ 6000 (72%)
[ 3] 26.0-27.0 sec 2.36 MBytes 19.8 Mbits/sec 0.528 ms 4714/ 6394 (74%)
[ 3] 27.0-28.0 sec 2.41 MBytes 20.2 Mbits/sec 1.235 ms 3772/ 5489 (69%)
[ 3] 28.0-29.0 sec 2.30 MBytes 19.3 Mbits/sec 1.076 ms 4112/ 5751 (72%)
[ 3] 29.0-30.0 sec 2.48 MBytes 20.8 Mbits/sec 0.734 ms 4058/ 5824 (70%)
[ 3] 0.0-30.2 sec 70.3 MBytes 19.5 Mbits/sec 1.797 ms 2147257037/2147307148 (1e+02%)
root@TinaLinux:/#
Dell笔记本作为服务端,win10一体机作为客户端。
TCP:
F:\sw\it\iperf-2.0.9-win64>iperf -c 192.168.2.21 -i 1 -t 30 -p 5001 -b 1000M
......
[ 3] 0.0-30.0 sec 161 MBytes 45.0 Mbits/sec
F:\sw\it\iperf-2.0.9-win64>
UDP:
gmei@dell:~iperf -u -s -i 1 -p 5001
......
[ 3] 0.0-29.9 sec 196 MBytes 55.0 Mbits/sec 1.027 ms 977/140872 (0.69%)
gmei@dell:~$
win10一体机作为服务端,R329开发板作为客户端。
TCP:
root@TinaLinux:/# iperf -c 192.168.2.11 -i 1 -t 30 -p 5001 -b 1000M
......
[ 3] 0.0-30.0 sec 145 MBytes 40.6 Mbits/sec
root@TinaLinux:/#
UDP:
root@TinaLinux:/# iperf -u -c 192.168.2.11 -i 1 -t 30 -p 5001 -b 1000M
......
[ 3] 0.0-30.0 sec 165 MBytes 46.1 Mbits/sec
[ 3] Sent 117592 datagrams
root@TinaLinux:/#
win10一体机作为服务端,Dell笔记本开发板作为客户端。
TCP:
gmei@dell:~$ iperf -c 192.168.2.11 -i 1 -t 30 -p 5001 -b 1000M
......
[ 3] 0.0-30.0 sec 170 MBytes 47.6 Mbits/sec
gmei@dell:~$
UDP:
gmei@dell:~$ iperf -u -c 192.168.2.11 -i 1 -t 30 -p 5001 -b 1000M
......
[ 3] 0.0-30.0 sec 207 MBytes 57.9 Mbits/sec
[ 3] Sent 147853 datagrams
gmei@dell:~$
结论:作为服务端,R329吞吐量只有Dell笔记本的一半;作为客户端,R329吞吐量与Dell笔记本相当??
2 音频性能测试
利用Tina SDK自带的arecord测试R329开发板支持的声道数、采样率和采样精度。
是否支持192K采样率、24位采样精度?
root@TinaLinux:/# arecord -r 192000 -c 2 -f U24_LE -d 10 20211119.wav
[13449.631722] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_startup
[13449.639222] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_hw_params
[13449.646676] sunxi-internal-cpudai cpudai: ======== hw_params ========
[13449.653912] sunxi-internal-cpudai cpudai: pcm_params->format:2
[13449.660469] sunxi-internal-cpudai cpudai: pcm_params->channels:5
[13449.667220] sunxi-internal-cpudai cpudai: pcm_params->rate:16000
[13449.673980] sunxi-internal-cpudai cpudai: pcm_params->period_size:1024
[13449.681317] sunxi-internal-cpudai cpudai: pcm_params->periods:4
[13449.687972] sunxi-internal-cpudai cpudai: pcm_params->pcm_frames:1024
[13449.695212] sunxi-internal-cpudai cpudai: pcm_params->buffer_size:4096
[13449.702548] sunxi-internal-cpudai cpudai: ===========================
[13449.734939] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_params
Recording WAVE '20211119.wav' : Unsigned 24 bit Little Endian, Rate 192000 Hz, Stereo
arecord: begin_wave:2521: [13449.776745] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_free
Wave doesn't support U24_LE format...
[13449.911776] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_shutdown
root@TinaLinux:/#
不支持U24_LE,那支持哪几种格式?查代码,得到如下结果:
out/r329-evb5/compile_dir/target/alsa-utils-1.1.0/aplay/aplay.c
2505 switch ((unsigned long) hwparams.format) {
2506 case SND_PCM_FORMAT_U8:
2507 bits = 8;
2508 break;
2509 case SND_PCM_FORMAT_S16_LE:
2510 bits = 16;
2511 break;
2512 case SND_PCM_FORMAT_S32_LE:
2513 case SND_PCM_FORMAT_FLOAT_LE:
2514 bits = 32;
2515 break;
2516 case SND_PCM_FORMAT_S24_LE:
2517 case SND_PCM_FORMAT_S24_3LE:
2518 bits = 24;
2519 break;
2520 default:
2521 error(_("Wave doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
2522 prg_exit(EXIT_FAILURE);
2523 }
可知支持U8、S16_LE、S24_LE、S24_3LE、S32_LE,对应8位、16位、24位、32位采样精度。
root@TinaLinux:/# arecord -r 192000 -c 3 -f S32_LE -d 5 20211119.wav
[10023.671676] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_startup
[10023.679195] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_hw_params
[10023.686649] sunxi-internal-cpudai cpudai: ======== hw_params ========
[10023.693897] sunxi-internal-cpudai cpudai: pcm_params->format:2
[10023.700460] sunxi-internal-cpudai cpudai: pcm_params->channels:5
[10023.707213] sunxi-internal-cpudai cpudai: pcm_params->rate:16000
[10023.713970] sunxi-internal-cpudai cpudai: pcm_params->period_size:1024
[10023.721307] sunxi-internal-cpudai cpudai: pcm_params->periods:4
[10023.727961] sunxi-internal-cpudai cpudai: pcm_params->pcm_frames:1024
[10023.735207] sunxi-internal-cpudai cpudai: pcm_params->buffer_size:4096
[10023.742546] sunxi-internal-cpudai cpudai: ===========================
[10023.774954] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_params
Recording WAVE '20211119.wav' : Signed 32 bit Little Endian, Rate 192000 Hz, Channels 3
overrun!!! (at least 0.021 ms long)
overrun!!! (at least 0.021 ms long)
overrun!!! (at least 0.022 ms long)
overrun!!! (at least 0.021 ms long)
[10032.378621] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_free
[10032.431634] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_shutdown
root@TinaLinux:/#
提示缓冲区溢出,录制出来的音频文件听起来不连续,扩大alsa音频缓冲区即可解决问题。
root@TinaLinux:/# arecord -r 192000 -c 3 -f S32_LE --buffer-time 500000 -d 5 27.wav
[24079.831625] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_startup
[24079.839114] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_hw_params
[24079.846570] sunxi-internal-cpudai cpudai: ======== hw_params ========
[24079.853815] sunxi-internal-cpudai cpudai: pcm_params->format:2
[24079.860461] sunxi-internal-cpudai cpudai: pcm_params->channels:5
[24079.867219] sunxi-internal-cpudai cpudai: pcm_params->rate:16000
[24079.873972] sunxi-internal-cpudai cpudai: pcm_params->period_size:1024
[24079.881310] sunxi-internal-cpudai cpudai: pcm_params->periods:4
[24079.887965] sunxi-internal-cpudai cpudai: pcm_params->pcm_frames:1024
[24079.895202] sunxi-internal-cpudai cpudai: pcm_params->buffer_size:4096
[24079.902582] sunxi-internal-cpudai cpudai: ===========================
[24079.934899] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_params
Recording WAVE '27.wav' : Signed 32 bit Little Endian, Rate 192000 Hz, Channels 3
[24085.699938] sunxi-internal-cpudai cpudai: sunxi_hifi_pcm_hw_free
[24085.771732] sunxi-codec-machine sndcodec: sunxi_hifi_sndcodec_shutdown
root@TinaLinux:/#
声道数,由于板载三颗MIC,测试使用3声道,看资料可知最高支持8声道。
结论:开发板最高支持192KHz采样率、8声道、32位采样精度,满足超高清音频应用要求。
作者:yimu163com
原文:https://bbs.aw-ol.com/topic/678/