尝试调试WIFI,发现mmc1 初始化失败
sunxi-mmc 4021000.mmc: no support for card's volts
mmc1: error -22 whilst initialising SDIO card
……
设备树
// SPDX-License-Identifier: (GPL-2.0+ or MIT)
// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include "sun8i-t113.dtsi"
/ {
model = "SnailPi MQ-Dual";
compatible = "allwinner,sun20i-d1", "allwinner,sun8i";
aliases {
//ethernet0 = &emac;
mmc0 = &mmc0;
//mmc1 = &mmc1;
serial3 = &uart3;
};
chosen {
stdout-path = "serial3:115200n8";
bootargs = "mem=128M cma=72M root=/dev/mmcblk0p2 rw init=/sbin/init rootwait console=tty0 console=ttyS3,115200";
};
reg_vcc: vcc {
compatible = "regulator-fixed";
regulator-name = "vcc";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
};
reg_usbvbus: usbvbus {
compatible = "regulator-fixed";
regulator-name = "usbvbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vin-supply = <®_vcc>;
};
reg_vcc_3v3: vcc-3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <®_vcc>;
};
reg_avdd2v8: avdd2v8 {
compatible = "regulator-fixed";
regulator-name = "avdd2v8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
vin-supply = <®_vcc_3v3>;
};
reg_vdd_cpu: vdd-cpu {
compatible = "regulator-fixed";
regulator-name = "vdd-cpu";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <900000>;
vin-supply = <®_vcc>;
};
dmic_codec: dmic-codec {
compatible = "dmic-codec";
num-channels = <2>;
#sound-dai-cells = <0>;
};
dmic-sound {
compatible = "simple-audio-card";
#address-cells = <1>;
#size-cells = <0>;
simple-audio-card,dai-link@0 {
format = "pdm";
frame-master = <&link0_cpu>;
bitclock-master = <&link0_cpu>;
link0_cpu: cpu {
sound-dai = <&dmic>;
};
link0_codec: codec {
sound-dai = <&dmic_codec>;
};
};
};
leds {
compatible = "gpio-leds";
status_led {
linux,default-trigger = "heartbeat";
label = "blue:status";
gpios = <&pio 3 22 GPIO_ACTIVE_HIGH>; //pd22
};
};
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
//pinctrl-0 = <&wifi_en_pin>;
pinctrl-names = "default";
clocks = <&ccu CLK_FANOUT1>;
clock-names = "ext_clock";
assigned-clocks = <&ccu CLK_FANOUT1>;
assigned-clock-rates = <32768>;
pinctrl-0 = <&clk_pg11_pin>;
};
};
®_aldo {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
vdd33-supply = <®_vcc_3v3>;
};
&cpu0 {
cpu-supply = <®_vdd_cpu>;
};
&cpu1 {
cpu-supply = <®_vdd_cpu>;
};
&wdt {
status = "okay";
};
&ve {
status = "disabled";
};
// &de {
// status = "okay";
// };
// &dsi {
// pinctrl-0 = <&dsi_4lane_pins>;
// pinctrl-names = "default";
// status = "disabled";
// panel: panel@0 {
// reg = <0>;
// compatible = "lg,lh500wx1-sd03";
// pinctrl-names = "default";
// // pinctrl-0 = <&panel_pin>;
// // port {
// // panel_in: endpoint {
// // remote-endpoint = <&dsi0_out>;
// // };
// // };
// };
// };
&pio {
vcc-pb-supply = <®_vcc_3v3>;
vcc-pc-supply = <®_vcc_3v3>;
vcc-pd-supply = <®_vcc_3v3>;
vcc-pe-supply = <®_avdd2v8>;
vcc-pf-supply = <®_vcc_3v3>;
vcc-pg-supply = <®_vcc_3v3>;
uart3_pb6_pins: uart3-pb6-pins {
pins = "PB6", "PB7";
function = "uart3";
};
uart5_pb4_pins: uart5-pb4-pins {
pins = "PB4", "PB5";
function = "uart5";
};
wifi_en_pin: wifi_en_pin {
pins = "PG12";
function = "gpio_out";
};
clk_pg11_pin: clk-pg11-pin {
pins = "PG11";
function = "clk";
};
};
&uart1 {
uart-has-rtscts;
pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
pinctrl-names = "default";
status = "disabled";
/* XR829 bluetooth is connected here */
};
&uart3 {
pinctrl-0 = <&uart3_pb6_pins>;
pinctrl-names = "default";
status = "okay";
};
&uart5 {
pinctrl-0 = <&uart5_pb4_pins>;
pinctrl-names = "default";
status = "disabled";
};
&i2c2 {
pinctrl-0 = <&i2c2_pe12_pins>;
pinctrl-names = "default";
status = "okay";
};
&spi0 {
pinctrl-0 = <&spi0_pins>;
pinctrl-names = "default";
status = "disabled";
};
&mmc0 {
bus-width = <4>;
cd-gpios = <&pio 5 6 (GPIO_ACTIVE_LOW)>;
disable-wp;
vmmc-supply = <®_vcc_3v3>;
vqmmc-supply = <®_vcc_3v3>;
pinctrl-0 = <&mmc0_pins>;
pinctrl-names = "default";
status = "okay";
};
&mmc1 {
bus-width = <4>;
mmc-pwrseq = <&wifi_pwrseq>;
non-removable;
//broken-cd;
vmmc-supply = <®_vcc_3v3>;
vqmmc-supply = <®_vcc_3v3>;
pinctrl-0 = <&mmc1_pins>;
pinctrl-names = "default";
status = "okay";
brcmf: sdio_wifi@1 {
reg = <1>;
compatible = "brcm,bcm4329-fmac";
interrupt-parent = <&pio>;
interrupts = <6 10 IRQ_TYPE_LEVEL_HIGH>; /* PG10 */
interrupt-names = "host-wake";
};
};
// &codec {
// routing = "Headphone Jack", "HPOUTL",
// "Headphone Jack", "HPOUTR",
// "Headset Microphone", "MICIN3";
// /* "LINEINL", "HPOUTL",
// "LINEINR", "HPOUTR";
// */
// widgets = "Microphone", "Headset Microphone",
// "Headphone", "Headphone Jack";
// status = "disabled";
// };
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&ehci0 {
status = "okay";
};
&dmic {
status = "okay";
};
&ehci1 {
status = "okay";
};
&ohci0 {
status = "okay";
};
&ohci1 {
status = "okay";
};
&ths {
status = "okay";
vref-supply = <®_aldo>;
};
&usbphy {
usb0_vbus-supply = <®_usbvbus>;
usb1_vbus-supply = <®_usbvbus>;
status = "okay";
};
&mdio {
ext_rgmii_phy: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
};
&emac {
pinctrl-0 = <&rgmii_pe_pins>;
pinctrl-names = "default";
phy-handle = <&ext_rgmii_phy>;
phy-mode = "rgmii-id";
phy-supply = <®_vcc_3v3>;
status = "disabled";
};
/*
&can0 {
pinctrl-names = "default";
pinctrl-0 = <&can0_pins>;
status = "disabled";
};
&can1 {
pinctrl-names = "default";
pinctrl-0 = <&can1_pins>;
status = "disabled";
};
*/
原理图
但是我挂的模组是Ap6212A
是不是我这样乱搞,导致起不来的?
内核编译
可以直接找大佬修改好的主线稳定版内核(带WiFi):Linux-6.0.1https://github.com/Evlers/linux_kernel_t113
也选择去官网下载内核:kernel https://kernel.org/
修改 kernel.org 下载的内核源代码(墨云直接使用的是大佬修改后的代码,所以这部分没验证) :
# 修改 drivers/clk/sunxi-ng/Kconfig 文件
config SUN20I_D1_CCU
tristate "Support for the Allwinner D1 CCU"
default RISCV && ARCH_SUNXI
- depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST
+ depends on (ARCH_SUNXI) || COMPILE_TEST
config SUN20I_D1_R_CCU
tristate "Support for the Allwinner D1 PRCM CCU"
default RISCV && ARCH_SUNXI
- depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST
+ depends on (ARCH_SUNXI) || COMPILE_TEST
# 修改 drivers/clk/sunxi-ng/ccu-sun20i-d1.c 文件
static SUNXI_CCU_MUX_DATA(cpux_clk, "cpux", cpux_parents,
- 0x500, 24, 3, CLK_SET_RATE_PARENT);
+ 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL);
# 修改 arch/arm/mach-sunxi/platsmp.c 文件,在末尾添加以下内容
static int sun8i_t113_smp_boot_secondary(unsigned int cpu,
struct task_struct *idle)
{
u32 reg;
void __iomem *cpucfg_membase = ioremap(0x09010000, 0x10);
void __iomem *cpuexec_membase[] = {ioremap(0x070005C4, 0x10),ioremap(0x070005C8, 0x10)};
if (cpu != 1)
return 0;
spin_lock(&cpu_lock);
/* Set CPU boot address */
writel(__pa_symbol(secondary_startup), cpuexec_membase[cpu]);
/* Deassert the CPU core reset */
reg = readl(cpucfg_membase);
writel(reg | BIT(cpu), cpucfg_membase);
spin_unlock(&cpu_lock);
return 0;
}
static const struct smp_operations sun8i_t113_smp_ops __initconst = {
.smp_boot_secondary = sun8i_t113_smp_boot_secondary,
};
CPU_METHOD_OF_DECLARE(sun8i_t113_smp, "allwinner,sun8iw20p1", &sun8i_t113_smp_ops);
配置内核
在内核根目录修改Makefile
ARCH = arm
CROSS_COMPILE = arm-linux-gnueabihf-
配置默认编译规则
make sunxi_defconfig
打开配置菜单
make sunxi_defconfig menuconfig
打开芯片时钟支持:
> Device Drivers
> Common Clock Framework
<*> Clock support for Allwinner SoCs
<*> Support for the Allwinner D1 CCU
<*> Support for the Allwinner D1 PRCM CCU
添加设备树
将设备树添加到内核 arch/arm/boot/dts/ 目录中:sun8i-t113-snailpi-dual.dts sun8i-t113.dtsi (如果下载了大佬的Linux内核,就有这些文件,需要注意的是原版是 sun8i-t113-mangopi-dual.dts)
linux-sun8i-t113.zip
并在该目录 Makefile 文件中的CONFIG_MACH_SUN8I下添加改设备树文件:
dtb-$(CONFIG_MACH_SUN8I) += \
sun8i-a23-evb.dtb \
sun8i-a23-gt90h-v4.dtb \
sun8i-a23-inet86dz.dtb \
.....................
sun8i-v3s-licheepi-zero-dock.dtb \
sun8i-v40-bananapi-m2-berry.dtb \
sun8i-t113-snailpi-dual.dtb
接下来就是正常编译
make
如果遇到
FATAL ERROR: MPC.H: 没有那个文件或目录
安装如下组件
sudo apt-get install libmpc-dev
接下来就是分区复制编译好的文件即可,这里不做赘述。
结合我们很久以前制作的Debian文件系统,那只熟悉的蜗牛又回来啦。
感谢阅读
-----------------------------
这里再次感谢Evlers大佬的付出,本篇为拾人牙慧之作,如果其中内容涉及侵权之类的,请告知墨云,墨云会在得到信息的时候删除。
原贴在这里
https://bbs.aw-ol.com/topic/2338/mangopi-dual-t113-%E4%B8%BB%E7%BA%BF%E5%86%85%E6%A0%B8%E7%BC%96%E8%AF%91%E8%AE%B0%E5%BD%95
感谢Evlers大佬的付出。
需要注意的是:本篇是基于所用的引导的是AWboot 而非传统的uboot-spl方式,并且是该AWboot是专为T113-S3而构建的引导。
1 . 配置AWboot编译环境
AWboot需要用到arm-none-eabi-的交叉编译工具,我这里使用到的是 gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
下载地址:https://developer.arm.com/downloads/-/gnu-rm
接下来配置编译环境
# 解压
tar -vxjf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
# 创建目录
sudo mkdir /usr/local/arm-none-eabi
# 进入解压目录下
cd gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/
# 将该目录下的所有文件复制到新建的目录下
sudo cp -rd * /usr/local/arm-none-eabi/
# 最后需要添加该工具链的环境变量使其可以在任何目录下执行,打开/etc/profile文件
sudo nano /etc/profile
# 在文件末尾添加以下内容
PATH=$PATH:/usr/local/arm-linux-gcc/bin
# 添加完毕,使路径立即生效可以使用如下命令
source /etc/profile
# 接下来在终端输入
arm-none-eabi-
#按两次tab键进行验证
2 . 编译AWboot
# 下拉 awboot
git clone https://github.com/szemzoa/awboot
cd awboot
# 制作编译工具
cd tools
gcc mksunxi.c -o mksunxi
# 修改 Makefile 中的 /bin/expr 为 /usr/bin/expr
@/usr/bin/expr `/bin/cat .build_revision` + 1 > .build_revision
# 编译 awboot
make
如果文件夹下awboot下生成了:awboot-boot-sd.bin则表示工作正常了。
3 . 修改串口配置
AWboot 默认使用UART5作为串口调试,但是因为墨云的板子使用的是UART3,所以需要进行一些调整,好在代码比较简单,进行如下修改:
修改awboot目录下的board.cs文件,修改如图
需要注意base参数可以通过t113-s3用户手册查询到
0x02500c00 为UART3 的地址
还有就是对awboot/linux/sun8i-t113.dtsi、awboot/linux/sun8i-t113-snailpi-dual.dts 的修改
主要是增加UART3 设备树配置和 BootArgs的配置,就是类似Uboot中BootArgs的配置:
修改细微处较多,这里直接给文件吧
awboot_sun8i-t113.zip
awboot/linux/sun8i-t113.dtsi
中pio节点下增加
uart3_pb6_pins: uart3-pb6-pins {
pins = "PB6", "PB7";
function = "uart3";
};
awboot/linux/sun8i-t113-snailpi-dual.dts
最后增加
&uart3 {
pinctrl-0 = <&uart3_pb6_pins>;
pinctrl-names = "default";
status = "okay";
};
修改 aliases
aliases {
//ethernet0 = &rtl8189f;
mmc0 = &mmc0;
serial1 = &uart1;
serial3 = &uart3;
//serial5 = &uart5;
};
修改chosen (这个地方就是用来指定类似uboot中bootargs的地方)
chosen {
stdout-path = "serial3:115200n8";
/*
bootargs = "mem=128M cma=72M root=/dev/mmcblk0p2 rw init=/sbin/init rootwait earlyprintk=sunxi-uart,0x02500c00 console=tty0 console=ttyS5,115200";
*/
bootargs = "mem=128M cma=64M root=/dev/mmcblk0p2 rw init=/sbin/init rootwait console=tty0 console=ttyS3,115200 earlyprintk=sunxi-uart,0x02500c00";
};
最后一个就是类似uboot指定zimage和设备树的地方
因为该项目是特定版本,所以只是单纯的指定名称,不用指定要写入内存的位置。
写入TF卡:
sudo dd if=awboot-boot-sd.bin of=/dev/sdb bs=1024 seek=8
最后是执行结果
本篇结束
内核部分可以先看前面的原贴,墨云稍后更新。
对于这个Uboot
https://gitee.com/weiwei382-163-com/t113-s3-u-boot
对于 arch/arm/mach-sunxi/board.c 中默认配置串口好像是PE2\PE3,对于后面的6 是什么意思,如何确定PE这个组呢
主要是想加uart3 作为输出
大佬,参考你的贴子,我用nano板,在Starting kernel...一直重启;求助哇
https://whycan.com/files/members/9470/Starting%20kernel....jpg
检查zImage 、 tf卡格式等等
配置触屏驱动
1. 配置NS2009代码
下载NS2009驱动代码
ns2009.zip
根据原理图修改中断脚
#include <linux/input.h>
#include <linux/input-polldev.h>
#include <linux/input/touchscreen.h>
#include <linux/i2c.h>
/* polling interval in ms */
#define POLL_INTERVAL 148 //PE20 ****注意修改这里******
/* this driver uses 12-bit readout */
将代码放置到
drivers/input/touchscreen/ns2009.c
配置同一目录下kconfig,添加NS2009选项
config TOUCHSCREEN_NS2009
tristate "Nsiway NS2009 touchscreen"
depends on I2C
select INPUT_POLLDEV
help
Say Y here to enable Nsiway NS2009 resistive touchscreen
controller support.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called ns2009.
配置同一目录一下的Makefile,添加编译条目
obj-$(CONFIG_TOUCHSCREEN_NS2009) += ns2009.o
2.配置设备树
修改 arch/arm/boot/dts/sun8i-v3s.dtsi
在SOC/PIO节点下添加
i2c1_pins: i2c1-pins {
pins = "PE21", "PE22";
function = "i2c1";
};
在soc节点下添加如下代码
i2c1: i2c@1c2b000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01c2b000 0x400>;
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_I2C1>;
resets = <&ccu RST_BUS_I2C1>;
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
修改arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts,使能i2c1,屏配置驱动
&i2c1 {
status = "okay";
ns2009: ns2009@48 {
compatible = "nsiway,ns2009";
reg = <0x48>;
};
};
通过menuconfig配置驱动
启动内核如果有如下类的代码输出那么就可以断定驱动已经好了
[ 1.372548] i2c /dev entries driver
[ 1.378800] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pe not found, using dummy regulator
[ 1.390243] input: ns2009_ts as /devices/platform/soc/1c2b000.i2c/i2c-1/1-0048/input/input0
3.安装应用层触控驱动tslib-1.22
tslib-1.22.tar.gz
这部分在开发板上完成
安装一些组件
apt-get install autoconf automake libtool libffi-dev
mkdir tslib
chmod -R 777 tslib # 该步骤一定要做
cp tslib-1.22.tar.gz ~/tslib #将驱动复制到新建的目录中
cd tslib
tar -xvf tslib-1.22.tar.gz #解压
#开始编译
cd tslib-1.22
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
./configure --prefix=/root/packet/tslib --cache-file=arm-linux.cache
make
make install
复制刚才生成的组件
# 拷贝动态库到根文件系统
cd ~/tslib
cp lib/* /lib -d -rf
cp etc/* /etc -d -rf
cp bin/* /bin -d -rf
# 拷贝动态库到交叉工具链
cp -rf include/* /usr/include
cp -d -rf lib/libts* /lib
修改配置文件
cd /etc
nano profile
export TSLIB_TSDEVICE=/dev/input/event0 #指定触摸屏设备
export TSLIB_FBDEVICE=/dev/fb0 #指定显示器设备
export TSLIB_CONFFILE=/etc/ts.conf #指定tslib配置文件的路径
export TSLIB_CALIBFILE=/etc/pointercal #指定校准文件的存放位置
export TSLIB_PLUGINDIR=/lib/ts #指定tslib插件文件的路径
export LD_LIBRARY_PATH=/lib #添加 tslib 库
export TSLIB_CONSOLEDEVICE=none #设备控制台文件名
4. 触屏校准
cd ~/tslib/tslib-1.22/tests
./ts_calibrate #执行校准
./ts_test # 进行测试
背光自动开启已经好了
#include "sun8i-v3s-licheepi-zero.dts"
/ {
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 1000000 0>;
//brightness-levels = <0 30 40 50 60 70 100>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <6>;
//新增部分
enable-gpios = <&pio 1 4 0>;
post-pwm-on-delay-ms = <10>;
pwm-off-delay-ms = <10>;
};
……
更新一下Debian镜像。解压后将扩展名改为img
链接:https://pan.baidu.com/s/1RrITGJ3OgoJtYYEY0EImRQ
提取码:6czb
https://whycan.com/files/members/6376/QQ图片20220110165110.jpg
使用Lvgl做的demo 为啥会分为左右两部分?
已经成功处理了,我是没想到竟然要修改
lv_conf.h
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 32 // 16
可以愉快的玩耍了
根据这个帖子的提示 https://whycan.com/t_7650.html
PC8~PC10 配置的LED灯已经可以点亮了
(ps 图中的丝印错了,PC应该对应的是64 ,PC8~PC10 应该是72~74)
把荔枝派的设备树文件包含的#include "sun8i-v3s.dtsi"换成#include "sun8i-v3.dtsi"就可以了
另外我在编译的时候报错了
我把sun8i-v3.dtsi文件中的
&mdio_mux {
external_mdio: mdio@2 {
reg = <2>;
#address-cells = <1>;
#size-cells = <0>;
};
};
注释了
链接:https://pan.baidu.com/s/17ltLAHdlVFuaC9oXOtnbEw
提取码:jzcq
下载解压后,使用Win32DiskImager之类的镜像烧录工具烧写到TF卡即可。
(PS:解压后的镜像是imgs格式,事实上应该是img文件,因为img无法压缩,所以改了成了imgs)
发现在执行Infones的时候有这个报错
root@SnailPi:~/packet/arm-NES-linux-master/linux# ./InfoNES ~/game/h1.nes
/dev/input/event0 dev not found
fb width:320 height:240
Sound Hardware Init ----
sound Init
sound Open------
ALSA lib dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol snd_func_private_integer
ALSA lib conf.c:4556:(_snd_config_evaluate) symbol snd_func_private_integer is not defined inside (null)
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such device or address
ALSA lib conf.c:3694:(snd_config_hook_load) Unable to expand filenames in the pre-load section
ALSA lib conf.c:3572:(snd_config_hooks_call) function snd_config_hook_load_for_all_cards returned error: No such device or address
Sound Hardware Init doen!!----
通过增加打印记录代码
arm-NES-linux-master/linux/InfoNES_System_Linux.cpp
/*===================================================================*/
/* */
/* InfoNES_SoundOpen() : Sound Open */
/* */
/*===================================================================*/
int InfoNES_SoundOpen( int samples_per_sync, int sample_rate )
{
printf("open 1\n");
//sample_rate 采样率 44100
//samples_per_sync 735
unsigned int rate = sample_rate;
snd_pcm_hw_params_t *hw_params;
if(0 > snd_pcm_open(&playback_handle, "default", SND_PCM_STREAM_PLAYBACK, 0))
{
printf("snd_pcm_open err\n");
return -1;
}
printf("open 2\n");
if(0 > snd_pcm_hw_params_malloc(&hw_params))
{
printf("snd_pcm_hw_params_malloc err\n");
return -1;
}
printf("open 3\n");
if(0 > snd_pcm_hw_params_any(playback_handle, hw_params))
{
printf("snd_pcm_hw_params_any err\n");
return -1;
}
printf("open 4\n");
if(0 > snd_pcm_hw_params_set_access(playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED))
{
printf("snd_pcm_hw_params_any err\n");
return -1;
}
printf("open 5\n");
//8bit PCM 数据
if(0 > snd_pcm_hw_params_set_format(playback_handle, hw_params, SND_PCM_FORMAT_U8))
{
printf("snd_pcm_hw_params_set_format err\n");
return -1;
}
printf("open 6\n");
if(0 > snd_pcm_hw_params_set_rate_near(playback_handle, hw_params, &rate, 0))
{
printf("snd_pcm_hw_params_set_rate_near err\n");
return -1;
}
printf("open 7\n");
//单声道 非立体声
if(0 > snd_pcm_hw_params_set_channels(playback_handle, hw_params, 1))
{
printf("snd_pcm_hw_params_set_channels err\n");
return -1;
}
printf("open 8\n");
if(0 > snd_pcm_hw_params(playback_handle, hw_params))
{
printf("snd_pcm_hw_params err\n");
return -1;
}
printf("open 9\n");
snd_pcm_hw_params_free(hw_params);
if(0 > snd_pcm_prepare(playback_handle))
{
printf("snd_pcm_prepare err\n");
return -1;
}
printf("open 10\n");
return 1;
}
打印如下记录
root@SnailPi:~/packet/arm-NES-linux-master/linux# ./InfoNES ~/game/h1.nes
/dev/input/event0 dev not found
fb width:320 height:240
open 1
ALSA lib dlmisc.c:170:(snd_dlsym_verify) unable to verify version for symbol snd_func_private_integer
ALSA lib conf.c:4556:(_snd_config_evaluate) symbol snd_func_private_integer is not defined inside (null)
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such device or address
ALSA lib conf.c:3694:(snd_config_hook_load) Unable to expand filenames in the pre-load section
ALSA lib conf.c:3572:(snd_config_hooks_call) function snd_config_hook_load_for_all_cards returned error: No such device or address
open 2
open 3
open 4
open 5
open 6
open 7
open 8
open 9
open 10
^C
原理图与PCB文件
原理图
Schematic_SnailCard_v3s.pdf
PCB
Gerber_PCB_SnaillCard_V3s.zip
天气寒冷,为我们的小电脑穿个衣服,(注意,接口部分因为需要适配你使用的元件,尤其是wifi天线和tf卡那一面,所以必要时可能需要自己手动改造一下,别问我怎么知道的)
外壳.zip
最终效果
该系列的Debian镜像。解压后将扩展名改为img
链接:https://pan.baidu.com/s/11l5o-bZK6KueomYehV3l1w
提取码:42ka
尝试使用lvgl,结果出现一种似花非花的尴尬局面
https://gitee.com/socbis/linux-lvgl/#lvgl-for-frame-buffer-device
git clone https://gitee.com/socbis/linux-lvgl.git -b lvgl-s5p6818
u-boot,内核、Debain文件系统都在这里面了
链接:https://pan.baidu.com/s/12HrPDX7nl6pfvupotlY6Iw
提取码:00bv
1. rootfs用户名root密码123456
2 .拷贝 rtl8723bs_nic.bin 到根文件系统的 /lib/firmware/rtlwifi/ 目录下.
内核以太网卡驱动成功
来源于:
https://wiki.sipeed.com/soft/Lichee/zh/Zero-Doc/Drive/Ethernet.html
因为使用的主线5.10.81 已经在设备树做了相关配置。只需要修改
arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
使能以太网
&emac {
phy-handle = <&int_mii_phy>;
phy-mode = "mii";
allwinner,leds-active-low;
status = "okay";
};
复制zimage 和dtb文件到tf卡,上电以后,启动中就可以看到以太网灯已经亮了
进入系统,启动网卡
root@SnailPi:~# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@SnailPi:~# ifconfig eth0 up
[ 87.868047] dwmac-sun8i 1c30000.ethernet eth0: PHY [0.1:01] driver [Generic PHY] (irq=POLL)
[ 87.879265] dwmac-sun8i 1c30000.ethernet eth0: No Safety Features support found
[ 87.886622] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[ 87.894407] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[ 87.901964] dwmac-sun8i 1c30000.ethernet eth0: configuring for phy/mii link mode
[ 87.985489] dwmac-sun8i 1c30000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
root@SnailPi:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether d6:80:0d:77:87:5b txqueuelen 1000 (Ethernet)
RX packets 51 bytes 7408 (7.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 46
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
配置IP
root@SnailPi:~# udhcpc -i eth0
udhcpc: started, v1.30.1
udhcpc: sending discover
udhcpc: sending select for 192.168.3.107
udhcpc: lease of 192.168.3.107 obtained, lease time 86400
root@SnailPi:~#
root@SnailPi:~#
root@SnailPi:~#
root@SnailPi:~# ping www.baidu.com
PING www.a.shifen.com (220.181.38.149) 56(84) bytes of data.
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=1 ttl=53 time=14.5 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=2 ttl=53 time=14.0 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=3 ttl=53 time=14.4 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=4 ttl=53 time=14.0 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=5 ttl=53 time=14.5 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=6 ttl=53 time=14.5 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=7 ttl=53 time=14.1 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=8 ttl=53 time=14.6 ms
软件部分
--------------------
u-boot
https://gitee.com/byleefei/uboot-2021.07-v3x
如果想要通过直接在u-boot中配置bootcmd和bootargs
方法如下:
make ARCH=arm mipi-v3x_defconfig
make ARCH=arm menuconfig
关闭通过配置文件启动,取消图中的配置
配置参数
cmd
load mmc 0:1 0x41000000 zImage;load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-with-480x272-lcd.dtb;bootz 0x41000000 - 0x41800000;
args
console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk rw
--------------
执行make 命令编译,烧写到TF卡,就可以启动了,对于内核和文件系统配置和V3s一致,就是需要注意PC4~PC10,和PD引脚的使用。
终于把心心念念的LCD屏驱动起来了
-------------------
全部硬件资料如下
V3x硬件资料.zip
目前调试进度:
------------------------
[ ]以太网卡未验证
[x]wifi已验证
[ ] 蓝牙未验证
[x]USB驱动已验证
[x]音频已验证
[x]LCD屏幕已验证
[ ] LED灯珠验证失败,大概是V3s中没有定义PC4~PC10,而我在V3x中定义LED灯珠为PC8\PC9\PC10,所以无法控制,另外我把丝印写错了。
twzy 说:替换了D1 ,使用SS14,输出背光电压为5v,其他正常了。所以升了个寂寞,后续研究修改一下
https://whycan.com/files/members/6376/QQ图片20211218212330.jpgD1S管脚跟V3X兼容吗?pin2pin
这是两种芯片吧,不兼容
@twzy
https://releases.linaro.org/debian/images/alip-armhf/这里是带桌面的文件系统,换掉原来的文件系统就行
记得启动交换分区,不然很卡
V3X和V3S就uboot有点差异,内核文件系统通用
其他的已经跑起来了,今天画了个基于v3x的小电脑,已经打样了
另外v3x操作pc4~pc10引脚会报错,估计是使用v3s配置的原因,后续看看怎么修改吧
弄了桌面系统
浏览器访问坑网,加载只要几秒
50-75%CPU
65% 内存
v3s上直接爆内存怪不得打不开
https://whycan.com/files/members/6250/78b4eb05451268af.jpg
远程桌面,还没弄好https://whycan.com/files/members/6250/-7325f7e9167bae9b.png
求方法,我自己安装的Ledx,感觉一直在重启
那应该是没接错,但是为啥会造成其他路电压猛增呢?
资本家大善人 说:touchey 说:@twzy
另问V3x目前有没有比较容易上手的TF卡镜像呢?多谢,我晚上试试
使用测试镜像已经成功执行,
那从u-boot移植开始吧,但是在此之前,需要分析一下背光电路,为啥会造成升压。
会不会是我把PT4103 焊反了?
touchey 说:@twzy
另问V3x目前有没有比较容易上手的TF卡镜像呢?
多谢,我晚上试试
前两天看到晕哥帖子里面提到,如果想做基于V3x的开发板,并在哇酷社区开源的话,就可以得到两片免费的芯片,本着将白嫖(bu yao lian)进行到底的精神,果断找晕哥要了两片,所以开始吧。
--------------------------------------------------------------------------------------
原理图
V3x.pdf
效果图
当前pcb正在验证中,谨慎使用
-----
华秋打样的PCB
板子很精致(自恋)
早上5点起来开始焊接,不要多问,问就是早睡早起
焊接
成品展示
---
目前的问题:
1.LCD屏的背光电路好像有问题(最近和屏幕电路犯冲),接入电路后 核心、内存、主路电压高的飞起,应该是有一片V3x阵亡了。
2.因为没找到合适的测试镜像,参考https://whycan.com/t_6986.html 这个帖子第一种方案,做了一个u-boot,上电毫无反应,但是晶振旁边的电容电压为1.5V,应该是工作了,目前没有公对公USB线,所以没法测试fel是否可用。
---
使用V3s的镜像启动,卡在初始化内存了,正常,V3x使用的是ddr3
我这个问题解决了,在初始化ST7789v时候,适当增加休眠时间。
static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);
mdelay(200); //fixed
write_reg(par,0x11);//Sleep exit
mdelay(100); //fixed
write_reg(par,0x11);
mdelay(100); //fixed
write_reg(par,0x3A,0x05); //65k mode
write_reg(par,0xc5,0x1a);
write_reg(par,0x36,0x70); // 屏幕显示方向设置
//-------------ST7789V Frame rate setting-----------//
write_reg(par,0xb2,0x05,0x05,0x00,0x33,0x33);
write_reg(par,0xb7,0x35);
//--------------ST7789V Power setting---------------//
write_reg(par,0xbb,0x3f);
write_reg(par,0xc0,0x2c);
write_reg(par,0xc2,0x01);
write_reg(par,0xc3,0x0f);
write_reg(par,0xc4,0x20);
write_reg(par,0xc6,0x11);
write_reg(par,0xd0,0xa4,0xa1);
write_reg(par,0xe8,0x03);
write_reg(par,0xe9,0x09,0x09,0x08);
write_reg(par,0xe0,0xd0,0x05,0x09,0x09,0x08,0x14,0x28,0x33,0x3f,0x07,0x13,0x14,0x28,0x30);
write_reg(par,0xe1,0xd0,0x05,0x09,0x09,0x08,0x03,0x24,0x32,0x32,0x3b,0x14,0x13,0x28,0x2f);
write_reg(par,0x21);
write_reg(par,0x11);
mdelay(200); //fixed
write_reg(par,0x29);
mdelay(200);
return 0;
}
twzy 说:我也根据大佬的思路做了一个V3s的小电脑,大佬可以说说那个LXDE桌面操作怎么处理吗,我弄了一个太卡了
swap 已经配置
我跑的是主线,我是不是直接安装LXDE就行了,屏幕用的spi0,fb0啥的不用配置吗?
如果想看v3s的相关资料的,可以关注一下这个帖子 https://whycan.com/t_7338.html
有幸得到晕哥赠送的一台V3s路由器,还带了一块F1c600的板子,虽然我的积分还不够^_^
---
好了,秀完了,开始说如何进入管理界面,wifi密码为前面已经提到了:asdfghjk
当我们通过串口登录系统,使用passwd 修改密码的时候
root@(none):/# passwd root
Changing password for root
New password:
Bad password: too weak
Retype password:
passwd: /etc/passwd: Read-only file system
passwd: can't update password file /etc/passwd
后面使用chmod 依然不行,这里使用mount_root命令
root@(none):/etc# mount_root
[ 1337.186325] jffs2: notice: (1656) jffs2_build_xattr_subsystem: complete building xattr subsystem, 5 of xdatum (2 unchecked, 3 orphan) and 7 of xref (3 dead, 0 orphan) found.
[ 1337.205595] mount_root: switching to jffs2 overlay
[ 1337.217383] overlayfs: upper fs does not support tmpfile.
接下来就可以修改密码了,万能的123456
root@(none):/rom/etc# passwd root
Changing password for root
New password:
Bad password: too weak
Retype password:
passwd: password for root changed by root
然后就可以使用123456登录管理界面了
另外我的Rtl8723bs,驱动调试完成了
注意1:
使用 arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts 设备树的时候,因为配置了LEDS 节点使用了 PG1\PG2\PG3,导致mmc1无法使用,所以需要注释
注意2:
(不知这部分是否是必须,因为我实在是太懒了,没返回去验证)
要在arch/arm/boot/dts/sun8i-v3s.dtsi 中重新配置mmc1_pins 节点,我是根据mmc0中定义的SDIO顺序修改的
(SD1 SD0 CLK CMD SD3 SD2)
mmc1_pins: mmc1-pins {
pins = "PG3", "PG2", "PG0", "PG1",
"PG5", "PG4";
function = "mmc1";
drive-strength = <30>;
bias-pull-up;
};
//原来的顺序为 PG0 PG1……PG5
注意3
要在arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts中是能mmc1
&mmc1 {
broken-cd;
bus-width = <4>;
vmmc-supply = <®_vcc3v3>;
status = "okay";
};
接着就是要把rtl8723bs_nic.bin文件复制到/lib/firmware/rtlwifi/ 目录下,很多帖子都提到了
rtl8723bs_nic.zip
另外rtl8723bs只能被编译为模块所以 你要去drivers/staging/rtl8723bs 找到r8728.ko文件,根据前面提到的放到/lib/modules/5.10.81/文件夹下,有可能文件系统自己就加载了。
最后是联网脚本
#!/bin/sh
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
ifconfig wlan0 up
sleep 3
udhcpc -i wlan0
别忘了配置/etc/wpa_supplicant.conf文件
效果如下:
调试很顺畅,所以要啥 esp8089
---
ps:V3s小板先停到这里,我要去瞅瞅F133了
光速进行时 说:作者大大,啥时候能把镜像打包一份,直接用win系统烧tf卡上直接用
第四篇中有链接
测试镜像文件:
链接:https://pan.baidu.com/s/1qTTgBndBvmssCdeqXHI3Pg
提取码:fw52
上面那个文件有点问题已经删除了
使用这个镜像测试
链接:
https://pan.baidu.com/s/1uG4MTF008DliohcKo6IuqQ
提取码:xnpz
@司徒
感谢司徒大佬的关注,因为关于esp8266这篇文章是基于迪卡大佬的帖子整理而来,在加上调试代码的时候没做相关记录,所以其中部分日志引用了原贴中的代码,因此日志提示产生了与实际情况不一致的问题,产生了歧义,还请见谅。
对于第二点,是因为驱动在完成固件下载后,通过代码跟踪重启模块的时候直接造成加载驱动失败,这个我是根据https://whycan.com/t_4149.html帖子的144楼的方式解决了,所以加载驱动的时候会加载两次。
从收纳箱找到很久以前买过的一台台电C340PE,手欠的果断拆了,然后发现里面用的屏幕是标准的 RGB LCD,果断安装到lichee pi Nano上面,成功点亮。
具体参数如下:
引脚:40pin (通用型,兼容荔枝派Nano)
分辨率:480*272
尺寸:105.5*67.2*2.9 mm
所以打算为这个屏幕做个开发板,本次打算使用V3s做。
目前原理图和第一版pcb已经设计完成,暂时不打烊了,放出来和大家一起研究一下
原理图
Schematic_SnaillPI_2021-11-05.pdf
PCB尺寸为80*50mm,4层板
所以大概放置再面对屏幕左下角后面
下图可以看做是从后面看
--
目前我发现这样做后,因为屏幕后面全时金属可应该会对天线有影响,其他的还请大佬们指点一下
这是NES模拟器代码,已经修改过了
arm-NES-linux-master.zip
下面是在硬盘中待了10年的nes游戏
roms.zip
u-boot项目
链接:https://pan.baidu.com/s/1WWrzVKYx6EthaJrzLj3mFg
提取码:fwup
内核项目
链接:https://pan.baidu.com/s/1rrNq95bFjStLpEa-sj-O6Q
提取码:qeby
文件系统实在太大了,所以暂时不传了
小白自制Linux开发板 十. NES游戏玩起来
https://www.cnblogs.com/twzy/p/15356127.html
这大概是本系列最后一篇了
我用的是SPI方式,长时间下载东西问题好像不大,但是一旦作为服务器(如web ftp server) 传输一点数据后就直接挂了
root@SnailCard:~#
root@SnailCard:~#
root@SnailCard:~# dmesg |grep wlan0
[ 241.525691] wlan0: authenticate with 78:44:fd:7e:02:88
[ 241.531292] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 241.742250] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 241.755538] wlan0: authenticated
[ 241.772270] wlan0: associate with 78:44:fd:7e:02:88 (try 1/3)
[ 241.982257] wlan0: associate with 78:44:fd:7e:02:88 (try 2/3)
[ 241.998657] wlan0: RX AssocResp from 78:44:fd:7e:02:88 (capab=0x1411 status=0 aid=1)
[ 242.009522] wlan0: associated
[ 242.014791] wlan0: Limiting TX power to 20 (20 - 0) dBm as advertised by 78:44:fd:7e:02:88
[ 572.506851] wlan0: authenticate with 78:44:fd:7e:02:88
[ 572.514157] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 572.725587] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 572.935684] wlan0: send auth to 78:44:fd:7e:02:88 (try 3/3)
[ 573.145784] wlan0: authentication with 78:44:fd:7e:02:88 timed out
找点可用的调试信息都没有,怀疑是不是固件里面有问题了
@twzy
SDIO ESP8089开源Linux驱动现在可以直接编译通过了, 有没有朋友一起试一试
https://whycan.com/t_4326.html#p69705和我这情况一样了, 有人说是电源问题,一脸懵x。
我们一起定位一下问题原因,争取在本帖把这个问题给解决了
@twzy
666666大佬这个ESP8266 SPI模式长时间工作稳定吗?
有个问题,就是当小板作为服务器(web服务器、ftp服务器)的时候,传输一点数据后就自动断开了,不知道怎么处理
root@SnailCard:~# dmesg |grep wlan0
[ 241.525691] wlan0: authenticate with 78:44:fd:7e:02:88
[ 241.531292] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 241.742250] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 241.755538] wlan0: authenticated
[ 241.772270] wlan0: associate with 78:44:fd:7e:02:88 (try 1/3)
[ 241.982257] wlan0: associate with 78:44:fd:7e:02:88 (try 2/3)
[ 241.998657] wlan0: RX AssocResp from 78:44:fd:7e:02:88 (capab=0x1411 status=0 aid=1)
[ 242.009522] wlan0: associated
[ 242.014791] wlan0: Limiting TX power to 20 (20 - 0) dBm as advertised by 78:44:fd:7e:02:88
[ 572.506851] wlan0: authenticate with 78:44:fd:7e:02:88
[ 572.514157] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 572.725587] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 572.935684] wlan0: send auth to 78:44:fd:7e:02:88 (try 3/3)
[ 573.145784] wlan0: authentication with 78:44:fd:7e:02:88 timed out
如果是纯下载没问题的
twzy 说:https://whycan.com/files/members/6376/IMG_4455.jpg
游戏机目标达成,资料整理中……
貌似颜色不对?
已经修复了
处理方式
修改InfoNES_System_Linux.cpp文件中的static int lcd_fb_display_px函数
static int lcd_fb_display_px(WORD color, int x, int y)
{
WORD *pen16;
unsigned char r, g, b;
r = ((color >> 10) & 0x1f);
g = ((color >> 5) & 0x3f);
b = (color & 0x1f);
color = r<<11|g<<6|b;
pen16 = (WORD *)(fb_mem + y*line_width + x*px_width);
*pen16 = color;
return 0;
}
小白自制Linux开发板 九. 修改开机Logo
https://www.cnblogs.com/twzy/p/15356119.html
小白自制Linux开发板 八. Linux音频驱动配置
https://www.cnblogs.com/twzy/p/15356109.html
关于硬件驱动部分的内容基本算是全结束了,积攒的文章也差不多全放完了,后续会集中处理一些bug,更新速度也会随之放缓,还请见谅。
那个显示小企鹅的方式我会放在第九篇。
另外既然是自制开发板,所以这个板子是不卖的,但是硬件相关资料分别在第一篇和第四篇中,在本帖3楼也有链接,软件部分很快整理完成会上传到网盘(因为提及会很大)。到时候会给大家地址。
最后感谢大家支持,过一段时间再见 ^_^
小白自制Linux开发板 七. USB驱动配置
https://www.cnblogs.com/twzy/p/15243838.html
小白自制Linux开发板 六. SPI TFT屏幕修改与移植
https://www.cnblogs.com/twzy/p/15160836.html
本人硬件小白一枚,与2021年4月入住哇酷社区,结识众位大佬,并在各位大佬的帖子中觅得大量的学习资源,最终完成自制小电脑的心愿。既得所愿,现将所有资料汇总成章,整理于此,共享之,再次感谢期间给与支持的晕哥、迪卡大神等大佬。
小白自制Linux开发板 一. 瞎抄原理图与乱画PCB
https://www.cnblogs.com/twzy/p/14714651.html
小白自制Linux开发板 二. u-boot移植
https://www.cnblogs.com/twzy/p/14865952.html
小白自制Linux开发板 三. Linux内核与文件系统移植
https://www.cnblogs.com/twzy/p/15355842.html
小白自制Linux开发板 四. 通过SPI使用ESP8266做无线网卡
https://www.cnblogs.com/twzy/p/15160808.html
小白自制Linux开发板 五. Debian文件系统制作,以及WIFI配置、交换分区配置
https://www.cnblogs.com/twzy/p/15160824.html
小白自制Linux开发板 六. SPI TFT屏幕修改与移植
https://www.cnblogs.com/twzy/p/15160836.html
小白自制Linux开发板 七. USB驱动配置
https://www.cnblogs.com/twzy/p/15243838.html
小白自制Linux开发板 八. Linux音频驱动配置
https://www.cnblogs.com/twzy/p/15356109.html
小白自制Linux开发板 九. 修改开机Logo
https://www.cnblogs.com/twzy/p/15356119.html
小白自制Linux开发板 十. NES游戏玩起来
https://www.cnblogs.com/twzy/p/15356127.html
其他正在整理中
我提取到5.7内核的声音补丁了,直接在sun4i-codec上面改的
下载地址:linux-5.7_音频补丁测试通过.zip
suniv-f1c100s.dtsi
#include <dt-bindings/dma/sun4i-a10.h> //添加头文件
dma: dma-controller@1c02000 {
compatible = "allwinner,suniv-f1c100s-dma";
reg = <0x01c02000 0x1000>;
interrupts = <18>;
clocks = <&ccu CLK_BUS_DMA>;
resets = <&ccu RST_BUS_DMA>;
#dma-cells = <2>;
};
codec: codec@1c23c00 {
compatible = "allwinner,suniv-f1c100s-codec";
reg = <0x01c23c00 0x400>;
interrupts = <21>;
clocks = <&ccu CLK_BUS_CODEC>,
<&ccu CLK_CODEC>;
clock-names = "apb", "codec";
resets = <&ccu RST_BUS_CODEC>;
dmas = <&dma SUN4I_DMA_NORMAL 0x0c>,
<&dma SUN4I_DMA_NORMAL 0x0c>;
dma-names = "rx", "tx";
status = "disabled";
};
suniv-f1c100s-licheepi-nano.dts
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC", "Mic";
status = "okay";
};
配置codec
Device Drivers
<*> Sound card support
<*> Advanced Linux Sound Architecture
<*> ALSA for SoC audio support
-> Allwinner SoC Audio support
配置dma
Device Drivers
<*> DMA Engine support
出来了,它出来了。
他这个cs接地了,我这边死活不显示,把cs与cs连接后,秒出。
这个帖子有坑,cs必须与cs连接起来
另外参考这一篇改了就出来了
https://www.bilibili.com/read/cv9947785?spm_id_from=333.999.0.0
我实在内核5.7.1下成功的
我在硬件部分把PE2拉高了,本帖和
https://whycan.com/t_6021.html
终于搞定通过键盘操作小板了。
感谢楼主。
---
我通过PE8.1芯片扩展了两个usb端口
遇到一个和奇怪的问题,开发板接受数据正常,通过ssh进行访问操作都正常 ,但是只要大量发送数据,比如作为Web服务器被访问,wifi就挂了
root@SnailCard:~# dmesg |grep wlan0
[ 241.525691] wlan0: authenticate with 78:44:fd:7e:02:88
[ 241.531292] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 241.742250] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 241.755538] wlan0: authenticated
[ 241.772270] wlan0: associate with 78:44:fd:7e:02:88 (try 1/3)
[ 241.982257] wlan0: associate with 78:44:fd:7e:02:88 (try 2/3)
[ 241.998657] wlan0: RX AssocResp from 78:44:fd:7e:02:88 (capab=0x1411 status=0 aid=1)
[ 242.009522] wlan0: associated
[ 242.014791] wlan0: Limiting TX power to 20 (20 - 0) dBm as advertised by 78:44:fd:7e:02:88
[ 572.506851] wlan0: authenticate with 78:44:fd:7e:02:88 #在这里开始作为Web服务器被访问
[ 572.514157] wlan0: send auth to 78:44:fd:7e:02:88 (try 1/3)
[ 572.725587] wlan0: send auth to 78:44:fd:7e:02:88 (try 2/3)
[ 572.935684] wlan0: send auth to 78:44:fd:7e:02:88 (try 3/3)
[ 573.145784] wlan0: authentication with 78:44:fd:7e:02:88 timed out
调了好几天,毫无头绪,目前怀疑两点:
1 模块坏了
2 使用的144楼的方案,屏蔽了初始化时的中断检测
[ 81.249796] sun6i-spi 1c05000.spi: chipselect 0 already in use
[ 81.255804] esp8089_spi: FAILED to create slaveSPI-CS 已经被flash使用了吧?
没有flash
设备树配置如下:
dtsi
pio节点下面
spi0_pins: spi0-pins {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
soc节点下面
spi0:spi@1c05000 {
compatible = "allwinner,suniv-spi", "allwinner,sun8i-h3-spi";
reg = <0x01c05000 0x1000>;
interrupts = <0xa>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
clock-names = "ahb", "mod";
resets = <&ccu RST_BUS_SPI0>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
dts
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
status = "okay";
spidev@0x00 {
compatible = "spidev";
spi-max-frequency = <100000000>;
reg = <0>;
};
};
刚好把spi0.0让出来
spi-cs都接地了
问题正好停在在36~37之间的位置
停在距离大神喊牛逼的位置无所适从
[ 80.631193] esp8089_spi: loading out-of-tree module taints kernel.
[ 80.645144] esp8089_spi: EAGLE DRIVER VER bdf5087c3deb
[ 81.249796] sun6i-spi 1c05000.spi: chipselect 0 already in use
[ 81.255804] esp8089_spi: FAILED to create slave
[ 81.260399] 8<--- cut here ---
[ 81.263558] Unable to handle kernel NULL pointer dereference at virtual address 000001b8
[ 81.271743] pgd = (ptrval)
[ 81.274482] [000001b8] *pgd=80ca3831, *pte=00000000, *ppte=00000000
[ 81.280794] Internal error: Oops: 17 [#1] ARM
[ 81.285167] Modules linked in: esp8089_spi(O+)
[ 81.289658] CPU: 0 PID: 122 Comm: insmod Tainted: G W O 5.7.1 #7
大佬们给看看呗
给大家汇报一下最新的调试结果:
板子可以正常执行了
原因出在,串口灯上面:
1.原理图设计错误
2.我给焊反了,不排除因为串联LED降压导致,目前处理方法是替换了两个【0欧】电阻
目前来看Ch340E 那个v3接口接5V应该是能用,电感使用的是1.2A的功率层叠电感
-----------------------------------
项目请使用立创EDA打开
文件:LinuxCard nano.zip
也可以添加:QQ 470200051 获取
https://item.szlcsc.com/product/jpg_73533_0.html 必须要用这种电感, 你板子上蓝色的电感一般都是射频电路用的,用来滤波的。
要是这种估计我的改pcb呢,我买点这种的电感试试,