页次: 1
自己做了个V3S的开发板,现在慢慢研究一下软件,这两天调试好了音频功能,简单做了一些记录分享给需要的朋友。
下载alsa-lib和alsa-utils
https://www.alsa-project.org/main/index.php/Download
这里可以下载最新版本的alsa-lib和alsa-utils,我下载的都是1.2.8版的。
编译alsa-lib
tar xvf alsa-lib-1.2.8.tar.bz2
cd alsa-lib-1.2.8
配置生成Makefile
./configure --host=arm-linux-gnueabihf --prefix=/home/jinggx/V3S/audio/alsa-lib --enable-shared –with-configdir=/usr/share/alsa-arm
1. --host 指定编译器,这里指定为交叉编译器。
2. --prefix 指定编译后文件的安装路径,即make install安装的位置。安装后创建 的lib 和 include都是给ARM开发板用的,宿主机用不到,所以此目录可以指定在任意位置。
3. --with-configdir 指定 conf 文件的安装目录,该目录将会直接移植到你的ARM开发板系统中,并且复制到开发板系统中的目录位置必须与编译时指定的-with-configdir完全一致,这一点非常重要,绝对路径必须完全一致!
./configure 成功之后才可以make。如果要重新./configure,建议先删掉Makefile文件。我这个菜鸟重新./configure 的时候没有注意到命令窗口的错误提示,然后继续make,结果一直make最初生成的Makefile文件,然后我就很蒙圈为什么修改了./configure 一直不起作用?我太傻了!!
make
make install
make instal可能会不成功,我在网上搜索到了别人分享的经验:需要切换到root用户下执行才可以。
sudo su
make
make install
编译alsa-utils
tar xvf alsa-utils-1.2.8tar.bz2
cd alsa-utils-1.2.8
配置生成Makefile
./configure --host=arm-linux-gnueabihf --prefix=/home/jinggx/V3S/audio/alsa-utils --with-alsa-inc-prefix=/home/jinggx/V3S/audio/alsa-lib/include CFLAGS="-I/home/jinggx/V3S/audio/alsa-lib/include" LDFLAGS="-L/home/jinggx/V3S/audio/alsa-lib/lib -lasound" --disable-alsamixer --disable-xmlto
1. --host 指定编译器,与 alsa-lib 的配置选项相同
2. --prefix 指定编译后文件的安装路径,与 alsa-lib 的配置选项相同
3. --with-alsa-inc-prefix 指定头文件目录,因为 ./configure 程序会去该目录检查版本情况。如果不指定的话,则会直接去默认目录 ( 即宿主机对应的 alsalib 目录中寻找,因此可能会有错误
4. CFLAGS 用于编译时指定的编译选项,在这里要使用 alsa-lib 编译后生成的头文件,指定该头文件所在目录,-I与路径之间不能有空格
5. LDFLAGS 用于编译时指定连接库文件,在这里要使用 alsa-lib 编译生成的库文件, 指定该头文件所在目录,-L与路径之间不能有空格
与前面编译alsa-lib类似,应该还是必须在root用户下执行才可以
sudo su
make
make install
如果编译遇到如下问题
make[2]: Entering directory '/home/jinggx/V3S/audio/alsa-utils-1.2.8/alsaconf/po'
mv: cannot stat 't-ja.gmo': No such file or directory
make[2]: *** [Makefile:41: ja.gmo] Error 1
make[2]: Leaving directory '/home/jinggx/V3S/audio/alsa-utils-1.2.8/alsaconf/po'
make[1]: *** [Makefile:480: all-recursive] Error 1
make[1]: Leaving directory '/home/jinggx/V3S/audio/alsa-utils-1.2.8/alsaconf'
make: *** [Makefile:461: all-recursive] Error 1
需要安装gettext
sudo apt install gettext
再次执行./configure ,然后再次编译即可。
lib 和 utils 安装到开发板
1. 把编译alsa-lib安装在$(--prefix)/lib目录中的libasound.la libasound.so libasound.so.2 libasound.so.2.0.0 拷贝到开发板上的/lib目录
2. 把编译alsa-lib时$(–with-configdir)整个目录拷贝到开发板上同样的位置,如果开发板上不存一样的目录则新建,必须保证编译时的$(–with-configdir)与开发板上的路径完全一致
3. 把编译alsa-utils安装在$(--prefix)/bin和$(--prefix)/sbin目录中生成的可以执行文件复制到开发板,我这里用到的文件只有aplay, amixer这2个,amixer用于设置声卡,aplay用于播放测试。aplay复制到开发板的/bin目录;amixer复制到开发板的/sbin目录,测试中发现amixer放在开发板的/bin目录不能运行,不知何故
测试
在开发板终端上ls -l /dev/snd查看,必须保证 /dev/snd/ 目录中应包含以下几个设备文件:
controlC0, pcmC0D0c, pcmC0D0p, timer
开机后默认状态是静音状态,需要取消掉静音状态
amixer -c 0 sset 'Headphone',0 100% unmute
切换到存放音频文件目录下
aplay xxx.wav
耳机连接到开发板的音频输出口,应该可以听到音乐声了。
使用alsa-lib编写应用程序
我自己写的简单wav文件播放代码
#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#define FRAMES_PLAYBACK 1024 // define how many frames write to snd device at a time,
// 1 FRAME = 1 block_align
typedef struct _wave_header {
uint8_t chunk_id[4]; // signature "RIFF"
uint32_t chunk_size; // size of next address to file end,
uint8_t format[4]; // signature "WAVE"
uint8_t sub_chunk1_id[4]; // signature "fmt "
uint32_t sub_chunk1_size; // size of sub chunk1 (it seems always 0x00000010)
uint16_t audio_format; // 0x0001 is PCM code
uint16_t num_channels; // audio channels
uint32_t sample_rate; // sample frequence
uint32_t byte_rate; // byte rate pes second
uint16_t block_align; // sample align bytes, 1 block_align = 1 FRAME
uint16_t bits_per_sample; // bits per sample
uint8_t sub_chunk2_id[4]; // signature "data"
uint32_t sub_chunk2_size; // wave samples size
} wave_header_t;
static void wav_info_dump(wave_header_t* wav_header)
{
printf("wave header:\n");
printf("chunk id = %c%c%c%c\n",
wav_header->chunk_id[0],wav_header->chunk_id[1],
wav_header->chunk_id[2],wav_header->chunk_id[3]);
printf("format = %c%c%c%c\n",
wav_header->format[0],wav_header->format[1],
wav_header->format[2],wav_header->format[3]);
printf("channels = %d\n",wav_header->num_channels);
printf("sample rate = %d\n",wav_header->sample_rate);
printf("byte rate = %d\n",wav_header->byte_rate * 8);
printf("block align = %d\n",wav_header->block_align);
printf("bits = %d\n",wav_header->bits_per_sample);
printf("samples size= %d\n",wav_header->sub_chunk2_size);
//printf("Calculated information:\n");
printf("file size = %d\n",wav_header->chunk_size + 8);
printf("data pos = %d\n",(uint32_t)sizeof(wave_header_t));
printf("duration = %d s\n",wav_header->sub_chunk2_size / wav_header->block_align / wav_header->sample_rate);
}
int main(int argc, char *argv[])
{
int i, ret;
char *pbuf;
FILE *fp;
snd_pcm_t *h_playback;
snd_pcm_hw_params_t *hw_params;
snd_pcm_uframes_t frames, buff_siz;
wave_header_t wav_header;
if (argc != 2) {
printf("cmd error: use ./wav xx.wav\n");
exit(-1);
}
printf("play %s\n", argv[1]);
fp = fopen(argv[1], "rb");
if (fp == NULL) {
printf("fopen %s failed\n", argv[1]);
exit(-1);
}
fread((uint8_t *)&wav_header, 1, sizeof(wave_header_t), fp);
wav_info_dump((wave_header_t*)&wav_header);
// 1. 打开PCM,最后一个参数为0意味着标准配置
if (snd_pcm_open(&h_playback, "default", SND_PCM_STREAM_PLAYBACK, 0) < 0) {
perror("snd_pcm_open");
fclose(fp);
exit(-1);
}
// 2. 分配snd_pcm_hw_params_t结构体
if (snd_pcm_hw_params_malloc(&hw_params) < 0) {
perror("snd_pcm_hw_params_malloc");
goto end;
}
// 3. 初始化hw_params
if (snd_pcm_hw_params_any(h_playback, hw_params) < 0) {
perror("snd_pcm_hw_params_any");
goto end;
}
// 4. 初始化访问权限
if (snd_pcm_hw_params_set_access(h_playback, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) {
perror("snd_pcm_hw_params_set_access");
goto end;
}
// 5. 初始化采样格式SND_PCM_FORMAT_S16,16位
if (wav_header.bits_per_sample == 24) {
if (snd_pcm_hw_params_set_format(h_playback, hw_params, SND_PCM_FORMAT_S24) < 0) {
perror("snd_pcm_hw_params_set_format");
goto end;
}
} else if (wav_header.bits_per_sample == 16) {
if (snd_pcm_hw_params_set_format(h_playback, hw_params, SND_PCM_FORMAT_S16) < 0) {
perror("snd_pcm_hw_params_set_format");
goto end;
}
} else {
printf("unsupport wav file, bits_per_sample=%d\n", wav_header.bits_per_sample);
goto end;
}
// 6. 设置采样率,如果硬件不支持我们设置的采样率,将使用最接近的
ret = wav_header.sample_rate;
i = 0;
if (snd_pcm_hw_params_set_rate_near(h_playback, hw_params, &ret, &i) < 0) {
perror("snd_pcm_hw_params_set_rate_near");
goto end;
}
// 7. 设置通道数量
if (wav_header.num_channels == 2 || wav_header.num_channels == 1) {
if (snd_pcm_hw_params_set_channels(h_playback, hw_params, wav_header.num_channels ) < 0) {
perror("snd_pcm_hw_params_set_channels");
goto end;
}
} else {
printf("unsupport number of channels, wav_header.num_channels = %d\n", wav_header.num_channels );
goto end;
}
// 8. 设置数据缓冲区大小
frames = FRAMES_PLAYBACK;
buff_siz = frames * wav_header.block_align;
if (snd_pcm_hw_params_set_buffer_size_near(h_playback, hw_params, &buff_siz) < 0) {
perror("snd_pcm_hw_params_set_buffer_size_near");
goto end;
}
// 9. 设置hw_params
if (snd_pcm_hw_params(h_playback, hw_params) < 0) {
perror("snd_pcm_hw_params");
goto end;
}
// allocate file read buffer
pbuf = (char *) malloc(buff_siz);
if (pbuf == NULL) {
perror("pbuf malloc error");
goto end;
}
i = 0;
while (i < wav_header.sub_chunk2_size) {
ret = fread(pbuf, 1, buff_siz, fp);
if (ret != buff_siz) {
if(ret == 0) {
fprintf(stderr, "end of file\n");
break;
} else {
frames = ret / wav_header.block_align;
}
}
i = i + ret;
ret = snd_pcm_writei(h_playback, pbuf, frames);
if (ret < 0){
if (ret == -EPIPE) { // EPIPE means underrun
fprintf(stderr, "underrun occurred\n");
snd_pcm_prepare(h_playback);// 完成硬件参数设置,使设备准备好
} else {
fprintf(stderr, "error from writei: %s\n", snd_strerror(ret));
}
}
}
printf("play end\n");
free(pbuf);
end:
// 10. 关闭PCM设备句柄
snd_pcm_drain(h_playback);
snd_pcm_close(h_playback);
fclose(fp);
return 0;
}
Makefile代码
PREFIX = /home/jinggx/V3S/audio/alsa-lib
TARGET = wav
OBJS = wav
# set default to nothing for native builds
CROSS_COMPILE ?=
ifeq ($(CROSS_COMPILE),$())
CFLAGS = -I.
LDFLAGS = -L.
else
CFLAGS = -I $(PREFIX)/include
LDFLAGS = -L $(PREFIX)/lib
endif
CC = $(CROSS_COMPILE)gcc
$(TARGET): %:%.c
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS) -lasound
.PHONY: clean
clean:
rm -f *.o $(OBJS)
编译生成在电脑上运行的可执行文件
make
编译生成在V3S开发板上运行的可执行文件
make CROSS_COMPILE=arm-linux-gnueabihf-
将wav音频文件放在可执行文件生成的目录下
./wav xxx.wav
耳机就可以听到音乐声了。
实际写代码测试个人感觉这个alsa-lib不太好用,比较啰嗦,参数也有点混乱,不如RT-Thread驱动那么简洁明了。
这些东西花费了我三四天的时间才搞出来,现在分享在这里,希望初学者遇到类似问题时能有一点点帮助。
拖拖拉拉,自己玩得太慢了。图画好了之后,还没等到去打样,全家就都变小羊人了,休息了三周。
先打个样,做个无铅的板子吧,这么多年一直做硬件,感觉含铅的焊锡摸多了要伤身体 ,尤其是这种开发板焊完了还要调软件,要来回摸很久,所以选个无铅的。JLC的无铅喷镀要加钱,发现捷配默认就是无铅工艺,这个正合我心意啊!研究一番发现捷配也做了EDA软件也有元件商城,感觉现在这个行业是真卷啊!
板子做出来这个样子,完全免费的,运费都没出,感谢捷配!
找个风和日丽的时间打开门窗开焊,防止助焊剂的烟味呛人。先焊电源部分,焊好之后测一下各路电压正常,再焊主芯片及其外设。焊到下面这个样子就可以上电试一下了:
sunxi-fel正常识别到芯片,证明板子没问题。
CH340N和液晶屏FPC插座还没买回来,先飞两条线到串口焊盘,先临时测试一下吧
烧录一个荔枝派的测试固件,正常启动。头一次用KICAD制图,头一次做V3S的板子,没翻车,挺好。
启动目志如下:
U-Boot SPL 2017.01-rc2-00073-gdd6e874-dirty (Nov 09 2021 - 06:26:31)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2017.01-rc2-00073-gdd6e874-dirty (Nov 09 2021 - 06:26:31 +0000) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: unrecognized JEDEC id bytes: 00, 00, 00
*** Warning - spi_flash_probe() failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
U-Boot 2017.01-rc2-00073-gdd6e874-dirty (Nov 09 2021 - 06:26:31 +0000) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: unrecognized JEDEC id bytes: 00, 00, 00
*** Warning - spi_flash_probe() failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
338 bytes read in 14 ms (23.4 KiB/s)
## Executing script at 41900000
reading zImage
4428200 bytes read in 226 ms (18.7 MiB/s)
reading sun8i-v3s-licheepi-zero-dock.dtb
12682 bytes read in 26 ms (475.6 KiB/s)
## Flattened Device Tree blob at 41800000
Booting using the fdt blob at 0x41800000
Loading Device Tree to 42df9000, end 42dff189 ... OK
Using machid 0x1029 from environment
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.2.0-licheepi-zero (root@ubuntu) (gcc version 6.3. 1 20170404 (Linaro GCC 6.3-2017.05)) #6 SMP Sun Sep 12 19:59:09 PDT 2021
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructio n cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Zero with Dock
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] percpu: Embedded 16 pages/cpu s34508 r8192 d22836 u65536
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15883
[ 0.000000] Kernel command line: console=tty0 console=ttyS0,115200 panic=5 ro otwait root=/dev/mmcblk0p2 earlyprintk rw
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, lin ear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, line ar)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 52516K/64036K available (6144K kernel code, 306K rwdata, 1920K rodata, 1024K init, 253K bss, 11520K reserved, 0K cma-reserved, 0K highmem )
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jif fies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x300/0x48c wit h crng_init=0
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000008] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 43980 46511097ns
[ 0.000020] Switching to timer-based delay loop, resolution 41ns
[ 0.000213] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_ idle_ns: 79635851949 ns
[ 0.000465] Console: colour dummy device 80x30
[ 0.000756] printk: console [tty0] enabled
[ 0.000814] Calibrating delay loop (skipped), value calculated using timer fr equency.. 48.00 BogoMIPS (lpj=240000)
[ 0.000847] pid_max: default: 32768 minimum: 301
[ 0.001019] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linea r)
[ 0.001054] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001908] CPU: Testing write buffer coherency: ok
[ 0.002445] /cpus/cpu@0 missing clock-frequency property
[ 0.002490] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.003273] Setting up static identity map for 0x40100000 - 0x40100060
[ 0.003539] rcu: Hierarchical SRCU implementation.
[ 0.004104] smp: Bringing up secondary CPUs ...
[ 0.004146] smp: Brought up 1 node, 1 CPU
[ 0.004163] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[ 0.004179] CPU: All CPU(s) started in SVC mode.
[ 0.005294] devtmpfs: initialized
[ 0.008921] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.009293] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, ma x_idle_ns: 19112604462750000 ns
[ 0.009352] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.009611] pinctrl core: initialized pinctrl subsystem
[ 0.010812] NET: Registered protocol family 16
[ 0.011376] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.012680] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.012728] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.037595] SCSI subsystem initialized
[ 0.037936] usbcore: registered new interface driver usbfs
[ 0.038014] usbcore: registered new interface driver hub
[ 0.038130] usbcore: registered new device driver usb
[ 0.038390] mc: Linux media interface: v0.10
[ 0.038447] videodev: Linux video capture interface: v2.00
[ 0.038689] Advanced Linux Sound Architecture Driver Initialized.
[ 0.040039] clocksource: Switched to clocksource arch_sys_counter
[ 0.053070] NET: Registered protocol family 2
[ 0.053936] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.054008] TCP established hash table entries: 1024 (order: 0, 4096 bytes, l inear)
[ 0.054047] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.054079] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.054245] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.054309] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.054629] NET: Registered protocol family 1
[ 0.056608] Initialise system trusted keyrings
[ 0.057010] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.064611] utf8_selftest: All 154 tests passed
[ 0.094312] Key type asymmetric registered
[ 0.094358] Asymmetric key parser 'x509' registered
[ 0.094485] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 2 50)
[ 0.094514] io scheduler mq-deadline registered
[ 0.094528] io scheduler kyber registered
[ 0.095604] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[ 0.099571] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.100225] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pb not found, using dummy regulator
[ 0.101080] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[ 0.174986] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.178399] printk: console [ttyS0] disabled
[ 0.198747] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 36, base_baud = 15 00000) is a U6_16550A
[ 0.724910] printk: console [ttyS0] enabled
[ 0.731042] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 0.764589] panel-simple panel: panel supply power not found, using dummy reg ulator
[ 0.774329] libphy: Fixed MDIO Bus: probed
[ 0.778987] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[ 0.785014] dwmac-sun8i 1c30000.ethernet: No regulator found
[ 0.791316] dwmac-sun8i 1c30000.ethernet: Current syscon value is not the def ault 38000 (expect 58000)
[ 0.800741] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supporte d
[ 0.807974] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supporte d
[ 0.815226] dwmac-sun8i 1c30000.ethernet: COE Type 2
[ 0.820209] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[ 0.826997] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[ 0.832670] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[ 0.838571] libphy: stmmac: probed
[ 0.842801] dwmac-sun8i 1c30000.ethernet: Found internal PHY node
[ 0.849089] libphy: mdio_mux: probed
[ 0.852789] dwmac-sun8i 1c30000.ethernet: Switch mux to internal PHY
[ 0.859160] dwmac-sun8i 1c30000.ethernet: Powering internal PHY
[ 0.866359] libphy: mdio_mux: probed
[ 0.870471] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.877024] ehci-platform: EHCI generic platform driver
[ 0.882623] ehci-platform 1c1a000.usb: EHCI Host Controller
[ 0.888247] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus n umber 1
[ 0.896265] ehci-platform 1c1a000.usb: irq 26, io mem 0x01c1a000
[ 0.930045] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[ 0.937259] hub 1-0:1.0: USB hub found
[ 0.941259] hub 1-0:1.0: 1 port detected
[ 0.945966] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.952336] ohci-platform: OHCI generic platform driver
[ 0.957909] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[ 0.964657] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus n umber 2
[ 0.972650] ohci-platform 1c1a400.usb: irq 27, io mem 0x01c1a400
[ 1.045174] hub 2-0:1.0: USB hub found
[ 1.049044] hub 2-0:1.0: 1 port detected
[ 1.056447] usbcore: registered new interface driver usb-storage
[ 1.062682] usbcore: registered new interface driver ums-realtek
[ 1.069328] udc-core: couldn't find an available UDC - added [g_ether] to lis t of pending drivers
[ 1.079160] input: 1c22800.lradc as /devices/platform/soc/1c22800.lradc/input /input0
[ 1.088558] sun6i-rtc 1c20400.rtc: registered as rtc0
[ 1.093766] sun6i-rtc 1c20400.rtc: RTC enabled
[ 1.098417] i2c /dev entries driver
[ 1.103453] input: ns2009_ts as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-004 8/input/input1
[ 1.113399] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, now ayout=0)
[ 1.122174] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.158819] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.167018] usbcore: registered new interface driver usbhid
[ 1.172700] usbhid: USB HID core driver
[ 1.178946] sun4i-codec 1c22c00.codec: ASoC: codec-analog@01c23000 not regist ered
[ 1.186621] sun4i-codec 1c22c00.codec: Failed to register our card
[ 1.194096] Initializing XFRM netlink socket
[ 1.198434] NET: Registered protocol family 17
[ 1.203649] Registering SWP/SWPB emulation handler
[ 1.209573] Loading compiled-in X.509 certificates
[ 1.219873] simple-framebuffer 43e89000.framebuffer: framebuffer at 0x43e8900 0, 0x177000 bytes, mapped to 0x(ptrval)
[ 1.230614] simple-framebuffer 43e89000.framebuffer: format=x8r8g8b8, mode=80 0x480x32, linelength=3200
[ 1.246873] Console: switching to colour frame buffer device 100x30
[ 1.261842] simple-framebuffer 43e89000.framebuffer: fb0: simplefb registered !
[ 1.273724] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 1.293210] sun4i-drm display-engine: bound 1100000.mixer (ops 0xc0773d40)
[ 1.304454] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc07 7103c)
[ 1.315764] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.325880] [drm] No driver support for vblank timestamp query.
[ 1.335240] fb0: switching to sun4i-drm-fb from simple
[ 1.344506] Console: switching to colour dummy device 80x30
[ 1.351252] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.402578] mmc0: host does not support reading read-only switch, assuming wr ite-enable
[ 1.405672] mmc0: new high speed SDHC card at address aaaa
[ 1.407545] mmcblk0: mmc0:aaaa SU08G 7.40 GiB
[ 1.413184] Console: switching to colour frame buffer device 100x30
[ 1.415156] mmcblk0: p1 p2
[ 1.473838] sun4i-drm display-engine: fb0: sun4i-drmdrmfb frame buffer device
[ 1.484612] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto su pply vcc not found, using dummy regulator
[ 1.501879] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.510664] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[ 1.522691] hub 3-0:1.0: USB hub found
[ 1.529402] hub 3-0:1.0: 1 port detected
[ 1.537109] using random self ethernet address
[ 1.544427] using random host ethernet address
[ 1.552187] usb0: HOST MAC de:5b:3d:47:27:88
[ 1.559079] usb0: MAC a2:1a:6d:99:92:f2
[ 1.565517] using random self ethernet address
[ 1.572411] using random host ethernet address
[ 1.579287] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 1.588335] g_ether gadget: g_ether ready
[ 1.596029] debugfs: Directory '1c22c00.codec' with parent 'V3s Audio Codec' already present!
[ 1.607215] sun4i-codec 1c22c00.codec: ASoC: Failed to create component debug fs directory: -17
[ 1.619893] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
[ 1.631174] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01T00:01:1 8 UTC (78)
[ 1.642104] vcc5v0: disabling
[ 1.647465] ALSA device list:
[ 1.652805] #0: V3s Audio Codec
[ 1.684559] random: fast init done
[ 1.693028] EXT4-fs (mmcblk0p2): recovery complete
[ 1.701900] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. O pts: (null)
[ 1.712462] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 1.723609] devtmpfs: mounted
[ 1.730091] Freeing unused kernel memory: 1024K
[ 1.736904] Run /sbin/init as init process
[ 1.863984] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator: OK
Saving random seed: [ 2.241904] random: dd: uninitialized urandom read (512 b ytes read)
OK
Starting haveged: haveged: command socket is listening at fd 3
OK
Starting network: [ 2.610672] dwmac-sun8i 1c30000.ethernet eth0: PHY [0.1:01] driver [Generic PHY]
[ 2.621987] dwmac-sun8i 1c30000.ethernet eth0: No Safety Features support fou nd
[ 2.631734] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters ava ilable
[ 2.641671] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[ 2.650461] dwmac-sun8i 1c30000.ethernet eth0: configuring for phy/mii link m ode
udhcpc: started, v1.33.1
udhcpc: sending discover
[ 2.944035] random: crng init done
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, forking to background
OK
Starting ntpd: OK
Starting sshd: OK
Welcome to licheepi
licheepi login: root
Password:
licheepi# uname -a
Linux licheepi 5.2.0-licheepi-zero #6 SMP Sun Sep 12 19:59:09 PDT 2021 armv7l GNU/Linux
licheepi#
另外,楼主位置的电路图有一处错误:RJ45的第10脚和12脚没有连接到3.3V上。除此之外,其地方也做了一点微调,最终打样的文件在这里:
V3S新.zip
画得挺好的,学习了。
请教下,RGB交换后,进到linux后如何调整?
TF卡的引脚在器件底部,如何焊接?
屏幕的R和B可以互换,参考这个帖子:
https://whycan.com/t_7335.html
TF卡座焊接不难的,先给板子焊盘上一点锡,然后用热风枪吹,焊锡熔化了之后立即把TF卡座放上去,再稍微吹一会并且对准位置就可以了。我也是头一次焊接这种封装的,第一次就成功了。
搞了十几年单片机了,现在开始学Linux。全志的芯片便宜又好用,但是没有合适的开发板来学习。买了一个某水果派,板子实在太小了,复位按键都没有,买回来需要先自己飞线才能进入FEL模式下载程序,每次下载还要来回插拔USB线。搞不懂为什么现在各种派的板子都在向着尺寸变态小的方向去卷,小得用起来实在是太难受了!
自己平时硬件做的比较多,画个板子不难,所以就有了下面的这个设计。
PCB预览图
pdf格式原理图
V3S.pdf
KiCad 6.0版本的工程文件
V3S.zip
刚刚画好就开源放在这里了,还没去打样。头一次做这个设计,还不知道图纸有没有错误,各位看官如果发现问题,欢迎随时指出来。所有的原理图符号PCB封装都是自己画的,业余时间断断续续搞了半个多月。这几天再研究一下代码编译,弄得差不多了再考虑板子打样。
PCB是0.15mm的线宽线距,0.3mm内径0.55外径的过孔,2层板就没有考虑阻抗那些参数了。板载2.4G PCB天线,板载CH340N串口。
各种接插件的品类比较多,所以PCB板上我标注了一串编号,用这个物料编号可以在大家熟知的元件购买平台搜索到资料和图片,这样大家就能清楚我的PCB板上所用的接插件规格,这个可是我画完图之后又花时间在元件商城里一个一个地找出来的哦!
存在的一些疑问:
1,RTL8723模块没有找到手册资料,参考了一些开源作品的电路图,但是各个图上关于此模块的连接有一些差异,除了SDIO之外,其它引脚该怎么处理合适?希望WIFI和蓝牙功能都能用起来。曾想到了把未知的引脚连到V3S的IO上,但V3S的IO已经用完了,没有多少空余的分给RTL8723模块了。
2,摄像头以前完全没搞过,也没到手册参考,不知道CSI接口摄像头的引脚如何排列,所以弄了个排针。另外 VCC-MCSI该接什么电压?3.3V合适吗?看不同的图,这个引脚的电压值也不一样。
页次: 1