【平头哥Sipeed LicheeRV 86开发板 试用】深度体验点亮LED 网络配置 音视功能 Debian镜像等功能
ti na Licheepi RV86系统体验
系统镜像下载
百度云下载的:
链接:
https://pan.baidu.com/s/1QJTaDw6kkTM4c_GAlmG0hg
提取码:wbef
烧录系统镜像
上述下载有工具PhoenixCard烧录系统镜像(tina_d1-nezha_uart0.img)到miniSD卡
打开烧录软件,选择启动卡(不知道哪里写的,我烧录量产是需要写NandFlahs才能启动,板子没有焊,所以启动不了,要迁启动卡)按顺序点击下图按键进行烧录对应镜像
点亮LED
当我们成功进入系统后,就可以进行基础的点灯操作啦!
(注:教程不适用于86-panel,因为对应引脚连接了外设,我们的Licheepi RV86panel用户可以拆下核心板来操作实验)
核心板的螺丝固定焊盘旁有一颗LED,查看原理图:
https://dl.sipeed.com/shareURL/L ... chee_RV/2_Schematic
可知该LED连接的是PC1,换算该IO的数字标号为:2*32+1=65,
拆下核心板后没有串口和网络,只能用ADB Shell(ADB 真心不好用,不能tab 回退)连接开发板,用命令
cat /sys/kernel/debug/pinctrl/2000000.pinctrl/pinmux-pins 复制代码
查看IO复用情况表:
...
pin 64 (PC0): device 2008000.ledc function ledc group PC0
pin 65 (PC1): UNCLAIMED
pin 66 (PC2): UNCLAIMED
pin 67 (PC3): UNCLAIMED
pin 68 (PC4): UNCLAIMED
pin 69 (PC5): UNCLAIMED
pin 70 (PC6): UNCLAIMED
pin 71 (PC7): UNCLAIMED 复制代码
导出GPIO65,并切换到GPIO65文件目录:
echo 65 > /sys/class/gpio/export
cd /sys/class/gpio/gpio65 复制代码
Linux下一切皆文件, 所以操作设备对应写文件即可,将该IO置为输出状态,即可操作其电平:
echo out>direction
echo 1 > value #LED点亮
echo 0 > value #LED熄灭 复制代码
其他小伙伴都成功在RISC-V 64 D1上点灯啦~
而我的板子有问题,没能点亮.怎么我的板子那么多问题呢?
用核心板 ADB可以使用adb进行文件传输,adb push/pull传文件但不方面, 下面体验外设,还是装回底板。
外设功能体验
USB功能 要用TPYE-C转USB-A,插上U盘
默认内核支持外挂U盘的驱动,插上U盘后可以使用 fdisk -l 查看到新增的 /dev/sda如果U盘没有被格式化,可以使用mkfs.vfat指令来格式化U盘,再使用mount指令挂载默认Tina固件里的 /dev/mmcblk0p8 分区即可使用上述方式格式化后挂载,来提升可用空间
下载是我们U盘内容了
root@MaixLinux:/mnt/exUDISK# cd /mnt/exUDISK/
root@MaixLinux:/mnt/exUDISK# ls
APK_TV DreamItPossible.mp4 ISO extra
Documents GHO System Volume Information sun.jpg 复制代码
复制到系统内(/tmp空间,到/root会满的):
root@MaixLinux:/mnt/exUDISK# cp DreamItPossible.mp4 sun.jpg /tmp
root@MaixLinux:/mnt/exUDISK# cd /tmp
root@MaixLinux:/tmp# ls
3D_earth.gif eleReport1.gif lock smart.gif wpa_ctrl_180-33
3car.gif empty log ssh-iCtbeOicfd wpa_ctrl_180-34
China_99B.mp4 extroot lushanpubu640.gif state yong.gif
DreamItPossible.mp4 girl.gif resolv.conf sun.jpg
Fourier_series_and_transform.gif girl1.gif resolv.conf.auto sun9.gif
booting_state lib run sysinfo
eleReport.gif localtime shm tmp 复制代码
看到已经到/tmp目录下了,等会体验多媒体功能会用到的, 这样传文件,要拔插U盘也不方面,最方面是用网络传文件。
下面我们来搞定网络吧
配置有线网络
LicheeRV-86 Panel 支持百兆网络,使用套餐附送的网线尾线接上网线后,执行以下指令来连接有线网络
ifconfig eth0 up
udhcpc -ieth0 复制代码
配置无线网络
LicheeRV86 底板默认使用XR829 wifi模块,可以使用以下指令进行联网操作:先配置热点信息:
vim /etc/wifi/wpa_supplicant.conf network={ ssid="Wifi ssid name" psk="password ****" }
配置完成后重启
ifconfig wlan0 up; udhcpc -iwlan0 复制代码
即可连上对应的wifi。
重启看到有线和无线都连接成功,其实有一个即可
root@MaixLinux:/tmp# ifconfig
eth0 Link encap:Ethernet HWaddr 9E:75:60:17:DA:4F
inet addr:192.168.0.73 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::9c75:60ff:fe17:da4f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:264 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24023 (23.4 KiB) TX bytes:4592 (4.4 KiB)
Interrupt:62
wlan0 Link encap:Ethernet HWaddr 08:BE:E0:98:24:70
inet addr:192.168.0.70 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::abe:e0ff:fe98:2470/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17857 errors:0 dropped:0 overruns:0 frame:0
TX packets:11370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22775139 (21.7 MiB) TX bytes:13022254 (12.4 MiB) 复制代码
连上网络后,就可以使用ssh远程登录板卡,或者使用scp来进行文件传输啦~
推荐此工具MobaXterm全带有串口终端 ssh scp sftp..........
使用ssh登录,要用户名密码为 root,tina
音频功能体验
传文件到开发板
注传到/tmp目录, /root目录 快满了
如传/root目录,可以会出错误
df命令查看便知:
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 99884 82196 10520 89% /
devtmpfs 247644 8 247636 0% /dev
tmpfs 251840 59576 192264 24% /tmp
/dev/mmcblk0p1 8151 677 7474 8% /mnt/SDCARD 复制代码
查看相关用法aplay
aplay -h
Usage: aplay [OPTION]... [FILE]...
-h, --help help
--version print current version
-l, --list-devices list all soundcards and digital audio devices
-L, --list-pcms list device names
-D, --device=NAME select PCM by name
-q, --quiet quiet mode
-t, --file-type TYPE file type (voc, wav, raw or au)
-c, --channels=# channels
-f, --format=FORMAT sample format (case insensitive)
-r, --rate=# sample rate
-d, --duration=# interrupt after # seconds
-M, --mmap mmap stream
-N, --nonblock nonblocking mode
-F, --period-time=# distance between interrupts is # microseconds
-B, --buffer-time=# buffer duration is # microseconds
--period-size=# distance between interrupts is # frames
--buffer-size=# buffer duration is # frames
-A, --avail-min=# min available space for wakeup is # microseconds
-R, --start-delay=# delay for automatic PCM start is # microseconds
(relative to buffer size if <= 0)
-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun
-v, --verbose show PCM structure and setup (accumulative)
-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)
-I, --separate-channels one file for each channel
-i, --interactive allow interactive operation from stdin
-m, --chmap=ch1,ch2,.. Give the channel map to override or follow
--disable-resample disable automatic rate resample
--disable-channels disable automatic channel conversions
--disable-format disable automatic format conversions
--disable-softvol disable software volume control (softvol)
--test-position test ring buffer position
--test-coef=# test coefficient for ring buffer position (default 8)
expression for validation is: coef * (buffer_size / 2)
--test-nowait do not wait for ring buffer - eats whole CPU
--max-file-time=# start another output file when the old file has recorded
for this many seconds
--process-id-file write the process ID here
--use-strftime apply the strftime facility to the output file name
--dump-hw-params dump hw_params of the device
--fatal-errors treat all errors as fatal
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE
U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE
FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE
MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE
S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24
G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE
DSD_U32_BE
Some of these may not be available on selected hardware
The available format shortcuts are:
-f cd (16 bit little endian, 44100, stereo)
-f cdr (16 bit big endian, 44100, stereo)
-f dat (16 bit little endian, 48000, stereo) 复制代码
播放设备查看
输入aplay -l 命令:
root@MaixLinux:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC 2030000.codec-0 []
Subdevices: 1/1
Subdevice 0: subdevice 0
card 2: sndhdmi [sndhdmi], device 0: 2034000.daudio-audiohdmi-dai 20340a4.hdmiaudio-0 []
Subdevices: 1/1
Subdevice 0: subdevice 0 复制代码
播放所有wav
输入aplay
aplay *wav
Playing WAVE 'CS2_AutoplayMusic.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
Playing WAVE 'Call.wav' : Signed 16 bit Little Endian, Rate 11025 Hz, Stereo
Playing WAVE 'CallThePolice.wav' : Signed 16 bit Little Endian, Rate 11025 Hz, Stereo
Playing WAVE 'CheckOut.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Playing WAVE 'Clear.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Warning: format is changed to U8
Playing WAVE 'Explosion.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Playing WAVE 'music.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Playing WAVE 'music_4mb.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Playing WAVE 'music_long.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo 复制代码
注:播放wav可以不加参数
播放raw文件
输入命令:
aplay -t raw -c 1 -f S16_LE -r 8000 *.raw
注:
-t: type raw表示是PCM
-c: channel 1
-f S16_LE: Signed 16bit-width Little-Endian
-r: sample rate 8000
PCM是最raw的音频数据,没有任何头信息。WAV文件就是PCM+头信息,头信息就是上述的声道数,sample rate这些。所以WAV文件可以直接播放,而PCM需要手动指定这些信息之后才能播放。
*****注意:aplay是不能解码mp3, 所以播放不了mp3, 播出来是杂声
录放音测试
查看arecord用法
arecord -h
Usage: arecord [OPTION]... [FILE]...
-h, --help help
--version print current version
-l, --list-devices list all soundcards and digital audio devices
-L, --list-pcms list device names
-D, --device=NAME select PCM by name
-q, --quiet quiet mode
-t, --file-type TYPE file type (voc, wav, raw or au)
-c, --channels=# channels
-f, --format=FORMAT sample format (case insensitive)
-r, --rate=# sample rate
-d, --duration=# interrupt after # seconds
-M, --mmap mmap stream
-N, --nonblock nonblocking mode
-F, --period-time=# distance between interrupts is # microseconds
-B, --buffer-time=# buffer duration is # microseconds
--period-size=# distance between interrupts is # frames
--buffer-size=# buffer duration is # frames
-A, --avail-min=# min available space for wakeup is # microseconds
-R, --start-delay=# delay for automatic PCM start is # microseconds
(relative to buffer size if <= 0)
-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun
-v, --verbose show PCM structure and setup (accumulative)
-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)
-I, --separate-channels one file for each channel
-i, --interactive allow interactive operation from stdin
-m, --chmap=ch1,ch2,.. Give the channel map to override or follow
--disable-resample disable automatic rate resample
--disable-channels disable automatic channel conversions
--disable-format disable automatic format conversions
--disable-softvol disable software volume control (softvol)
--test-position test ring buffer position
--test-coef=# test coefficient for ring buffer position (default 8)
expression for validation is: coef * (buffer_size / 2)
--test-nowait do not wait for ring buffer - eats whole CPU
--max-file-time=# start another output file when the old file has recorded
for this many seconds
--process-id-file write the process ID here
--use-strftime apply the strftime facility to the output file name
--dump-hw-params dump hw_params of the device
--fatal-errors treat all errors as fatal 复制代码
录音设备查看
root@MaixLinux:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC 2030000.codec-0 []
Subdevices: 1/1
Subdevice 0: subdevice 0
card 1: snddmic [snddmic], device 0: 2031000.dmic-dmic-hifi dmic-hifi-0 []
Subdevices: 1/1
Subdevice 0: subdevice 0
card 2: sndhdmi [sndhdmi], device 0: 2034000.daudio-audiohdmi-dai 20340a4.hdmiaudio-0 []
....
复制代码
录音命令
arecord -D hw:1,0 -f S16_LE -t wav -d 10 test_record.wav
复制代码
复制代码
注:
-D hw:1,0 录音设备
-f S16_LE 16位数据格式
-t wav 保存为wav 格式
-d 10 录音时长10s
test_record.wav 保存录音文件名
播放录音:
aplay -D hw:0,0 test_record.wav 复制代码
用alsamixer 进行音量调整
输入alsamixer命令
屏显触摸体验
LicheeRV系列支持以下显示屏:
SPI屏 1.14寸屏(TODO)RGB屏 4.3寸 480x272;5.0寸 800x480;RGB+SPI屏 4.0寸 480x480(st7701s); 4.0寸 720x720(nv3052c)MIPI屏 8.0寸 1280x720(ILI9881C)Tina下可以通过以下指令测试屏幕显示:fbviewer sun.jpg如果需要调试屏幕驱动,可以使用以下指令查看屏幕驱动信息:
cat /sys/class/disp/disp/attr/sys
screen 0:
de_rate 300000000 hz, ref_fps:60
mgr0: 480x480 fmt[rgb] cs[0x204] range[full] eotf[0x4] bits[8bits] err[0] force_sync[0] unblank direct_show[false] iommu[1]
dmabuf: cache[0] cache max[0] umap skip[0] overflow[0]
lcd output backlight( 50) fps:59.5 esd level(0) freq(60) pos(0) reset(0) 480x 480
err:0 skip:184 irq:230715 vsync:0 vsync_skip:0
BUF enable ch[1] lyr[0] z[16] prem[N] a[globl 255] fmt[ 0] fb[ 480, 480; 480, 480; 480, 480] crop[ 0, 0, 480, 480] frame[ 0, 0, 480, 480] addr[ffe00000, 复制代码
屏幕彩条测试:
echo 1 > /sys/class/disp/disp/attr/colorbar 复制代码
使用 ts_test进行触摸测试
root@MaixLinux:/tmp# ts_test
1646669267.385607: 479 375 0
1646669267.524434: 479 255 0
1646669267.559036: 479 255 0
1646669267.582170: 447 346 0
1646669267.593557: 447 346 0
1646669267.616763: 470 277 0
1646669267.628289: 468 283 0
...
复制代码
(注意触摸驱动有瑕疵,ts_test测试时松开后,光标会不动,但是终端仍会正常打印信息)
视频播放体验
最终我们可以尝试在LicheeRV上播放BadApple啦~Tina镜像中内置了ffmpeg软件包,ffmpeg是强大的多媒体库,可以用于录屏或者播放录屏指令:ffmpeg -f fbdev -framerate 10 -i /dev/fb0 record.avi
播放录频:
ffmpeg -i record.avi -pix_fmt bgra -f fbdev /dev/fb0 复制代码
播放指令(分别是扬声器播放音频和hdmi播放音频):
ffmpeg -i DreamItPossible.mp4 -pix_fmt bgra -f fbdev /dev/fb0 -f alsa hw:0,0
ffmpeg -i DreamItPossible.mp4 -pix_fmt bgra -f fbdev /dev/fb0 -f alsa hw:2,0 复制代码
这里由于是CPU软解,分辨率超400*400会变卡
Debian镜像体验
烧录LicheeRV_Debian_86_480p 为 480p的86盒板卡的debian镜像烧录完成后,插卡启动,稍等2分钟左右,屏幕上就会显示登录界面
输入用户名 sipeed,密码 licheepi,即可进入桌面 (使用USB HOST口外接键鼠输入,此操作相当不爽,我还是喜欢ssh)进入桌面后可以进行一些基础操作
连接Debian,默认是有线网络
无线网络开不起来,不知道 为什么,有知道的大神告诉一声:
sipeed@sipeed:~[ DISCUZ_CODE_2747 ]nbsp;ifconfig
eth0: flags=-28605 mtu 1500
inet 192.168.0.74 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::476:eeff:fe10:2e4e prefixlen 64 scopeid 0x20
ether 06:76:ee:10:2e:4e txqueuelen 1000 (Ethernet)
RX packets 1189 bytes 113529 (110.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1159 bytes 120178 (117.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 62
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 400 (400.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 400 (400.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sipeed@sipeed:~[ DISCUZ_CODE_2747 ]nbsp;sudo ifconfig wlan0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill 复制代码
可以使用apt安装程序,可惜没有RISV的源,愿以后会有吧
sipeed@sipeed:~[ DISCUZ_CODE_2748 ]nbsp;sudo apt install wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package wget is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'wget' has no installation candidate 复制代码
接下来让我们尝试在Debian下跑一下Hello World:
编译运行:
sipeed@sipeed:~[ DISCUZ_CODE_2749 ]nbsp;gcc -o hello hello.c
sipeed@sipeed:~[ DISCUZ_CODE_2749 ]nbsp;./hello
Hello RISc-V Licheepi RV 86!!!!!!
sipeed@sipeed:~$ 复制代码
本来想就这样开发的,不用PC交叉编译的,但大项目多线程编译不过, 有知道 大神告诉一声谢谢
sipeed@sipeed:~/c_code/tinyhttpd[ DISCUZ_CODE_2750 ]nbsp;make
gcc -W -Wall -lpthread -o httpd httpd.c
httpd.c:
In function ‘startup’:
httpd.c:450:52: warning: pointer targets in passing argument 3 of ‘getsockname’ differ in signedness [-Wpointer-sign]
450 | if (getsockname(httpd, (struct sockaddr *)&name, &namelen) == -1)
| ^~~~~~~~
| |
| int *
In file included from httpd.c:16:
/usr/include/riscv64-linux-gnu/sys/socket.h:117:26: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘int *’
117 | socklen_t *__restrict __len) __THROW;
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~
httpd.c: In function ‘main’:
httpd.c:504:24: warning: pointer targets in passing argument 3 of ‘accept’ differ in signedness [-Wpointer-sign]
504 | &client_name_len);
| ^~~~~~~~~~~~~~~~
| |
| int *
In file included from httpd.c:16:
/usr/include/riscv64-linux-gnu/sys/socket.h:233:28: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘int *’
233 | socklen_t *__restrict __addr_len);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
httpd.c:508:41: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types]
508 | if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
| ^~~~~~~~~~~~~~
| |
| void (*)(int)
In file included from httpd.c:25:
/usr/include/pthread.h:200:15: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(int)’
200 | void *(*__start_routine) (void *),
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
httpd.c:508:57: warning: passing argument 4 of ‘pthread_create’ makes pointer from integer without a cast [-Wint-conversion]
508 | if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
| ^~~~~~~~~~~
| |
| int
In file included from httpd.c:25:
/usr/include/pthread.h:201:24: note: expected ‘void * restrict’ but argument is of type ‘int’
201 | void *__restrict __arg) __THROWNL __nonnull ((1, 3));
| ~~~~~~~~~~~~~~~~~^~~~~
/usr/bin/ld: /tmp/cc2UBzan.o: in function `.L0 ':
httpd.c:(.text+0x1294): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make: *** [Makefile:5: httpd] Error 1 复制代码
1