想照着tina spi lcd文档建个驱动,结果硬件spi没输出。此过程修改了设备树和内核配置。
又想着改回去吧,仍选择fb pannel里的st7789v驱动,设备树也改回选这个,结果编译烧录后,屏上连雪花点都没了。示波器测量软件spi的管脚,sclk, sda, dc, cs,都有信号。
执行cat /dev/fb0,结果输出一堆信息然后就不走了。我记得之前是没信息的。
root@TinaLinux:/# cat /dev/fb0
[ 24.384531] disp_al_manager_apply ouput_type:1
[ 24.389632] genirq: Flags mismatch irq 51. 00000004 (dispaly) vs. 00000004 (dispaly)
[ 24.398393] [DISP] lcd_clk_config,line:774:
[ 24.398404] disp 0, clk: pll(114000000),clk(114000000),dclk(19000000) dsi_rate(114000000)
[ 24.398404] clk real:pll(288000000),clk(288000000),dclk(24000000) dsi_rate(0)
[ 24.420776] [DISP] disp_sys_pwm_config,line:509:
[ 24.420778] disp_sys_pwm_Config, handle is NULL!
[ 24.431137] [DISP] disp_sys_pwm_set_polarity,line:528:
[ 24.431140] disp_sys_pwm_Set_Polarity, handle is NULL!
[ 32.532512] usb1-vbus: disabling
我看信息里又disp_sys_pwm_request,然后就把设备树里lcd_pwm_used = <1>这句给注释了,结果没效果,改为<0>后,才消失一行信息。
---------------------------------------------
索性把内核驱动里的pwm关掉,变成这样了:
oot@TinaLinux:/# cat /dev/fb0
[ 15.285819] disp_al_manager_apply ouput_type:1
[ 15.291006] genirq: Flags mismatch irq 51. 00000004 (dispaly) vs. 00000004 (dispaly)
[ 15.299774] [DISP] lcd_clk_config,line:774:
[ 15.299785] disp 0, clk: pll(114000000),clk(114000000),dclk(19000000) dsi_rate(114000000)
[ 15.299785] clk real:pll(288000000),clk(288000000),dclk(24000000) dsi_rate(0)
Flags mismatch irq 51. 00000004 (dispaly) vs. 00000004 (dispaly)
这咋还有中断了呢?
想接个中景园的1.14寸lcd屏幕,使用的是st7789v芯片,内核驱动里有个st7789v驱动,是用的软件模拟spi控制屏幕的,默认是240*240的。
直接用,在设备树里修改了分辨率和用到的gpio,结果背光亮,屏幕无显示。
中景园例程给的是单片机工程,比对了下初始化时发送的命令,修改st7789v.c里的初始化部分,改成发一样的命令,结果屏幕还是黑的。
单片机工程里用到了dc引脚,spi发送数据是8bit.st7789v.c里没用到dc管脚,发送9bit数据,第一bit表示命令或数据。按单片机工程修改为使用dc引脚,发送8bit数据,屏幕终于出现雪花点了,但是仍不正常。
看网上教程,执行 cat /dev/fb0 > screensnap,然后将screensnap传到Pc上以二进制方式查看:
$ ls -al
-rw-r--r-- 1 any any 129600 12月 2 16:33 screensnap
$ hexdump screensnap
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
001fa40
看软件模拟Spi发送数据时,每bit之间没有延迟,手动加了个延时,结果还是雪花点。
---------------------------------------------------------------------------------------
去掉延时。按找单片机例程,在st7789.c屏幕初始化的末尾,加了段区域填充的语句,结果屏幕初始化后,可以看到填充的句型,虽然分成了两条...
这么说,屏幕初始化其实是成功了。但是为何colorbar运行无反映?qt程序运行也无反映?
------------------------------------------------------------------------------------------
我是按单片机例程里填充区域写了几句:
初始化后,填充一小块矩形;
LCD_Address_Set(0, 0, 29, 29);
1 for (i = 0; i < 30; i++)
2 {
3 for (j = 0; j < 30; j++)
4 {
5 st7789v_spi_write_data(0xFF);
6 st7789v_spi_write_data(0xFF);
7 }
8 }
设置填充区域:
static void LCD_Address_Set(u16 x1, u16 y1, u16 x2, u16 y2)
1 {
2 st7789v_spi_write_cmd(0x2a);
3 st7789v_spi_write_data(0x00);
4 st7789v_spi_write_data(x1+52);
5 st7789v_spi_write_data(0x00);
6 st7789v_spi_write_data(x2+52);
7 st7789v_spi_write_cmd(0x2b);
8 st7789v_spi_write_data(0x00);
9 st7789v_spi_write_data(y1+40);
10 st7789v_spi_write_data(0x00);
11 st7789v_spi_write_data(y2+40);
12 st7789v_spi_write_cmd(0x2c);
13 }
这样,初始化后,屏幕确实可以刷出个白色矩形区域来。
但有个疑问:
struct __lcd_panel st7789v_panel = {
1 /* panel driver name, must mach the name of lcd_drv_name in sys_config.fex
2 */
3 .name = "st7789v",
4 .func = {
5 .cfg_panel_info = LCD_cfg_panel_info,
6 .cfg_open_flow = LCD_open_flow,
7 .cfg_close_flow = LCD_close_flow,
8 .lcd_user_defined_func = LCD_user_defined_func,
9 },
10 };
该驱动函数为上层函数其实只提供了这4个函数,user这个函数直接返回0。open函数里执行了屏幕初始化操作。
按单片机例程,无论画线还是画块,都是要先设置起始坐标的,也即是要发送0x2a, 0x2b, 0x2c这三组命令,但是我没看到有这些操作。
@bestikun
还真是,感谢。
把这个bt的引脚注释掉后,i2c2出现了。
之前只搜了PE13,没想到中间加个空格也不影响,对设备树语法还是不熟悉。
---------------------------------------------------
/* bt_rst_n = <&pio PE 13 GPIO_ACTIVE_LOW>; */
仔细想了想,这不是设备树的pio写法。PE 13本来就是两个参数。
注释了这句或者改为其他IO后,i2c2可以成功创建了,但是adb功能有没了。
发现设备树里usb0有这句:
/* usb_id_gpio = <&pio PE 12 GPIO_ACTIVE_HIGH>; */
和i2c2管脚也冲突了。
注释掉后正常了。
那么,usb id可以不用?
还有个问题:
按这个教程,我在/etc/init.d/目录下加了个S99qtapp,给予了执行权限,添加了如下内容。
#!/bin/sh
#
# Start Qt app
#
start() {
printf "Start qt app ..."
/home/app 1
}
stop() {
printf "Stopping qt app ..."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
写了个简单应用,qDebug打印了个"hello"。可启动后,调试串口没看到有打印,手动执行倒是能看到。
开机信息里相关信息如下:
[ 2.323168] sunxi-i2c sunxi-i2c1: sunxi-i2c1 supply twi not found, using dummy regulator
[ 2.333103] sunxi-i2c sunxi-i2c1: probe success
[ 2.338516] sun8iw20-pinctrl 2000000.pinctrl: pin PE13 already requested by 2000000.pinctrl:141; cannot claim for 2502800
[ 2.351237] sun8iw20-pinctrl 2000000.pinctrl: pin-141 (2502800.twi) status -22
[ 2.359364] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 141 (PE13) from group PE13 on device 2000000.pinctrl
[ 2.371678] sunxi-i2c 2502800.twi: Error applying setting, reverse things back
[ 2.379819] sunxi-i2c: probe of 2502800.twi failed with error -22
[ 2.388118] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pb not found, using dummy regulator
[ 2.400490] get ehci0-controller wakeup-source is fail.
内核设备树相关如下:
&pio {
twi2_pins_a: twi2@0 {
pins = "PE12", "PE13";
function = "twi2";
muxsel = <2>;
drive-strength = <10>;
};
twi2_pins_b: twi2@1 {
pins = "PE12", "PE13";
function = "gpio_in";
};
};
&twi2 {
clock-frequency = <400000>;
pinctrl-0 = <&twi2_pins_a>;
/* pinctrl-1 = <&twi2_pins_b>; */
pinctrl-names = "default", "sleep";
/* dmas = <&dma 45>, <&dma 45>; */
/* dma-names = "tx", "rx"; */
status = "okay";
adxl345: gpio@53 {
compatible = "allwinner, adxl345_i2c";
reg = <0x53>;
status = "okay";
};
};
将twi2_pins引脚改为PG14,PG15,能显示出i2c2设备。
请教,这是哪里设置错了?
附件是设备树文件。
board.txt
sun8iw20p1.txt
之前用spinand,从上电到进入系统,大约用10秒左右,改成emmc后,大约用6.5秒多一点,效果还是挺明显的。
记录下遇到的问题。
1 sdk,mango的github上的仓库下架后,下载sdk不是那么方便了,不过有些网盘还是有2.0,2.1的sdk的。有的比较大,8G的,11G的,有的较小是4G左右。不过是个repo文件,需要执行下命令,然后也就是8G多了。而且只是d1-h的sdk,然后需要找yuzu的补丁,原版仓库也下架了,不过github上有其他网友转存了。打上补丁后,就有t113s3-nezha了。
2 电源部分,这次先焊了各路dc/dc和t113s3,结果晶振一直不起振。后来发现是vcc-rtc没接,芯片就不工作。板子上有2个1.8V,一个是dcdc,一个是芯片自带的ldoa输出。vcc-rtc焊接到ldoa了,结果一个板子正常启动了,另一个发现dc/dc的1.8V不稳定了,从2.4-3.1V变化。将vcc-rtc焊接到dcdc的1.8V也不行。不过发现了个现象,用热风枪加热芯片后的一段时间内,dc/dc的1.8V是稳定的。这时能烧录程序,过一会就不行了,dcdc 1.8V就开始变化。将t113s3吹下来后重新焊接,vcc-rtc接在dcdc 1.8v,这时dcdc1.8V暂时稳定了,ldoa的输出变成2.7V了。程序较大时无法完成烧录,解决不了暂时放一边去了。ldoa输出接了AVCC和HPVCC,dcdc的1.8V接到了其他需要1.8V的地方。感觉可能时内部ldo坏了,这些需要1.8V的供电内部有的可能连到了一块?
3 调试串口,参考的https://blog.csdn.net/qq_39721016/article/details/125524789,结果uboot正常,跳转到内核就没信息了。最后发现还需要设置内核配置里的kernel hacking里的串口的物理和虚拟地址。更改后就可以看到内核调试信息了。
4 emmc部分,用了米德方客的4g容量的emmc,做了等长和阻抗。进内核以后加载根文件系统时,提示找不到mmcblk5,往上翻,看到有错误提示pc2被用作spi了不能再用作emmc引脚。找到内核设备树,关掉spi0功能,可以进到系统了。
同样使用emmc遇到了问题。
使用emmc,且调试串口修改为uart0。
修改了sys_concig.fex,设置调试串口为uart0。
一开始我也是卡在了
M/TC: OP-TEE version: 6aef7bb2-dirty (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)) #1 Fri Jul 23 09:25:11 UTC 2021 arm
后来发现是uboot里没有设置uart为调试串口,设置uboot的sun8iw20p1_uart3_defconfig里的CONFIG_CONS_INDEX=1后,可以看到能进入uboot里。
但是最后启动内核没成功:
[30]HELLO! BOOT0 is starting!
[33]BOOT0 commit : 88480af-dirty
[36]set pll start
[42]periph0 has been enabled
[45]set pll end
[46][pmu]: bus read error
[49]board init ok
[51]ZQ value = 0x2f
[52]get_pmu_exist() = -1
[55]DRAM BOOT DRIVE INFO: V0.33
[58]DRAM CLK = 936 MHz
[60]DRAM Type = 3 (2:DDR2,3:DDR3)
[63]DRAMC read ODT off.
[65]DRAM ODT value: 0x42.
[68]ddr_efuse_type: 0xa
[71]DRAM SIZE =128 M
[73]dram_tpr4:0x0
[75]PLL_DDR_CTRL_REG:0xf8004d00
[78]DRAM_CLK_REG:0xc0000000
[80][TIMING DEBUG] MR2= 0x20
[88]DRAM simple test OK.
[90]rtc standby flag is 0x0, super standby flag is 0x0
[95]dram size =128
[98]card no is 2
[100]sdcard 2 line count 4
[102][mmc]: mmc driver ver 2021-05-21 14:47
[112][mmc]: Wrong media type 0x0, but host sdc2, try mmc first
[117][mmc]: ***Try MMC card 2***
[140][mmc]: RMCA OK!
[142][mmc]: mmc 2 bias 0
[154][mmc]: MMC 5.1
[156][mmc]: HSSDR52/SDR25 4 bit
[159][mmc]: 50000000 Hz
[161][mmc]: 3700 MB
[163][mmc]: ***SD/MMC 2 init OK!!!***
[234]Loading boot-pkg Succeed(index=0).
[238]Entry_name = u-boot
[243]Entry_name = optee
[247]Entry_name = dtb
[250]tunning data addr:0x430003e8
[253]Jump to second Boot.
M/TC: OP-TEE version: 6aef7bb2-dirty (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)) #1 Fri Jul 23 09:25: m
U-Boot 2018.07-ge987def5-dirty (Nov 27 2024 - 10:42:25 +0800) Allwinner Technology
[00.307]CPU: Allwinner Family
[00.309]Model: sun8iw20
I2C: FDT ERROR:fdt_set_all_pin:[twi0]-->FDT_ERR_BADPATH
FDT ERROR:fdt_set_all_pin:[twi1]-->FDT_ERR_BADPATH
ready
[00.331]DRAM: 128 MiB
[00.334]Relocation Offset is: 04eff000
[00.353]secure enable bit: 0
[00.356]smc_tee_inform_fdt failed with: ffff000a
[00.362]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz
[00.368]gic: sec monitor mode
sunxi flash map init
[00.373]flash init start
[00.375]workmode = 0,storage type = 2
[00.378][mmc]: mmc driver ver uboot2018:2021-12-20 13:35:00
[00.385][mmc]: SUNXI SDMMC Controller Version:0x50310
[00.413][mmc]: Best spd md: 2-HSDDR52/DDR50, freq: 2-50000000, Bus width: 4
[00.420]sunxi flash init ok
[00.425]Loading Environment from SUNXI_FLASH... OK
[00.439]Item0 (Map) magic is bad
[00.442]the secure storage item0 copy0 magic is bad
[00.446]Item0 (Map) magic is bad
[00.449]the secure storage item0 copy1 magic is bad
[00.454]Item0 (Map) magic is bad
secure storage read widevine fail
[00.460]secure storage read widevine fail with:-1
secure storage read ec_key fail
[00.467]secure storage read ec_key fail with:-1
secure storage read ec_cert1 fail
[00.474]secure storage read ec_cert1 fail with:-1
secure storage read ec_cert2 fail
[00.482]secure storage read ec_cert2 fail with:-1
secure storage read ec_cert3 fail
[00.489]secure storage read ec_cert3 fail with:-1
secure storage read rsa_key fail
[00.496]secure storage read rsa_key fail with:-1
secure storage read rsa_cert1 fail
[00.504]secure storage read rsa_cert1 fail with:-1
secure storage read rsa_cert2 fail
[00.512]secure storage read rsa_cert2 fail with:-1
secure storage read rsa_cert3 fail
[00.519]secure storage read rsa_cert3 fail with:-1
[00.524]out of usb burn from boot: not need burn key
root_partition is rootfs
set root to /dev/mmcblk0p5
[00.533]update part info
[00.536]update bootcmd
[00.538]change working_fdt 0x43ebee70 to 0x43e9ee70
[00.543][mmc]: no mmc-hs400-1_8v!
[00.546][mmc]: delete mmc-hs200-1_8v from dtb
[00.550][mmc]: get max-frequency ok 50000000 Hz
disable nand error: FDT_ERR_BADPATH
[00.568]update dts
Hit any key to stop autoboot: 0
[05.667]no vendor_boot partition is found
Android's image name: t113-nezha
[05.679]Starting kernel ...
[05.681][mmc]: mmc exit start
[05.698][mmc]: mmc 2 exit ok
停止autoboot后,printenv如下:
=> printenv
boot_dsp0=sunxi_flash read 45000000 ${dsp0_partition};bootr 45000000 0 0
boot_fastboot=fastboot
boot_normal=sunxi_flash read 45000000 ${boot_partition};bootm 45000000
boot_partition=boot
boot_recovery=sunxi_flash read 45000000 recovery;bootm 45000000
bootcmd=run setargs_mmc boot_normal
bootdelay=5
cma=8M
console=ttyS0,115200
dsp0_partition=dsp0
earlyprintk=sunxi-uart,0x02500000
fdtcontroladdr=43ebee70
force_normal_boot=1
init=/pseudo_init
initcall_debug=0
keybox_list=widevine,ec_key,ec_cert1,ec_cert2,ec_cert3,rsa_key,rsa_cert1,rsa_cert2,rsa_cert3
loglevel=8
mmc_root=/dev/mmcblk0p5
mtd_name=sys
mtdids=
mtdparts=
nand_root=/dev/ubiblock0_5
partition=
partitions=boot-resource@mmcblk0p1:env@mmcblk0p2:env-redund@mmcblk0p3:boot@mmcblk0p4:rootfs@mmcblk0p5:private@m 8
root_partition=rootfs
rootfstype=ext4
setargs_mmc=setenv bootargs earlyprintk=${earlyprintk} clk_ignore_unused initcall_debug=${initcall_debug} cons 1
setargs_nand=setenv bootargs ubi.mtd=${mtd_name} ubi.block=0,${root_partition} earlyprintk=${earlyprintk} clk_i 1
setargs_nand_ubi=setenv bootargs ubi.mtd=${mtd_name} ubi.block=0,${root_partition} earlyprintk=${earlyprintk} c 1
Environment size: 2005/131067 bytes
请教,这是哪里设置出错了?
--------------------------------------------
进展了一点。
其实是进到内核里了,只是内核状态时调试串口没改对。
make kernel_menuconfig/kernel hacking里,有个串口的物理地址和虚拟地址,改成uart0对应的0x02500000后就可以了。
但是加载根文件系统失败:
[30]HELLO! BOOT0 is starting!
[33]BOOT0 commit : 88480af-dirty
[36]set pll start
[42]periph0 has been enabled
[45]set pll end
[46][pmu]: bus read error
[49]board init ok
[51]ZQ value = 0x2f
[52]get_pmu_exist() = -1
[55]DRAM BOOT DRIVE INFO: V0.33
[58]DRAM CLK = 936 MHz
[60]DRAM Type = 3 (2:DDR2,3:DDR3)
[63]DRAMC read ODT off.
[65]DRAM ODT value: 0x42.
[68]ddr_efuse_type: 0xa
[71]DRAM SIZE =128 M
[73]dram_tpr4:0x0
[75]PLL_DDR_CTRL_REG:0xf8004d00
[78]DRAM_CLK_REG:0xc0000000
[80][TIMING DEBUG] MR2= 0x20
[88]DRAM simple test OK.
[90]rtc standby flag is 0x0, super standby flag is 0x0
[95]dram size =128
[98]card no is 2
[100]sdcard 2 line count 4
[102][mmc]: mmc driver ver 2021-05-21 14:47
[111][mmc]: Wrong media type 0x0, but host sdc2, try mmc first
[117][mmc]: ***Try MMC card 2***
[140][mmc]: RMCA OK!
[142][mmc]: mmc 2 bias 0
[154][mmc]: MMC 5.1
[156][mmc]: HSSDR52/SDR25 4 bit
[158][mmc]: 50000000 Hz
[161][mmc]: 3700 MB
[163][mmc]: ***SD/MMC 2 init OK!!!***
[234]Loading boot-pkg Succeed(index=0).
[237]Entry_name = u-boot
[243]Entry_name = optee
[247]Entry_name = dtb
[250]tunning data addr:0x430003e8
[253]Jump to second Boot.
M/TC: OP-TEE version: 6aef7bb2-dirty (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)) #1 Fri Jul 23 09m
U-Boot 2018.07-ge987def5-dirty (Nov 27 2024 - 14:56:37 +0800) Allwinner Technology
[00.306]CPU: Allwinner Family
[00.309]Model: sun8iw20
I2C: FDT ERROR:fdt_set_all_pin:[twi0]-->FDT_ERR_BADPATH
FDT ERROR:fdt_set_all_pin:[twi1]-->FDT_ERR_BADPATH
ready
[00.330]DRAM: 128 MiB
[00.334]Relocation Offset is: 04eff000
[00.353]secure enable bit: 0
[00.356]smc_tee_inform_fdt failed with: ffff000a
[00.361]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz
[00.367]gic: sec monitor mode
sunxi flash map init
[00.372]flash init start
[00.374]workmode = 0,storage type = 2
[00.378][mmc]: mmc driver ver uboot2018:2021-12-20 13:35:00
[00.384][mmc]: SUNXI SDMMC Controller Version:0x50310
[00.413][mmc]: Best spd md: 2-HSDDR52/DDR50, freq: 2-50000000, Bus width: 4
[00.420]sunxi flash init ok
[00.425]Loading Environment from SUNXI_FLASH... OK
[00.439]Item0 (Map) magic is bad
[00.441]the secure storage item0 copy0 magic is bad
[00.446]Item0 (Map) magic is bad
[00.449]the secure storage item0 copy1 magic is bad
[00.454]Item0 (Map) magic is bad
secure storage read widevine fail
[00.460]secure storage read widevine fail with:-1
secure storage read ec_key fail
[00.467]secure storage read ec_key fail with:-1
secure storage read ec_cert1 fail
[00.474]secure storage read ec_cert1 fail with:-1
secure storage read ec_cert2 fail
[00.482]secure storage read ec_cert2 fail with:-1
secure storage read ec_cert3 fail
[00.489]secure storage read ec_cert3 fail with:-1
secure storage read rsa_key fail
[00.496]secure storage read rsa_key fail with:-1
secure storage read rsa_cert1 fail
[00.504]secure storage read rsa_cert1 fail with:-1
secure storage read rsa_cert2 fail
[00.511]secure storage read rsa_cert2 fail with:-1
secure storage read rsa_cert3 fail
[00.519]secure storage read rsa_cert3 fail with:-1
[00.524]out of usb burn from boot: not need burn key
root_partition is rootfs
set root to /dev/mmcblk0p5
[00.533]update part info
[00.536]update bootcmd
[00.538]change working_fdt 0x43ebee70 to 0x43e9ee70
[00.543][mmc]: no mmc-hs400-1_8v!
[00.546][mmc]: delete mmc-hs200-1_8v from dtb
[00.550][mmc]: get max-frequency ok 50000000 Hz
disable nand error: FDT_ERR_BADPATH
[00.568]update dts
Hit any key to stop autoboot: 0
[01.659]no vendor_boot partition is found
Android's image name: t113-nezha
[01.670]Starting kernel ...
[01.673][mmc]: mmc exit start
[01.690][mmc]: mmc 2 exit ok
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.61 (any@Any-PC) (arm-openwrt-linux-muslgnueabi-gcc.bin (OpenWrt/Linaro GCC4
[ 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 instruction cache
[ 0.000000] OF: fdt: Machine model: sun8iw20
[ 0.000000] printk: bootconsole [earlycon0] enabled
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 8 MiB at 0x47800000
[ 0.000000] On node 0 totalpages: 32768
[ 0.000000] Normal zone: 256 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 32768 pages, LIFO batch:7
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.0 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: MIGRATE_INFO_TYPE not supported.
[ 0.000000] psci: SMC Calling Convention v1.0
[ 0.000000] percpu: Embedded 15 pages/cpu s30348 r8192 d22900 u61440
[ 0.000000] pcpu-alloc: s30348 r8192 d22900 u61440 alloc=15*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: earlyprintk=sunxi-uart,0x02500000 clk_ignore_unused initcall_debug=0 co
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 109652K/131072K available (6144K kernel code, 254K rwdata, 1484K rodata, 1024K init,)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x264/0x3e8 with crng_init=0
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: s
[ 0.000006] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.008007] Switching to timer-based delay loop, resolution 41ns
[ 0.014184] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.023886] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (l)
[ 0.034267] pid_max: default: 32768 minimum: 301
[ 0.039015] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.046348] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.054665] CPU: Testing write buffer coherency: ok
[ 0.059878] /cpus/cpu@0 missing clock-frequency property
[ 0.065193] /cpus/cpu@1 missing clock-frequency property
[ 0.070540] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.076704] Setting up static identity map for 0x40100000 - 0x40100060
[ 0.083365] rcu: Hierarchical SRCU implementation.
[ 0.088565] smp: Bringing up secondary CPUs ...
[ 0.094185] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.094303] smp: Brought up 1 node, 2 CPUs
[ 0.104149] SMP: Total of 2 processors activated (96.00 BogoMIPS).
[ 0.110344] CPU: All CPU(s) started in SVC mode.
[ 0.115414] devtmpfs: initialized
[ 0.130076] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.138205] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000s
[ 0.148069] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[ 0.155302] pinctrl core: initialized pinctrl subsystem
[ 0.161482] NET: Registered protocol family 16
[ 0.167335] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.203258] rtc_ccu: sunxi ccu init OK
[ 0.209320] ccu: sunxi ccu init OK
[ 0.213146] r_ccu: sunxi ccu init OK
[ 0.233999] sun6i-dma 3002000.dma-controller: sunxi dma probed
[ 0.241582] iommu: Default domain type: Translated
[ 0.246618] sunxi iommu: irq = 24
[ 0.250832] SCSI subsystem initialized
[ 0.254790] usbcore: registered new interface driver usbfs
[ 0.260352] usbcore: registered new interface driver hub
[ 0.265739] usbcore: registered new device driver usb
[ 0.271613] Advanced Linux Sound Architecture Driver Initialized.
[ 0.278432] Bluetooth: Core ver 2.22
[ 0.282073] NET: Registered protocol family 31
[ 0.286519] Bluetooth: HCI device and connection manager initialized
[ 0.292925] Bluetooth: HCI socket layer initialized
[ 0.297798] Bluetooth: L2CAP socket layer initialized
[ 0.302865] Bluetooth: SCO socket layer initialized
[ 0.308010] pwm module init!
[ 0.312054] g2d 5410000.g2d: Adding to iommu group 0
[ 0.317317] G2D: rcq version initialized.major:252
[ 0.322868] clocksource: Switched to clocksource arch_sys_counter
[ 0.337301] sun8iw20-pinctrl 2000000.pinctrl: initialized sunXi PIO driver
[ 0.346605] NET: Registered protocol family 2
[ 0.351522] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.359946] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.367643] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.374747] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.381194] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.387775] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.394967] NET: Registered protocol family 1
[ 0.400265] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pc not found, using dummy regulr
[ 0.410577] spi spi0: spi0 supply spi not found, using dummy regulator
[ 0.417298] sunxi_spi_resource_get()2438 - [spi0] SPI MASTER MODE
[ 0.423461] sunxi_spi_resource_get()2476 - Failed to get sample mode
[ 0.429822] sunxi_spi_resource_get()2481 - Failed to get sample delay
[ 0.436277] sunxi_spi_resource_get()2485 - sample_mode:-1431633921 sample_delay:-1431633921
[ 0.444703] sunxi_spi_clk_init()2527 - [spi0] mclk 100000000
[ 0.450956] sunxi_spi_probe()2978 - [spi0]: driver probe succeed, base c881f000, irq 41
[ 0.460525] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[ 0.471877] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.477898] ntfs: driver 2.1.32 [Flags: R/W].
[ 0.511002] io scheduler mq-deadline registered
[ 0.515564] io scheduler kyber registered
[ 0.520592] [DISP]disp_module_init
[ 0.524569] disp 5000000.disp: Adding to iommu group 0
[ 0.530243] [DISP] parser_disp_init_para,line:1430:
[ 0.530247] of_property_read fb0_width fail
[ 0.550519] disp 5000000.disp: 5000000.disp supply vcc-lcd not found, using dummy regulator
[ 0.559092] disp 5000000.disp: 5000000.disp supply vcc-pd not found, using dummy regulator
[ 0.572289] [DISP] disp_sys_pwm_request,line:442:
[ 0.572294] disp_sys_pwm_request pwm 8 fail! -517
[ 0.581720] [DISP] disp_sys_pwm_config,line:509:
[ 0.581723] disp_sys_pwm_Config, handle is NULL!
[ 0.591394] display_fb_request,fb_id:0
[ 0.595407] [DISP] Fb_copy_boot_fb,line:1445:
[ 0.595411] no boot_fb0
[ 0.602627] disp_al_manager_apply ouput_type:0
[ 0.607601] [DISP]disp_module_init finish
[ 0.612414] [DISP] lcd_clk_config,line:774:
[ 0.612425] disp 0, clk: pll(114000000),clk(114000000),dclk(19000000) dsi_rate(114000000)
[ 0.612425] clk real:pll(288000000),clk(288000000),dclk(24000000) dsi_rate(0)
[ 0.612722] sunxi_sid_init()783 - insmod ok
[ 0.616688] [DISP] disp_sys_pwm_request,line:442:
[ 0.616692] disp_sys_pwm_request pwm 8 fail! -517
[ 0.633579] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pe not found, using dummy regulr
[ 0.636671] [DISP] disp_sys_pwm_config,line:509:
[ 0.636673] disp_sys_pwm_Config, handle is NULL!
[ 0.641700] uart uart0: uart0 supply uart not found, using dummy regulator
[ 0.646108] [DISP] disp_sys_pwm_set_polarity,line:528:
[ 0.646112] disp_sys_pwm_Set_Polarity, handle is NULL!
[ 0.682642] uart0: ttyS0 at MMIO 0x2500000 (irq = 34, base_baud = 1500000) is a SUNXI
[ 0.690545] sw_console_setup()1807 - console setup baud 115200 parity n bits 8, flow n
[ 0.698526] printk: console [ttyS0] enabled
[ 0.698526] printk: console [ttyS0] enabled
[ 0.707401] printk: bootconsole [earlycon0] disabled
[ 0.707401] printk: bootconsole [earlycon0] disabled
[ 0.718734] misc dump reg init
[ 0.723315] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pg not found, using dummy regulr
[ 0.734524] sunxi-rfkill soc@3000000:rfkill@0: module version: v1.0.9
[ 0.741764] sunxi-rfkill soc@3000000:rfkill@0: get gpio chip_en failed
[ 0.749118] sunxi-rfkill soc@3000000:rfkill@0: get gpio power_en failed
[ 0.756557] sunxi-rfkill soc@3000000:rfkill@0: wlan_busnum (1)
[ 0.763114] sunxi-rfkill soc@3000000:rfkill@0: Missing wlan_power.
[ 0.770060] sunxi-rfkill soc@3000000:rfkill@0: wlan clock[0] (32k-fanout1)
[ 0.777818] sunxi-rfkill soc@3000000:rfkill@0: wlan_regon gpio=204 assert=1
[ 0.785682] sunxi-rfkill soc@3000000:rfkill@0: wlan_hostwake gpio=202 assert=1
[ 0.793813] sunxi-rfkill soc@3000000:rfkill@0: wakeup source is enabled
[ 0.801437] sunxi-rfkill soc@3000000:rfkill@0: Missing bt_power.
[ 0.808214] sunxi-rfkill soc@3000000:rfkill@0: bt clock[0] (32k-fanout1)
[ 0.815763] sunxi-rfkill soc@3000000:rfkill@0: bt_rst gpio=141 assert=0
[ 0.823768] [ADDR_MGT] addr_mgt_probe: module version: v1.0.11
[ 0.830930] [ADDR_MGT] addr_mgt_probe: success.
[ 0.836313] dma-buf: Running sanitycheck
[ 0.840710] dma-buf: Running dma_fence
[ 0.844971] sizeof(dma_fence)=48
[ 0.848682] dma-buf: Running dma_fence/sanitycheck
[ 0.854081] dma-buf: Running dma_fence/test_signaling
[ 0.859745] dma-buf: Running dma_fence/test_add_callback
[ 0.865742] dma-buf: Running dma_fence/test_late_add_callback
[ 0.872187] dma-buf: Running dma_fence/test_rm_callback
[ 0.878067] dma-buf: Running dma_fence/test_late_rm_callback
[ 0.884428] dma-buf: Running dma_fence/test_status
[ 0.889799] dma-buf: Running dma_fence/test_error
[ 0.895085] dma-buf: Running dma_fence/test_wait
[ 0.900263] dma-buf: Running dma_fence/test_wait_timeout
[ 0.942879] dma-buf: Running dma_fence/test_stub
[ 0.948075] dma-buf: Running dma_fence/race_signal_callback
[ 1.022884] thread_signal_callback[0] completed 36031 passes, 196 misses
[ 1.030423] thread_signal_callback[1] completed 36038 passes, 204 misses
[ 1.102886] thread_signal_callback[0] completed 39420 passes, 39420 misses
[ 1.110627] thread_signal_callback[1] completed 39379 passes, 39378 misses
[ 1.118903] libphy: Fixed MDIO Bus: probed
[ 1.124218] sun8iw20-pinctrl 2000000.pinctrl: pin PE2 already requested by 2500000.uart; cannot claim foh
[ 1.136206] sun8iw20-pinctrl 2000000.pinctrl: pin-130 (4500000.eth) status -22
[ 1.144382] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 130 (PE2) from group PE2 on device l
[ 1.156499] sunxi-gmac 4500000.eth: Error applying setting, reverse things back
[ 1.164750] sunxi-gmac: probe of 4500000.eth failed with error -22
[ 1.171853] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.179218] sunxi-ehci: EHCI SUNXI driver
[ 1.184283] get ehci1-controller wakeup-source is fail.
[ 1.190241] sunxi ehci1-controller don't init wakeup source
[ 1.196582] [sunxi-ehci1]: probe, pdev->name: 4200000.ehci1-controller, sunxi_ehci: 0xc0b5a928, 0x:c8835d
[ 1.208635] sunxi-ehci 4200000.ehci1-controller: 4200000.ehci1-controller supply drvvbus not found, usinr
[ 1.221121] sunxi-ehci 4200000.ehci1-controller: 4200000.ehci1-controller supply hci not found, using dur
[ 1.233304] sunxi-ehci 4200000.ehci1-controller: EHCI Host Controller
[ 1.240558] sunxi-ehci 4200000.ehci1-controller: new USB bus registered, assigned bus number 1
[ 1.250561] sunxi-ehci 4200000.ehci1-controller: irq 61, io mem 0x04200000
[ 1.282895] sunxi-ehci 4200000.ehci1-controller: USB 2.0 started, EHCI 1.00
[ 1.291529] hub 1-0:1.0: USB hub found
[ 1.295791] hub 1-0:1.0: 1 port detected
[ 1.300736] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.307721] sunxi-ohci: OHCI SUNXI driver
[ 1.312693] get ohci1-controller wakeup-source is fail.
[ 1.318671] sunxi ohci1-controller don't init wakeup source
[ 1.324941] [sunxi-ohci1]: probe, pdev->name: 4200400.ohci1-controller, sunxi_ohci: 0xc0b5abb8
[ 1.334635] sunxi-ohci 4200400.ohci1-controller: 4200400.ohci1-controller supply drvvbus not found, usinr
[ 1.347137] sunxi-ohci 4200400.ohci1-controller: 4200400.ohci1-controller supply hci not found, using dur
[ 1.359333] sunxi-ohci 4200400.ohci1-controller: OHCI Host Controller
[ 1.366616] sunxi-ohci 4200400.ohci1-controller: new USB bus registered, assigned bus number 2
[ 1.379560] sunxi-ohci 4200400.ohci1-controller: irq 62, io mem 0x04200400
[ 1.457656] hub 2-0:1.0: USB hub found
[ 1.461906] hub 2-0:1.0: 1 port detected
[ 1.466984] i2c /dev entries driver
[ 1.470971] sunxi cedar version 1.1
[ 1.475093] sunxi-cedar 1c0e000.ve: Adding to iommu group 0
[ 1.481406] VE: sunxi_cedar_probe power-domain init!!!
[ 1.487266] VE: install start!!!
[ 1.487266]
[ 1.492752] VE: cedar-ve the get irq is 42
[ 1.492752]
[ 1.499209] VE: ve_debug_proc_info:(ptrval), data:(ptrval), lock:(ptrval)
[ 1.499209]
[ 1.508503] VE: install end!!!
[ 1.508503]
[ 1.513593] VE: sunxi_cedar_probe
[ 1.517554] Bluetooth: HCI UART driver ver 2.3
[ 1.522539] Bluetooth: HCI UART protocol H4 registered
[ 1.528322] Bluetooth: HCI UART protocol BCSP registered
[ 1.534576] Bluetooth: XRadio Bluetooth LPM Mode Driver Ver 1.0.10
[ 1.542508] sun8iw20-pinctrl 2000000.pinctrl: pin PC2 already requested by 4025000.spi; cannot claim forc
[ 1.554542] sun8iw20-pinctrl 2000000.pinctrl: pin-66 (4022000.sdmmc) status -22
[ 1.562745] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 66 (PC2) from group PC2 on device 2l
[ 1.574764] sunxi-mmc 4022000.sdmmc: Error applying setting, reverse things back
[ 1.583103] sunxi-mmc: probe of 4022000.sdmmc failed with error -22
[ 1.591116] sunxi-mmc 4020000.sdmmc: SD/MMC/SDIO Host Controller Driver(v4.25 2022-6-21 13:40)
[ 1.601006] sunxi-mmc 4020000.sdmmc: ***ctl-spec-caps*** 8
[ 1.607214] sunxi-mmc 4020000.sdmmc: No vmmc regulator found
[ 1.613576] sunxi-mmc 4020000.sdmmc: No vqmmc regulator found
[ 1.620020] sunxi-mmc 4020000.sdmmc: No vdmmc regulator found
[ 1.626477] sunxi-mmc 4020000.sdmmc: No vd33sw regulator found
[ 1.633030] sunxi-mmc 4020000.sdmmc: No vd18sw regulator found
[ 1.639571] sunxi-mmc 4020000.sdmmc: No vq33sw regulator found
[ 1.646122] sunxi-mmc 4020000.sdmmc: No vq18sw regulator found
[ 1.653103] sunxi-mmc 4020000.sdmmc: Got CD GPIO
[ 1.658466] sunxi-mmc 4020000.sdmmc: set cd-gpios as 24M fail
[ 1.665119] sunxi-mmc 4020000.sdmmc: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12)B
[ 1.676301] sunxi-mmc 4020000.sdmmc: no vqmmc,Check if there is regulator
[ 1.696461] sunxi-mmc 4020000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SB
[ 1.720873] sunxi-mmc 4020000.sdmmc: detmode:gpio irq
[ 1.726604] sunxi-mmc 4020000.sdmmc: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12)B
[ 1.738216] sunxi-mmc 4021000.sdmmc: SD/MMC/SDIO Host Controller Driver(v4.25 2022-6-21 13:40)
[ 1.748096] sunxi-mmc 4021000.sdmmc: ***ctl-spec-caps*** 8
[ 1.754311] sunxi-mmc 4021000.sdmmc: No vmmc regulator found
[ 1.760659] sunxi-mmc 4021000.sdmmc: No vqmmc regulator found
[ 1.767117] sunxi-mmc 4021000.sdmmc: No vdmmc regulator found
[ 1.773572] sunxi-mmc 4021000.sdmmc: No vd33sw regulator found
[ 1.780113] sunxi-mmc 4021000.sdmmc: No vd18sw regulator found
[ 1.786666] sunxi-mmc 4021000.sdmmc: No vq33sw regulator found
[ 1.793218] sunxi-mmc 4021000.sdmmc: No vq18sw regulator found
[ 1.799776] sunxi-mmc 4021000.sdmmc: Cann't get pin bias hs pinstate,check if needed
[ 1.809140] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 0Hz bm PP pm UP vdd 21 width 1 timing LEGACY(SDR12)B
[ 1.820365] sunxi-mmc 4021000.sdmmc: no vqmmc,Check if there is regulator
[ 1.840527] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SB
[ 1.864764] sunxi-mmc 4021000.sdmmc: detmode:manually by software
[ 1.872437] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 52, RTO !!
[ 1.872590] sunxi_led_probe()1749 - start
[ 1.883882] sunxi_get_str_of_property()1595 - failed to get the string of propname led_regulator!
[ 1.884645] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 52, RTO !!
[ 1.893859] sunxi_register_led_classdev()1483 - led_classdev start
[ 1.907625] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SB
[ 1.920227] sunxi_led_probe()1845 - finish
[ 1.925082] exFAT: Version 1.3.0
[ 1.926145] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 400000Hz bm PP pm ON vdd 21 width 1 timing LEGACY(SB
[ 1.930597] [AUDIOCODEC][sunxi_codec_parse_params][2437]:digital_vol:0, lineout_vol:26, mic1gain:31, mic1
[ 1.930597]
[ 1.957562] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 5, RTO !!
[ 1.964346] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 5, RTO !!
[ 1.971096] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 5, RTO !!
[ 1.977864] sunxi-mmc 4021000.sdmmc: smc 1 p1 err, cmd 5, RTO !!
[ 1.977889] sunxi-mmc 4021000.sdmmc: sdc set ios:clk 0Hz bm PP pm OFF vdd 0 width 1 timing LEGACY(SDR12)B
[ 1.984649] [AUDIOCODEC][sunxi_codec_parse_params][2473]:adcdrc_cfg:0, adchpf_cfg:1, dacdrc_cfg:0, dachp0
[ 1.995775] [DISP] disp_sys_pwm_request,line:442:
[ 1.995783] disp_sys_pwm_request pwm 8 fail! -517
[ 2.007152] [AUDIOCODEC][sunxi_internal_codec_probe][2634]:codec probe finished
[ 2.011984] [DISP] disp_lcd_pwm_enable,line:1271:
[ 2.011987] pwm device hdl is NULL
[ 2.018174] debugfs: Directory '203034c.dummy_cpudai' with parent 'audiocodec' already present!
[ 2.025561] [DISP] disp_device_attached_and_enable,line:233:
[ 2.025566] attached ok, mgr0<-->dev0
[ 2.030865] [SNDCODEC][sunxi_card_init][583]:card init finished
[ 2.034652] [DISP] disp_device_attached_and_enable,line:236:
[ 2.034660] type:1,mode:0,fmt:rgb,bits:8bits,eotf:4,cs:0 dvi_hdmi:2, range:2 scan:0 ratio:8
[ 2.077562] sunxi-codec-machine 2030340.sound: 2030000.codec <-> 203034c.dummy_cpudai mapping ok
[ 2.088477] input: audiocodec sunxi Audio Jack as /devices/platform/soc@3000000/2030340.sound/sound/card0
[ 2.100427] [SNDCODEC][sunxi_card_dev_probe][836]:register card finished
[ 2.108800] NET: Registered protocol family 10
[ 2.113854] [SNDCODEC][sunxi_hs_init_work][259]:resume-->report switch
[ 2.122088] Segment Routing with IPv6
[ 2.126324] NET: Registered protocol family 17
[ 2.131469] Bluetooth: RFCOMM TTY layer initialized
[ 2.137000] Bluetooth: RFCOMM socket layer initialized
[ 2.142791] Bluetooth: RFCOMM ver 1.11
[ 2.147573] Registering SWP/SWPB emulation handler
[ 2.167211] sun8iw20-pinctrl 2000000.pinctrl: pin PE2 already requested by 2500000.uart; cannot claim foh
[ 2.179190] sun8iw20-pinctrl 2000000.pinctrl: pin-130 (4500000.eth) status -22
[ 2.187317] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 130 (PE2) from group PE2 on device l
[ 2.199447] sunxi-gmac 4500000.eth: Error applying setting, reverse things back
[ 2.207708] sunxi-gmac: probe of 4500000.eth failed with error -22
[ 2.214954] sun8iw20-pinctrl 2000000.pinctrl: pin PC2 already requested by 4025000.spi; cannot claim forc
[ 2.226973] sun8iw20-pinctrl 2000000.pinctrl: pin-66 (4022000.sdmmc) status -22
[ 2.235187] sun8iw20-pinctrl 2000000.pinctrl: could not request pin 66 (PC2) from group PC2 on device 2l
[ 2.247196] sunxi-mmc 4022000.sdmmc: Error applying setting, reverse things back
[ 2.255525] sunxi-mmc: probe of 4022000.sdmmc failed with error -22
[ 2.263933] sun8iw20-pinctrl 2000000.pinctrl: 2000000.pinctrl supply vcc-pb not found, using dummy regulr
[ 2.276306] get ehci0-controller wakeup-source is fail.
[ 2.282265] sunxi ehci0-controller don't init wakeup source
[ 2.288541] [sunxi-ehci0]: probe, pdev->name: 4101000.ehci0-controller, sunxi_ehci: 0xc0b5a408, 0x:c88b8b
[ 2.300557] [sunxi-ehci0]: Not init ehci0
[ 2.305397] get ohci0-controller wakeup-source is fail.
[ 2.311345] sunxi ohci0-controller don't init wakeup source
[ 2.317648] [sunxi-ohci0]: probe, pdev->name: 4101400.ohci0-controller, sunxi_ohci: 0xc0b5a698
[ 2.327323] [sunxi-ohci0]: Not init ohci0
[ 2.332525] otg manager soc@3000000:usbc0@0: soc@3000000:usbc0@0 supply usbc not found, using dummy regur
[ 2.346128] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 2.355863] cfg80211: failed to load regulatory.db
[ 2.355877] clk: Not disabling unused clocks
[ 2.366051] ALSA device list:
[ 2.369377] #0: audiocodec
[ 2.372610] alloc_fd: slot 0 not NULL!
[ 2.377191] VFS: Cannot open root device "mmcblk0p5" or unknown-block(0,0): error -6
[ 2.385895] Please append a correct "root=" boot option; here are the available partitions:
[ 2.395290] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.404568] CPU1: stopping
[ 2.407605] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.4.61 #36
[ 2.414339] Hardware name: Generic DT based system
[ 2.419733] [<c010de6c>] (unwind_backtrace) from [<c010a614>] (show_stack+0x10/0x14)
[ 2.428430] [<c010a614>] (show_stack) from [<c062be28>] (dump_stack+0x88/0xa4)
[ 2.436537] [<c062be28>] (dump_stack) from [<c010c254>] (handle_IPI+0xe4/0x180)
[ 2.444742] [<c010c254>] (handle_IPI) from [<c0316614>] (gic_handle_irq+0x70/0x78)
[ 2.453238] [<c0316614>] (gic_handle_irq) from [<c01021cc>] (__irq_svc+0x6c/0xa8)
[ 2.461630] Exception stack(0xc705df80 to 0xc705dfc8)
[ 2.467298] df80: 00000400 c76c7334 00000000 c01147a0 00000002 c705c000 c0a03de8 c0a03e24
[ 2.476474] dfa0: 4000406a 410fc075 00000000 00000000 c0b46748 c705dfd0 c0107f68 c0107f58
[ 2.485646] dfc0: 60000013 ffffffff
[ 2.489562] [<c01021cc>] (__irq_svc) from [<c0107f58>] (arch_cpu_idle+0x1c/0x38)
[ 2.497864] [<c0107f58>] (arch_cpu_idle) from [<c013d43c>] (do_idle+0xd4/0x128)
[ 2.506067] [<c013d43c>] (do_idle) from [<c013d728>] (cpu_startup_entry+0x18/0x20)
[ 2.514561] [<c013d728>] (cpu_startup_entry) from [<40102bac>] (0x40102bac)
[ 2.522381] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
来尔的:
Lunch menu... pick a combo:
1 t113-awol_evb1-tina
2 t113-dev-tina
3 t113-evb1_auto_nor-tina
4 t113-evb1_auto-tina
5 t113-evb1-tina
6 t113_i-evb1_auto_nand-tina
7 t113_i-evb1_auto-tina
8 t113-pro-tina
9 t113s2-evb1-tina
10 t113s2-evb_axp313a-tina
Which would you like? [Default t113__i-evb1_auto]:
只有选6和7才不报错,其他则报错:
Which would you like? [Default t113_i-evb1_auto]: 5
Jump to longan autoconfig
/home/any/mpu/t113s3/myirdd/T113/build.sh autoconfig -o openwrt -i t113 -b evb1 -n default
========ACTION List: mk_autoconfig -o openwrt -i t113 -b evb1 -n default;========
options :
过了快一年了,又编译了一遍qt,基于t113s3的tina2.1sdk。又遇到这些问题。感谢楼主的分享。
autoconfigure.sh脚本里一开始的export STAGING_DIR命令,执行脚本后,貌似没起作用,编译会有警告STAGING_DIR是空的,然后编译会报错,qlogging.cpp: `backtrace'啥的。在执行脚本前,在命令行里手动执行下export STAGING_DIR=XXX,就不会报这些错误。
在ubuntu22.04下编译qt5.12,还会有些报错,和std:min std:max相关的,找到报错的文件,加上#include<limits>即可解决。
在ubuntu22.04下编译qt5.15,也有报错,好像是std:某个模板参数不能为空,没找到解决办法,不过看编译过程的提示需要GCC版本大于7,sdk自带的是6.x版本。于是放弃qt5.15转而下载qt5.12。tina5.x的gcc版本有10和11,也许不会报这些错误。
另编译qt时,这个STAGING_DIR到底是干啥的?虽然修改为只想sdk/out/xxx/staging_dir后编译通过了,但是想知道其用途。
想用t113s3接emmc试试,4bit模式。bit0-bit3倒是好说,大都在最外层引脚上,clk和cmd信号就特别靠里了。
1 看了下nezha开发板的pcb图,到emmc处就变成3.3mil的线径走线了,这也太细了...
2 在立创开源上找了另一个emmc的t113s3开源工程,线径倒是没变细,但是clk和cmd是到接近emmc时打孔到底层,再走线到emmc的cmd和clk管脚位置处打孔回到顶层。
以上两个板子都是两层板。
3还有找了个文章,还介绍了一种方法,cmd和clk连接多个nc管脚走到芯片外。
方法1就不打算尝试了,也太细了,立创好像支持3.5mil。
2和3选哪种好呢?
网上看到的开源飞控一般用cortex m4, m7芯片。刷b站看到这个:
https://www.bilibili.com/video/BV1vatDewEN8/?spm_id_from=333.337.search-card.all.click
好奇用的什么主控,有评论说是e3t方案,没搜到这个芯片的信息。
又搜到个拆解视频,也有e3t,不过说是光电传感器。
https://mbb.eet-china.com/forum/topic/145037_1_1.html
ubuntu下d133的sdk,使用的是rtt。之前编译正常,这几天貌似下过别的软件,安装过一些python库。再次编译时报错了:
$ me
scons: Reading SConscript files ...
ImportError: cannot import name 'mk_rtconfig' from 'menuconfig' (/home/any/.local/lib/python3.10/site-packages/menuconfig.py):
File "/home/any/Mcu/artinchip/luban-lite/SConstruct", line 11:
chk_prj_config(AIC_ROOT)
File "/home/any/Mcu/artinchip/luban-lite/tools/scripts/aic_build.py", line 1426:
from menuconfig import mk_rtconfig
显示调用的是python/site-packages/menuconfig.py,实际应该调用的是rtt/tools/meunconfig.py。
目前是将python目录下的该名了,暂时可以正常编译。有没有其他解决办法呢?
@cchhiipp
麻烦你先发我一个吧,我周六问的,到现在没回复
https://whycan.com/files/members/10858/QQ截图20240922222301.png
图片不打下码吗?姓名、电话、地址,全发网上了啊,个人隐私不重要吗?
坑网貌似是发帖24小时内可编辑,赶紧修改下吧,要不私聊站长给你撤掉图片吧。
https://github.com/EdgeTX/edgetx/wiki/Build-Instructions-under-Ubuntu-20.04
按这个来的,不过我是ubuntu22.04。
执行的是:
cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DLUA_MIXER=YES -DCMAKE_BUILD_TYPE=Debug ../
搜了工程,没搜到mtp关键字相关。
-------------------------------------
以下是执行cmake和make configure时的输出信息,执行make firmware98%报错,信息在顶楼。
(edgeTxEnv) any@Any-Desktop:~/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output$ cmake -DPCB=X10 -DPCBREV=TX16S -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DLUA_MIXER=YES -DCMAKE_BUILD_TYPE=Debug ../
-- CMAKE_ARGS: -DDEBUG=YES;-DDEFAULT_MODE=2;-DGVARS=YES;-DHELI=NO;-DINTERNAL_GPS=YES;-DLUA=YES;-DLUA_MIXER=YES;-DPCB=X10;-DPCBREV=TX16S;-DPPM_UNIT=US
-- CMAKE_BUILD_TYPE: Debug
-- Configuring done
-- Generating done
-- Build files have been written to: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output
(edgeTxEnv) any@Any-Desktop:~/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output$ make configure
[ 50%] Built target arm-none-eabi-configure
[ 60%] Creating directories for 'native'
[ 70%] No download step for 'native'
[ 80%] No update step for 'native'
[ 90%] No patch step for 'native'
[100%] Performing configure step for 'native'
loading initial cache file /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native-prefix/tmp/native-cache-Debug.cmake
-- Python found, version: 3.10.12
-- EdgeTX 2.11.0-selfbuild @ e303b126
-- Foxlib found at /usr/lib/x86_64-linux-gnu/libFOX-1.6.so
-- Qt Version: 5.15.3
-- SDL2 Lib: /usr/lib/x86_64-linux-gnu/libSDL2.so Libs: -L/usr/lib/x86_64-linux-gnu -lSDL2; Headers: /usr/include/SDL2
-- Simulators library search path: ../lib/companion211
Fetched miniz source code from Github: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native/_deps/miniz-src
Fetched yaml-cpp source code from Github: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native/_deps/yaml-cpp-src
-- Qt Version: 5.15.3
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Fetched maxLibQt source code from Github: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native/_deps/maxlibqt-src/src
TARGET companion211: cpp compiler /usr/bin/c++ v11
-- Added optional gtests-companion target
-- install /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native to /usr
-- Downloading linuxdeploy and plugins...
-- Downloading linuxdeploy and plugins finished
mv: 对 '/home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native/squashfs-root' 调用 stat 失败: 没有那个文件或目录
-- Internal GPS enabled
-- Adding support for USB serial
-- Adding support for PXX1 as internal module
-- Adding support for PXX2 as internal module
-- Adding support for MULTI as internal module
-- Adding support for CRSF as internal module
TARGET simu/libsimulator: cpp compiler /usr/bin/c++ v11
-- Added optional gtests target
-- firmware target disabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/build-output/native
[100%] Built target native-configure
[100%] Built target configure
[ 97%] Building CXX object radio/src/CMakeFiles/firmware.dir/targets/common/arm/stm32/flysky_gimbal_driver.cpp.obj
[ 97%] Building C object radio/src/CMakeFiles/firmware.dir/syscalls.c.obj
[ 98%] Building CXX object radio/src/CMakeFiles/firmware.dir/cli.cpp.obj
[ 98%] Linking CXX executable ../../firmware.elf
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL24stbi__de_iphone_flag_set lma 0x815a8fc adjusted to 0x815a900
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL26stbi__de_iphone_flag_local lma 0x815a8fc adjusted to 0x815a904
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL31stbi__unpremultiply_on_load_set lma 0x815a8fc adjusted to 0x815a908
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL33stbi__unpremultiply_on_load_local lma 0x815a8fc adjusted to 0x815a90c
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL33stbi__vertically_flip_on_load_set lma 0x815a8fc adjusted to 0x815a910
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: ../../firmware.elf: section .tbss._ZL35stbi__vertically_flip_on_load_local lma 0x815a8fc adjusted to 0x815a914
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/firmware.dir/gui/colorlcd/libui/bitmapbuffer_fileio.cpp.obj: in function `stbi__build_huffman(stbi__huffman*, int*)':
/home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: undefined reference to `__aeabi_read_tp'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: undefined reference to `__aeabi_read_tp'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/firmware.dir/gui/colorlcd/libui/bitmapbuffer_fileio.cpp.obj: in function `stbi__zbuild_huffman(stbi__zhuffman*, unsigned char const*, int)':
/home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: undefined reference to `__aeabi_read_tp'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: undefined reference to `__aeabi_read_tp'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/firmware.dir/gui/colorlcd/libui/bitmapbuffer_fileio.cpp.obj: in function `stbi__convert_format(unsigned char*, int, int, unsigned int, unsigned int)':
/home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: undefined reference to `__aeabi_read_tp'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/firmware.dir/gui/colorlcd/libui/bitmapbuffer_fileio.cpp.obj:/home/any/Mcu/DownloadFromWeb/edgetx/edgetx_main/radio/src/thirdparty/stb/stb_image.h:979: more undefined references to `__aeabi_read_tp' follow
collect2: error: ld returned 1 exit status
make[7]: *** [radio/src/CMakeFiles/firmware.dir/build.make:7687:firmware.elf] 错误 1
make[6]: *** [CMakeFiles/Makefile2:747:radio/src/CMakeFiles/firmware.dir/all] 错误 2
make[5]: *** [CMakeFiles/Makefile2:754:radio/src/CMakeFiles/firmware.dir/rule] 错误 2
make[4]: *** [Makefile:384:firmware] 错误 2
make[3]: *** [CMakeFiles/firmware.dir/build.make:70:CMakeFiles/firmware] 错误 2
make[2]: *** [CMakeFiles/Makefile2:409:CMakeFiles/firmware.dir/all] 错误 2
make[1]: *** [CMakeFiles/Makefile2:416:CMakeFiles/firmware.dir/rule] 错误 2
编译进度都98%了,结果出这个错...
网上搜了下,貌似和交叉编译有关,有的是直接创建个空函数。
https://item.taobao.com/item.htm?abbuck … 1a24%22%7D
搜了下,这家比较便宜。
启明智显的M4好像也是用的D21X,不过看了下,7寸的也接近400元了。
D211和D213芯片差价不会太大的,有价格合适的,买D213也挺好。
--------------------------------------------------------------------------------
不过看了下好几家用这个图片,感觉不一定是真实卖的...
慎重选择吧。
-------------------------------------------------------------------------------
要不就参照官方原理图进行删减,自己画一版,难度也不大。
群里看到有群友介绍awtk hmi,也许适当裁减下可运行在8M内存的d133cbs下,不过现在出了16M的d133ccs,内存问题不用担忧了。
lubanlite sdk里自带移植好的awtk,虽然不是最新的,但是移植相关部分在awtk-rtos目录下,直接更新awtk源码不会对运行awtk造成影响。参考awtk-hmi里的介绍,将所需的几个仓库下载下来,awtk-mvvm, awtk-hmi等。
将各目录逐个加入scon工程目录。awtk, awtk-mvvm都要全部加入,awtk-hmi除了common目录外,都是demo,加入一个demo即可。
有几个注意的地方,记录一下。
1 hmi demo里src目录下有common和pages页面,common目录下有navigator.c文件,里面的函数和mvvm的同名函数冲突。询问了作者,可以保留mvvm里的文件,不包含hmi demo下的src/common目录。也许有其他好的办法防止冲突?
2 demo_home例程运行后,我以为点击屏幕按钮,串口就应该有数据输出,后来才明白,hmi程序和mcu程序交互,是mcu先向hmi发一些信息,类似握手?然后点击hmi界面后,hmi才会像mcu发送数据,mcu收到后立即有数据返回。
3 modbus client例程在板子上运行后,板子崩溃,后发现modbus_client_view_model.c里的modbus_client_model_create()函数会创建个新的线程并启动,但是没有给该线程进行设置,没设置线程的name、堆栈大小、优先级,在这里添加对应函数调用即可。不过优先级这里设置后应该没用,还是会设成0,最后是在rtt创建线程时设置程固定值解决。
4 编译板子上的awtk-hmi可能会遇到问题,可以尝试先编译pc版的。我不想装vs环境,打算用gcc编译,需要修改awtk目录下的awtk_config_comom.py文件,将TOOL_NAMES = mingw前的井号去掉。有个prepare.bat脚本可以一键编译,不过觉得有时候编译通过了,但是最后运行还是有问题,可以挨个到awtk各仓库目录下执行scons WITH_JERRYSCRIPT=False重新编译下,这样更容易看到出错情况。
5 modbus client例程,用serial的话,需要在modbus_demo.json里指定站号,我原以为会是"slaver":xx,结果却是"unit_id":xx
打开了lvgl的帧率及cpu占用率显示功能,内存占用没显示出来,可能和用了malloc有关。
以下提到的界面卡死,只是lvgl界面卡死,不能按及拖动,但是lvgl还能刷新帧率及cpu占用率,rtt的其他线程也正常。
复制了官方table例程:
https://lvgl.100ask.net/8.2/widgets/core/table.html#
例程是2列7行,运行后大部分情况下正常,有很小概率出现界面卡死。
改成4列7行,界面卡死概率更大了。
行列互换,改成7列,然后添加若干行,很容易出现界面卡死。
不拖动,只按压table的表格项,有时候会出现画面跳动以下,感觉像是触控数据出了问题。
void test_ui_init(void)
{
static lv_style_t fontDefault;
lv_style_init(&fontDefault);
lv_style_set_text_font(&fontDefault, &lv_font_montserrat_30);
lv_obj_t * table = lv_table_create(lv_scr_act());
// lv_obj_add_style(table, &fontDefault, 0);
lv_obj_set_size(table, 700, 400);
lv_table_set_cell_value(table, 0, 0, "Name");
lv_table_set_cell_value(table, 1, 0, "Apple");
lv_table_set_cell_value(table, 2, 0, "Banana");
lv_table_set_cell_value(table, 3, 0, "Lemon");
lv_table_set_cell_value(table, 4, 0, "Grape");
lv_table_set_cell_value(table, 5, 0, "Melon");
lv_table_set_cell_value(table, 6, 0, "Peach");
lv_table_set_cell_value(table, 7, 0, "Nuts");
lv_table_set_cell_value(table, 0, 1, "Price");
lv_table_set_cell_value(table, 1, 1, "$7");
lv_table_set_cell_value(table, 2, 1, "$4");
lv_table_set_cell_value(table, 3, 1, "$6");
lv_table_set_cell_value(table, 4, 1, "$2");
lv_table_set_cell_value(table, 5, 1, "$5");
lv_table_set_cell_value(table, 6, 1, "$1");
lv_table_set_cell_value(table, 7, 1, "$9");
// lv_table_set_cell_value(table, 0, 2, "Name");
// lv_table_set_cell_value(table, 1, 2, "Apple");
// lv_table_set_cell_value(table, 2, 2, "Banana");
// lv_table_set_cell_value(table, 3, 2, "Lemon");
// lv_table_set_cell_value(table, 4, 2, "Grape");
// lv_table_set_cell_value(table, 5, 2, "Melon");
// lv_table_set_cell_value(table, 6, 2, "Peach");
// lv_table_set_cell_value(table, 7, 2, "Nuts");
//
// lv_table_set_cell_value(table, 0, 3, "Price");
// lv_table_set_cell_value(table, 1, 3, "$7");
// lv_table_set_cell_value(table, 2, 3, "$4");
// lv_table_set_cell_value(table, 3, 3, "$6");
// lv_table_set_cell_value(table, 4, 3, "$2");
// lv_table_set_cell_value(table, 5, 3, "$5");
// lv_table_set_cell_value(table, 6, 3, "$1");
// lv_table_set_cell_value(table, 7, 3, "$9");
// lv_obj_set_height(table, 200);
lv_obj_center(table);
lv_obj_add_event_cb(table, draw_part_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
}
打开了lvgl的日值功能,有时候会出现这种警告:
[Warn] (60.346, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.356, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.366, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.376, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.406, +30) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.416, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.426, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
而且,手已经抬起没有再按压,结果还是不停的出现这个警告,再按下屏幕才消失。
不过出现界面卡死时不一定会有这个警告,有这个警告不一定会界面卡死。
table控件需要显示7列数据,行数不确定。
只显示一行数据时,界面正常,按钮可起作用,table列可左右拖动。
显示多行数据时,比如除标题行外,数据行3行及以上时,按按钮来回切换该页面和其他页面,都正常,数据刷新也正常。但是左右拖动或上下拖动table列或行时,有很大几率界面卡死,但是table里的数据还能正常刷新。
请教,这是哪里的问题?
static void lvgl_thread_entry(void *parameter)
{
lv_init();
lv_port_disp_init();
lv_port_indev_init();
lv_user_gui_init();
/* handle the tasks of LVGL */
while(1)
{
#ifdef AIC_LVGL_TEST_DEMO
#include "candata.h"
rt_err_t ret = rt_sem_take(&canRefreshSem, 1);
if (ret == RT_EOK)
{
uint8_t rowNumber = 0;
for (uint8_t id = 0; id < 10; id++)
{
if (canData[id].enable == 0)
{
continue;
}
rowNumber++;
lv_table_set_row_cnt(tblCan, rowNumber + 1);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 0, "%d", id);
// lv_table_set_cell_value_fmt(tblCan, rowNumber, 1, "%d", canData[id].timeStamp);
struct tm datetime;
time_t timestamp = (time_t)canData[id].timeStamp;
localtime_r(×tamp, &datetime);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 1, "%d:%d:%d", datetime.tm_hour, datetime.tm_min, datetime.tm_sec);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 2, "%d", canData[id].mp2Adc);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 3, "%d", canData[id].mp5Adc);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 4, "%d", canData[id].temp1Value);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 5, "%d", canData[id].coValue);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 6, "%d", canData[id].smokeValue);
}
}
#endif
}
}
这是在main_bootloader.c文件里:
264 int main(void)
1 {
2 // initialize vendor sdk
3 sdk_init();
4 // init leds and button
5 gpio_init();
6 // init settings
7 config_init();
8 // Hook for custom boards initialisation
9 board_bootloader_init();
10
11 // check for invalid app image or rst button press. Should be checksum or CRC but NVIC validation is better than nothing.
12 // If the interface has set the hold in bootloader setting don't jump to app
13 if (!reset_button_pressed()
14 && g_board_info.target_cfg
15 && validate_bin_nvic((uint8_t *)g_board_info.target_cfg->flash_regions[0].start)
16 && !config_ram_get_initial_hold_in_bl()) {
17 // change to the new vector table
18 SCB->VTOR = g_board_info.target_cfg->flash_regions[0].start; //bootloaders should only have one flash region for interface
19 // modify stack pointer and start app
20 modify_stack_pointer_and_start_app((*(uint32_t *)(g_board_info.target_cfg->flash_regions[0].start)),
21 (*(uint32_t *)(g_board_info.target_cfg->flash_regions[0].start + 4)));
22 }
这是在main_interface.c文件里:
551 int main(void)
1 {
2 // Explicitly set the vector table since the bootloader might not set
3 // it to what we expect.
4 #if DAPLINK_ROM_BL_SIZE > 0
5 SCB->VTOR = SCB_VTOR_TBLOFF_Msk & DAPLINK_ROM_IF_START;
6 #endif
7 // initialize vendor sdk
8 sdk_init();
9
10 // Initialize CMSIS-RTOS
11 osKernelInitialize();
这是boot里设置的中断向量表的实际地址,文件在stm32f103xb_bl.c:
37 // stm32f103 target information
1 target_cfg_t target_device = {
2 .version = kTargetConfigVersion,
3 .sectors_info = sectors_info,
4 .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
5 .flash_regions[0].start = 0x08000000 + KB(48),
6 .flash_regions[0].end = 0x08000000 + KB(128),
7 .flash_regions[0].flags = kRegionIsDefault,
8 .ram_regions[0].start = 0x20000000,
9 .ram_regions[0].end = 0x20005000,
10 /* .flash_algo not needed for bootloader */
11 };
我看到的iap应用,都是只在app程序里设置SCB->VTOR,为何daplink源码里的boot程序这里,在跳转iap之前,为何也设置了SCB->VTOR?
这是机器人,截取网上的一些帖子自动发帖。看这账号以往的发帖记录就知道了。
就这个帖子来说,在掘金搜到了同样的帖子:
https://juejin.cn/post/7258509816691834917
daplink源码中,main文件在main_interface.c文件中,整个工程貌似只创建了main_task一个任务。
而main_task任务里,while循环里,主要是等待7个任务通知/消息。
53 while (1) {
1 flags = osThreadFlagsWait(FLAGS_MAIN_RESET // Put target in reset state
2 | FLAGS_MAIN_90MS // 90mS tick
3 | FLAGS_MAIN_30MS // 30mS tick
4 | FLAGS_MAIN_POWERDOWN // Power down interface
5 | FLAGS_MAIN_DISABLEDEBUG // Disable target debug
6 | FLAGS_MAIN_PROC_USB // process usb events
7 | FLAGS_MAIN_CDC_EVENT // cdc event
8 , osFlagsWaitAny
9 , osWaitForever);
reset好像是让目标板复位的;
90MS是处理usb是否连接的;
30ms是处理led灯闪烁的;
power_down好像是板子断电相关的;
disabledebug好像是设置目标退出debug状态;
proc_usb是被usb中断函数调用的;
cdc_event好像是usb转串口相关。
那么daplink的主要功能,烧录程序及硬件仿真,是在哪里完成的呢?
我用的d133,是可以在ubuntu下完成编译、烧录的。
sdk下执行onestep脚本后,lunch、me、m,可选择项目、配置项目、编译项目,有个aicupg,可以通过usb烧录生成的镜像。不知道这个命令是否支持串口烧录。
板子启动后,进入rtt的msh后,也可以输入aicupg,使板子重启并进入boot模式。
ab命令也可以根据现有工程添加新的工程。
目前感觉不如win下Aiburn软件方便的地方是,Aiburn可以设置为按分区烧写,因为每次编译修改可能只改动了os分区,如果只烧录os分区,花的时间很短的。aicupg命令看介绍也支持按地址烧录的,不过可能得自己计算地址及大小了,没试过。
PMOS开关电路,很常见呀。不过要注意VGS数值不要超过12V
https://whycan.com/files/members/1798/屏幕截图_20240722_122744.png
感谢。
我刚才理解错了,Vgs和Vgs(th)不是一回事来着...
再请教,这个C3在这里起什么作用呢?让Q4开启和关断更慢一点?
经飞控群里二木仙人指点,去看了inav的代码:
455 uint16_t getVBatSample(void) {
1 // calculate battery voltage based on ADC reading
2 // result is Vbatt in 0.01V steps. 3.3V = ADC Vref, 0xFFF = 12bit adc, 1100 = 11:1 voltage divider (10k:1k)
3 return (uint64_t)adcGetChannel(ADC_BATTERY) * batteryMetersConfig()->voltage.scale * ADCVREF / (0xFFF * 1000);
4 }
这个就很容易理解了。
src/main/sensors/voltage.c中的函数:
159 STATIC_UNIT_TESTED uint16_t voltageAdcToVoltage(const uint16_t src, const voltageSensorADCConfig_t *config)
1 {
2 // calculate battery voltage based on ADC reading
3 // result is Vbatt in 0.01V steps. 3.3V = ADC Vref, 0xFFF = 12bit adc, 110 = 10:1 voltage divider (10k:1k) * 100 for 0.01V
4 return ((((uint32_t)src * config->vbatscale * getVrefMv() / 10 + (0xFFF * 5)) / (0xFFF * config->vbatresdivval)) / config->vbatresdivmultiplier);
5 }
getVreMv()函数,默认返回是3300,对应3300mV;
config->vbatscale,默认值是110;
config->vbatresdivval,默认值是10;
config->vbatresdivmultiplier,默认值是1.
找到个at32f435的原理图,可能不一定完全对应的上,原理图里只用了一个adc,用的10K:1K测量的电池电压。
按我的逻辑,(adc值/0xfff)*3300,得到测量的adc电压值,然后放大11倍,就是电池电压了。可看这个公式,对应不上。
-----------------------------------------------------------
如果把原式中的+(0xfff*5)去掉,精简下:
((((uint32_t)src * config->vbatscale * getVrefMv() / 10) / (0xFFF * config->vbatresdivval)) / config->vbatresdivmultiplier);
= src * 110 * 3300 / 10 / (0xFFF * 10) / 1
= src * 110 * 3300 / 0xFFF
这样看,就和我的逻辑计算公式差不多了,只是查了10倍, 那么原式中的+0xFFF*5,有什么作用呢?
-----------------------------------------------------------
单独把0xFFF*5部分拿出来再除以后续部分:
0xFFF*5 / (0xFFF * 10) / 1 = 0.5
这么看,这部分是为了四舍五入?
感觉这个转换函数写的好繁琐。
----------------------------------------------
算错,src * 110 * 3300 / 10 / (0xFFF * 10) / 1, 应该是:
= src * 110 * 3300 / 0xFFF * 10 * 10
= src * 11 * 3300 / 0xFFF * 10
可以看作将adc值转换为电压值后,按分压电阻放大11备得到mV单位的电池电压,再除以10得到0.01V单位的电池电压。
算是明白了,就是觉得这个公式好繁琐。
dlk /> sf probe qspi01
qspi0 freq (input): 99000000Hz
qspi0 freq ( bus ): 49500000Hz
01-01 10:14:57 I/NO_TAG: Flash ID: 0xef4018
01-01 10:14:57 I/NO_TAG: Find a Winbond flash chip. Size is 167772.
qspi0 freq (input): 99000000Hz
qspi0 freq ( bus ): 99000000Hz
01-01 10:14:57 I/NO_TAG: sf_cmd flash device is initialize success.
01-01 10:14:57 I/NO_TAG: Probe SPI flash sf_cmd by SPI device qspi.
16 MB sf_cmd is current selected device.
dlk /> sf status
The sf_cmd flash status register current value is 0x00.
早上给群里的朋友试我的固件,修改了配置,打开了芯片的内置1.8V LDO功能。当时现象依旧。
发现gitee上sdk更新了,就拉取了下来,编译并下载,现象依旧。
然后关闭了芯片的1.8V LDO功能,结果,能成功下载了,虽然我认为和LDO打开/关闭关系不大...
用的芯片是匠芯创的d133,该芯片程序只能存储在片外存储设备上,现用的是w25q128.
正常下载程序使用了一段时间后,发现烧录程序时,下载软件提示下载完成,但是实际没下载成功,程序还是运行的上次成功烧录的那个程序。
更换w25q128后,又可正常烧录。但是,使用一段时间后,仍有概率出现相同问题。
后来知道了spi nor flash有个状态寄存器,就用sfdu命令来查看状态寄存器的值:
sf status
The sf_cmd flash status register current value is 0xFC.
发现该值为0xFC,而另一块正常的板子,值为0。
查手册,得知为1的各位,其实是写保护位。
通过sf status 0 0,将该寄存器值恢复为0,可以正常烧写了。
过了大概有两三个月吧,问题又出现了,这次读取状态寄存器值,仍为0xFC, 我尝试用sf status 0 0清除该寄存器,结果程序就卡死了...
请教,还有什么办法,可以解除spi nor flash的写保护位吗?
用的d133 sdk,自带rtt,还有一些移植好了的本地软件包。
单用本地软件包里的lwip里的例程,能正常运行。
现在像运行libmodbus库,发现需要打开SAL组件,打开SAL组件,又会关联NETDEV组件,打开后发现好几个重复定义,比如ip4_addr。
搜了下,有如下多个定义:
grep -rnw "typedef struct ip4_addr"
packages/third-party/lwip/src/include/lwip/ip4_addr.h:57:typedef struct ip4_addr ip4_addr_t;
kernel/rt-thread/components/net/netdev/include/netdev_ipaddr.h:98:typedef struct ip4_addr
kernel/rt-thread/components/net/lwip/lwip-2.1.2/src/include/lwip/ip4_addr.h:57:typedef struct ip4_addr ip4_addr_t;
kernel/rt-thread/components/net/lwip/lwip-2.0.3/src/include/lwip/ip4_addr.h:57:typedef struct ip4_addr ip4_addr_t;
后两个应该没使能,应该没包含进去。
第一个是本地软件包里的lwip,第二个是rtt里的netdev组件。
俩文件还不一样,要是一样的话我就删除一个就行了...
我觉得应该是两个.h文件不能在同一个.c文件中被包含,但是,不知道如何去查找引起冲突的文件...
-------------------------------------
查看报错信息,找第一个报错时的.c文件:
In file included from kernel/rt-thread/components/net/netdev/include/arpa/inet.h:14,
from kernel/rt-thread/components/net/sal/include/sal_socket.h:15,
from kernel/rt-thread/components/net/sal/include/socket/sys_socket/sys/socket.h:16,
from application/rt-thread/can2eth/udpandtcp.c:5:
kernel/rt-thread/components/net/netdev/include/netdev_ipaddr.h:84: note: this is the location of the previous definition
84 | #define ntohl(x) (uint32_t)PP_NTOHL(x)
|
In file included from packages/third-party/lwip/src/include/lwip/ip_addr.h:43,
from packages/third-party/lwip/src/include/lwip/netif.h:46,
from application/rt-thread/can2eth/udpandtcp.c:9:
packages/third-party/lwip/src/include/lwip/ip4_addr.h:51:8: error: redefinition of 'struct ip4_addr'
51 | struct ip4_addr {
| ^~~~~~~~
In file included from kernel/rt-thread/components/net/netdev/include/arpa/inet.h:14,
from kernel/rt-thread/components/net/sal/include/sal_socket.h:15,
from kernel/rt-thread/components/net/sal/include/socket/sys_socket/sys/socket.h:16,
from application/rt-thread/can2eth/udpandtcp.c:5:
感觉是自己写的这个udpandtcp.c文件的问题?
tsdb方式存储的数据,每一条目里,存储的是数据偏移位值及数据长度,实际数据是从该扇区底部开始往上存储的。
hexdump log.fdb.0
0000000 ff3f ffff 5354 304c 0001 0000 ffff ffff
0000010 ffff ffff ffff ffff ffff ffff ffff ffff
0000020 ffff ffff ffff ffff ff1f ffff 0001 0000
0000030 0008 0000 0ff8 0000 ff1f ffff 0002 0000
0000040 0008 0000 0ff0 0000 ff1f ffff 0003 0000
0000050 0008 0000 0fe8 0000 ff1f ffff 0004 0000
0000060 0008 0000 0fe0 0000 ff1f ffff 0005 0000
0000070 0008 0000 0fd8 0000 ff1f ffff 0006 0000
0000080 0008 0000 0fd0 0000 ff1f ffff 0007 0000
0000090 0008 0000 0fc8 0000 ff1f ffff 0008 0000
00000a0 0008 0000 0fc0 0000 ff1f ffff 0009 0000
00000b0 0008 0000 0fb8 0000 ff1f ffff 000a 0000
00000c0 0008 0000 0fb0 0000 ff1f ffff 000b 0000
00000d0 0008 0000 0fa8 0000 ff1f ffff 000c 0000
00000e0 0008 0000 0fa0 0000 ffff ffff ffff ffff
00000f0 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000fa0 0026 0000 005a 0000 0024 0000 0055 0000
*
0001000
FashDB目录下有fdb_cfg.h文件,里边有FDB_USING_FAL_MODE FDB_WRITE_GRAN FDB_USING_FILE_LIBC_MODE FDB_USING_FILE_POSIX_MODE等宏定义。而我用的luban-lite sdk里,menuconfig里也有对应选项,且生成到了rtconfig.h里。结果有些宏定义重复了,而以上MODE宏定义,只能三选一,由于有了两个地方都有定义,造成了同时使能了其中多个。
目前都改成使用FDB_USING_FILE_POSIX_MODE,貌似是成功了。
dlk /> test_flashdb
dlk /> [FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1784) The oldest addr is @0x00000000
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1800) KVDB size is 16384 bytes.
[FlashDB] FlashDB V2.1.0 is initialize success.
[FlashDB] You can get the latest version on https://github.com/armink/FlashDB .
[FlashDB][sample][kvdb][basic] ==================== kvdb_basic_sample ====================
[FlashDB][sample][kvdb][basic] get the 'boot_count' value is 1
[FlashDB][sample][kvdb][basic] set the 'boot_count' value to 2
[FlashDB][sample][kvdb][basic] ===========================================================
[FlashDB][sample][kvdb][string] ==================== kvdb_type_string_sample ====================
[FlashDB][sample][kvdb][string] create the 'temp' string KV, value is: 36C
[FlashDB][sample][kvdb][string] get the 'temp' value is: 36C
[FlashDB][sample][kvdb][string] set 'temp' value to 38C
[FlashDB][sample][kvdb][string] delete the 'temp' finish
[FlashDB][sample][kvdb][string] ===========================================================
[FlashDB][sample][kvdb][blob] ==================== kvdb_type_blob_sample ====================
[FlashDB][sample][kvdb][blob] create the 'temp' blob KV, value is: 36
[FlashDB][sample][kvdb][blob] get the 'temp' value is: 36
[FlashDB][sample][kvdb][blob] set 'temp' value to 38
[FlashDB][sample][kvdb][blob] delete the 'temp' finish
[FlashDB][sample][kvdb][blob] ===========================================================
[FlashDB][tsl][log][/data] (packages/third-party/FlashDB/src/fdb_tsdb.c:978) TSDB (log) oldest sectors is 0x00000000, current using sector .
[FlashDB][sample][tsdb] ==================== tsdb_sample ====================
[FlashDB][sample][tsdb] append the new status.temp (36) and status.humi (85)
[FlashDB][sample][tsdb] append the new status.temp (38) and status.humi (90)
[FlashDB][sample][tsdb] [query_cb] queried a TSL: time: 1, temp: 36, humi: 85
[FlashDB][sample][tsdb] [query_cb] queried a TSL: time: 2, temp: 38, humi: 90
[FlashDB][sample][tsdb] [query_cb] queried a TSL: time: 3, temp: 36, humi: 85
[FlashDB][sample][tsdb] [query_cb] queried a TSL: time: 4, temp: 38, humi: 90
[FlashDB][sample][tsdb] [query_by_time_cb] queried a TSL: time: 1, temp: 36, humi: 85
[FlashDB][sample][tsdb] [query_by_time_cb] queried a TSL: time: 2, temp: 38, humi: 90
[FlashDB][sample][tsdb] [query_by_time_cb] queried a TSL: time: 3, temp: 36, humi: 85
[FlashDB][sample][tsdb] [query_by_time_cb] queried a TSL: time: 4, temp: 38, humi: 90
[FlashDB][sample][tsdb] query count is: 2
[FlashDB][sample][tsdb] set the TSL (time 1) status from 3 to 3
[FlashDB][sample][tsdb] set the TSL (time 2) status from 3 to 3
[FlashDB][sample][tsdb] set the TSL (time 3) status from 2 to 3
[FlashDB][sample][tsdb] set the TSL (time 4) status from 2 to 3
[FlashDB][sample][tsdb] ===========================================================
hexdump env.fdb.0
0000000 3f3f ffff 4446 3042 ffff ffff ffff ffff
0000010 ff3f ffff 564b 3030 0026 0000 c32c b664
0000020 ff08 ffff 0006 0000 7375 7265 616e 656d
0000030 7261 696d 6b6e ff3f ffff 564b 3030 0026
0000040 0000 4c95 83fc ff08 ffff 0006 0000 6170
0000050 7373 6f77 6472 3231 3433 3635 ff0f ffff
0000060 564b 3030 0026 0000 f64e efde ff0a ffff
0000070 0004 0000 6f62 746f 635f 756f 746e 0000
0000080 0000 ff3f ffff 564b 3030 0071 0000 1dce
0000090 135c ff09 ffff 0050 0000 6f62 746f 745f
00000a0 6d69 0065 0000 0000 0000 0100 0000 0000
00000b0 0000 0200 0000 0000 0000 0300 0000 0000
00000c0 0000 0000 0000 0000 0000 0000 0000 0000
*
00000f0 0000 3f00 ffff 4bff 3056 2730 0000 a700
0000100 d62e 0b29 ffff 04ff 0000 5f00 765f 7265
0000110 6e5f 6d75 5f5f 0000 0000 ff3f ffff 564b
0000120 3030 0026 0000 912b 5762 ff0a ffff 0004
0000130 0000 6f62 746f 635f 756f 746e 0001 0000
0000140 ff0f ffff 564b 3030 001f 0000 b630 fa55
0000150 ff04 ffff 0003 0000 6574 706d 3633 0f43
0000160 ffff 4bff 3056 1f30 0000 be00 d69b 0464
0000170 ffff 03ff 0000 7400 6d65 3370 4338 ff0f
0000180 ffff 564b 3030 0020 0000 89da b6c5 ff04
0000190 ffff 0004 0000 6574 706d 0024 0000 ff0f
00001a0 ffff 564b 3030 0020 0000 4151 1ccc ff04
00001b0 ffff 0004 0000 6574 706d 0026 0000 ffff
00001c0 ffff ffff ffff ffff ffff ffff ffff ffff
*
0001000
使用FDB_USING_FILE_POSIX_MODE模式时,我以为文件路径会是/dev/data呢,结果/data就行。
而使用FDB_USING_FILE_LIBC_MODE模式时,就是上边楼层最后追踪到的fwrite()函数,写入size是12,返回却是1。原因未知。
在两个地方都配置为FDB_USING_FAL_MODE模式,FDB_WRITE_GRAN配置为1或32,都是卡到这里:
dlk /> test_flashdb
dlk /> [FlashDB][kv][(null)
追踪最后的这个报错:
[FlashDB][tsl][log][/data] Error: write tsl failed (2)
是在fdb_tsdc.c
/* write the TSL node */
1 result = write_tsl(db, blob, cur_time);
2 if (result != FDB_NO_ERR) {
3 FDB_INFO("Error: write tsl failed (%d)", result);
4 return result;
5 }
检测write_tsl()这个函数的返回,如果不是0,则报错。
static fdb_err_t write_tsl(fdb_tsdb_t db, fdb_blob_t blob, fdb_time_t time)
1 {
2 fdb_err_t result = FDB_NO_ERR;
3 struct log_idx_data idx;
4 uint32_t idx_addr = db->cur_sec.empty_idx;
5
6 idx.log_len = blob->size;
7 idx.time = time;
8 idx.log_addr = db->cur_sec.empty_data - FDB_WG_ALIGN(idx.log_len);
9 /* write the status will by write granularity */
10 _FDB_WRITE_STATUS(db, idx_addr, idx.status_table, FDB_TSL_STATUS_NUM, FDB_TSL_PRE_WRITE, false);
11 /* write other index info */
12 FLASH_WRITE(db, idx_addr + LOG_IDX_TS_OFFSET, &idx.time, sizeof(struct log_idx_data) - LOG_IDX_TS_OFFSET, false);
13 /* write blob data */
14 FLASH_WRITE(db, idx.log_addr, blob->buf, blob->size, false);
15 /* write the status will by write granularity */
16 _FDB_WRITE_STATUS(db, idx_addr, idx.status_table, FDB_TSL_STATUS_NUM, FDB_TSL_WRITE, true);
17
18 return result;
19 }
可write_tsl()这个函数,里面声明了result,赋值为0,然后就是最后的return result了,其他地方没用到result。
奇怪这个result是什么时候被赋值为2的。
-------------------------------
懂了,在该函数里调用的几个宏里,有return result返回,如:
68 #define _FDB_WRITE_STATUS(db, addr, status_table, status_num, status_index, sync) \
1 do { \
2 result = _fdb_write_status((fdb_db_t)db, addr, status_table, status_num, status_index, sync);\
3 if (result != FDB_NO_ERR) return result; \
4 } while(0);
5
6 #define FLASH_WRITE(db, addr, buf, size, sync) \
7 do { \
8 result = _fdb_flash_write((fdb_db_t)db, addr, buf, size, sync); \
9 if (result != FDB_NO_ERR) return result; \
10 } while(0);
---------------------------------------------
修改FDB_WRITE_GRAN这个值,由32改为1,结果报错crc错误。
我用的spi nor flash,四线qspi,应该选1吧?
26 /* Using FAL storage mode */
1 // #define FDB_USING_FAL_MODE
2
3 #ifdef FDB_USING_FAL_MODE
4 /* the flash write granularity, unit: bit
5 * only support 1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32f7)/ 128(stm32h5) */
6 #define FDB_WRITE_GRAN 1 /* @note you must define it for a value */
7 #endif
dlk /> test_flashdb
dlk /> [FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1784) The oldest addr is @0x00000000
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1800) KVDB size is 16384 bytes.
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00000000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00001000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00002000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00003000).
[FlashDB][kv][env][/data] All sector header is incorrect. Set it to default.
[FlashDB] FlashDB V2.1.0 is initialize success.
[FlashDB] You can get the latest version on https://github.com/armink/FlashDB .
[FlashDB][sample][kvdb][basic] ==================== kvdb_basic_sample ====================
[FlashDB][sample][kvdb][basic] get the 'boot_count' failed
[FlashDB][sample][kvdb][basic] set the 'boot_count' value to 1
[FlashDB][sample][kvdb][basic] ===========================================================
[FlashDB][sample][kvdb][string] ==================== kvdb_type_string_sample ====================
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][sample][kvdb][string] create the 'temp' string KV, value is: 36C
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][sample][kvdb][string] set 'temp' value to 38C
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][string] delete the 'temp' finish
[FlashDB][sample][kvdb][string] ===========================================================
[FlashDB][sample][kvdb][blob] ==================== kvdb_type_blob_sample ====================
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][sample][kvdb][blob] create the 'temp' blob KV, value is: 36
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][sample][kvdb][blob] set 'temp' value to 38
[FlashDB][kv][env][/data] Error: Read the KV (@0x00000010) CRC32 check failed!
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][blob] delete the 'temp' finish
[FlashDB][sample][kvdb][blob] ===========================================================
[FlashDB][tsl][log][/data] Sector (0x00000000) header info is incorrect.
[FlashDB][tsl][log][/data] All sector format finished.
[FlashDB][tsl][log][/data] (packages/third-party/FlashDB/src/fdb_tsdb.c:978) TSDB (log) oldest sectors is 0x00000000, current using sector .
[FlashDB][sample][tsdb] ==================== tsdb_sample ====================
[FlashDB][tsl][log][/data] Error: update the sector status failed (2)[FlashDB][sample][tsdb] append the new status.temp (36) and status.hum )
[FlashDB][tsl][log][/data] Error: write tsl failed (2)[FlashDB][sample][tsdb] append the new status.temp (38) and status.humi (90)
[FlashDB][sample][tsdb] [query_cb] queried a TSL: time: 0, temp: 40, humi: 805688500
[FlashDB][sample][tsdb] [query_by_time_cb] queried a TSL: time: 0, temp: 40, humi: 805688604
[FlashDB][sample][tsdb] query count is: 0
[FlashDB][sample][tsdb] set the TSL (time 0) status from 1 to 3
[FlashDB][sample][tsdb] ===========================================================
--------------------------------
定位到这里,fwrite写入的size是12,可函数返回值却是1.
if ((fseek(fp, addr, SEEK_SET) != 0) || (fwrite(buf, size, 1, fp) != size))
dlk /> test_flashdb
dlk /> [FlashDB][sample][kvdb][basic] ==================== kvdb_basic_sample ====================
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][basic] get the 'boot_count' value is 0
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][basic] set the 'boot_count' value to 1
[FlashDB][sample][kvdb][basic] ===========================================================
[FlashDB][sample][kvdb][string] ==================== kvdb_type_string_sample ====================
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][string] create the 'temp' string KV, value is: 36C
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][string] set 'temp' value to 38C
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][string] delete the 'temp' finish
[FlashDB][sample][kvdb][string] ===========================================================
[FlashDB][sample][kvdb][blob] ==================== kvdb_type_blob_sample ====================
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][blob] create the 'temp' blob KV, value is: 36
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][blob] get the 'temp' value is: 0
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][blob] set 'temp' value to 38
[FlashDB][kv][(null)][(null)] Error: KV ((null)) isn't initialize OK.
[FlashDB][sample][kvdb][blob] delete the 'temp' finish
[FlashDB][sample][kvdb][blob] ===========================================================
[FlashDB] Error: Partition (fdb_tsdb1) not found.
[FlashDB] Error: TSDB (log
今早发现FlashDB目录下不知道什么时候多了个文件,打开看貌似是些记录啥的。忘了名了,已经删了,再次编译也没再出现。
不过执行test_flashdb,出现以上信息。
--------------------------------------------
发现昨天保存时,不知道什么时候删除了个/,导致fdb_kvdb_init()这条语句被注释了。恢复后,还是昨天下午的那个报错。
lk /> test_flashdb
dlk /> [FlashDB] (db->sec_size != 0) has assert failed at _fdb_init_ex.
----------------------------------------------
照抄linux的demo,又增加了两个语句:
bool file_mode = true;
uint32_t sec_size = 4096, db_size = sec_size * 4;
/* set the sector and database max size */
fdb_kvdb_control(&kvdb, FDB_KVDB_CTRL_SET_SEC_SIZE, &sec_size);
fdb_kvdb_control(&kvdb, FDB_KVDB_CTRL_SET_MAX_SIZE, &db_size);
/* enable file mode */
fdb_kvdb_control(&kvdb, FDB_KVDB_CTRL_SET_FILE_MODE, &file_mode);
编译后可以运行,但是/data目录下没有看到新增文件。
dlk /> test_flashdb
dlk /> [FlashDB][kv][env][/dev/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1784) The oldest addr is @0x00000000
[FlashDB][kv][env][/dev/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1800) KVDB size is 16384 bytes.
[FlashDB][kv][env][/dev/data] Sector header info is incorrect. Auto format this sector (0x00000000).
[FlashDB][file] Error: open (/dev/data/env.fdb.0) file failed.
[FlashDB][kv][env][/dev/data] Sector header info is incorrect. Auto format this sector (0x00001000).
[FlashDB][file] Error: open (/dev/data/env.fdb.1) file failed.
[FlashDB][kv][env][/dev/data] Sector header info is incorrect. Auto format this sector (0x00002000).
[FlashDB][file] Error: open (/dev/data/env.fdb.2) file failed.
[FlashDB][kv][env][/dev/data] Sector header info is incorrect. Auto format this sector (0x00003000).
[FlashDB][file] Error: open (/dev/data/env.fdb.3) file failed.
[FlashDB][kv][env][/dev/data] All sector header is incorrect. Set it to default.
[FlashDB][file] Error: open (/dev/data/env.fdb.0) file failed.
[FlashDB] FlashDB V2.1.0 is initialize success.
[FlashDB] You can get the latest version on https://github.com/armink/FlashDB .
[FlashDB][sample][kvdb][basic] ==================== kvdb_basic_sample ====================
[FlashDB][sample][kvdb][basic] get the 'boot_count' failed
[FlashDB][sample][kvdb][basic] set the 'boot_count' value to 1
[FlashDB][sample][kvdb][basic] ===========================================================
[FlashDB][sample][kvdb][string] ==================== kvdb_type_string_sample ====================
[FlashDB][sample][kvdb][string] create the 'temp' string KV, value is: 36C
[FlashDB][sample][kvdb][string] set 'temp' value to 38C
[FlashDB][kv][env][/dev/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][string] delete the 'temp' finish
[FlashDB][sample][kvdb][string] ===========================================================
[FlashDB][sample][kvdb][blob] ==================== kvdb_type_blob_sample ====================
[FlashDB][sample][kvdb][blob] create the 'temp' blob KV, value is: 36
[FlashDB][sample][kvdb][blob] set 'temp' value to 38
[FlashDB][kv][env][/dev/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][blob] delete the 'temp' finish
[FlashDB][sample][kvdb][blob] ===========================================================
[FlashDB][tsl][log][/dev/data] Sector (0x00000000) header info is incorrect.
[FlashDB][file] Error: open (/dev/data/log.fdb.0) file failed.
[FlashDB][file] Error: open (/dev/data/log.fdb.1) file failed.
[FlashDB][file] Error: open (/dev/data/log.fdb.2) file failed.
[FlashDB][file] Error: open (/dev/data/log.fdb.3) file failed.
[FlashDB][tsl][log][/dev/data] All sector format finished.
[FlashDB][tsl][log][/dev/data] (packages/third-party/FlashDB/src/fdb_tsdb.c:978) TSDB (log) oldest sectors is 0x00000000, current using sec .
[FlashDB][sample][tsdb] ==================== tsdb_sample ====================
[FlashDB][tsl][log][/dev/data] Error: write tsl failed (3)[FlashDB][sample][tsdb] append the new status.temp (36) and status.humi (85)
[FlashDB][tsl][log][/dev/data] Error: write tsl failed (3)[FlashDB][sample][tsdb] append the new status.temp (38) and status.humi (90)
[FlashDB][sample][tsdb] query count is: 0
[FlashDB][sample][tsdb] ===========================================================
---------------------------------------------
原来用的posix模式打开文件,修改为libc模式,貌似成功了。
35 /* Using file storage mode by LIBC file API, like fopen/fread/fwrte/fclose */
1 #define FDB_USING_FILE_LIBC_MODE
2
3 /* Using file storage mode by POSIX file API, like open/read/write/close */
4 // #define FDB_USING_FILE_POSIX_MODE
dlk /> test_flashdb
dlk /> [FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1784) The oldest addr is @0x00000000
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1800) KVDB size is 16384 bytes.
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00000000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00001000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00002000).
[FlashDB][kv][env][/data] Sector header info is incorrect. Auto format this sector (0x00003000).
[FlashDB][kv][env][/data] All sector header is incorrect. Set it to default.
[FlashDB] FlashDB V2.1.0 is initialize success.
[FlashDB] You can get the latest version on https://github.com/armink/FlashDB .
[FlashDB][sample][kvdb][basic] ==================== kvdb_basic_sample ====================
[FlashDB][sample][kvdb][basic] get the 'boot_count' failed
[FlashDB][sample][kvdb][basic] set the 'boot_count' value to 1
[FlashDB][sample][kvdb][basic] ===========================================================
[FlashDB][sample][kvdb][string] ==================== kvdb_type_string_sample ====================
[FlashDB][kv][env][/data] Error: The KV @0x00000024 length has an error.
[FlashDB][sample][kvdb][string] create the 'temp' string KV, value is: 36C
[FlashDB][sample][kvdb][string] set 'temp' value to 38C
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][string] delete the 'temp' finish
[FlashDB][sample][kvdb][string] ===========================================================
[FlashDB][sample][kvdb][blob] ==================== kvdb_type_blob_sample ====================
[FlashDB][sample][kvdb][blob] create the 'temp' blob KV, value is: 36
[FlashDB][sample][kvdb][blob] set 'temp' value to 38
[FlashDB][kv][env][/data] (packages/third-party/FlashDB/src/fdb_kvdb.c:954) Not found 'temp' in KV.
[FlashDB][sample][kvdb][blob] delete the 'temp' finish
[FlashDB][sample][kvdb][blob] ===========================================================
[FlashDB][tsl][log][/data] Sector (0x00000000) header info is incorrect.
[FlashDB][tsl][log][/data] All sector format finished.
[FlashDB][tsl][log][/data] (packages/third-party/FlashDB/src/fdb_tsdb.c:978) TSDB (log) oldest sectors is 0x00000000, current using sector .
[FlashDB][sample][tsdb] ==================== tsdb_sample ====================
[FlashDB][tsl][log][/data] Error: write tsl failed (2)[FlashDB][sample][tsdb] append the new status.temp (36) and status.humi (85)
[FlashDB][tsl][log][/data] Error: write tsl failed (2)[FlashDB][sample][tsdb] append the new status.temp (38) and status.humi (90)
[FlashDB][sample][tsdb] query count is: 0
[FlashDB][sample][tsdb] ===========================================================
dlk /> cd /data
dlk /data> ls
Directory /data:
env.fdb.0 4096
env.fdb.1 4096
env.fdb.2 4096
env.fdb.3 4096
log.fdb.0 4096
log.fdb.1 4096
log.fdb.2 4096
log.fdb.3 4096
参考linux那个demo发现,要使用文件系统,除了使能那两个宏之一,还要增加个设置语句:
bool file_mode = true;
fdb_kvdb_control(&kvdb, FDB_KVDB_CTRL_SET_FILE_MODE, &file_mode);
运行后,提示堆栈溢出,原来分配了1K,改成10k,不再报那个错误了,但是有如下报错,也不知道写入是否成功,明天再看。
dlk /> test_flashdb
dlk /> [FlashDB] (db->sec_size != 0) has assert failed at _fdb_init_ex.
板子是匠芯创的d133,片外spi nor flash。目前有两个分区用来存储数据,/rodata分区格式化为fat32文件系统,/data分区格式化为littlefs文件系统,两个分区都可读写。
luban-lite sdk里虽然有flashdb配置选项,但是没有flashdb库文件。手动下载下来放到packages/third-party/目录下,将src,inc,sample三个文件夹加到工程里,demo目录下有多个单片机的demo,照抄stm32f405-spi-flash那个,写了个test_demo.c文件放到了demo目录下并添加到工程里。
初始化时,有这个语句:
// result = fdb_kvdb_init(&kvdb, "env", "fdb_kvdb1", &default_kv, NULL);
result = fdb_kvdb_init(&kvdb, "env", "/dev/data", &default_kv, NULL);
板子没有叫fdb_kvdb1的分区,我改成"data",报错:
dlk /> fal probe qspi01
Device qspi01 NOT found. Probe failed.
No flash device or partition was probed.
Usage: fal probe [dev_name|part_name] - probe flash device or partition by given name.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | spl | norflash0 | 0x00000000 | 0x00040000 |
[I/FAL] | env | norflash0 | 0x00040000 | 0x00020000 |
[I/FAL] | env_r | norflash0 | 0x00060000 | 0x00020000 |
[I/FAL] | os | norflash0 | 0x00080000 | 0x00200000 |
[I/FAL] | os_r | norflash0 | 0x00280000 | 0x00000000 |
[I/FAL] | rodata | norflash0 | 0x00280000 | 0x00500000 |
[I/FAL] | rodata_r | norflash0 | 0x00780000 | 0x00100000 |
[I/FAL] | data | norflash0 | 0x00880000 | 0x00700000 |
[I/FAL] =============================================================
dlk /> test_flashdb
dlk /> [FlashDB][kv][env][data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1784) The oldest addr is @0x00000000
[FlashDB][kv][env][data] (packages/third-party/FlashDB/src/fdb_kvdb.c:1800) KVDB size is 7340032 bytes.
[FlashDB][kv][env][data] Sector header info is incorrect. Auto format this sector (0x00000000).
改成"/data"或"/dev/data",使能FDB_USING_FILE_LIBC_MODE或FDB_USING_FILE_POSIX_MODE, 报错找不到分区:
dlk /> test_flashdb
dlk /> [FlashDB] Error: Partition (/data) not found.
[FlashDB] Error: KVDB (env
@温柔的猪 之前回复过你,还没搞定吗。在rtconfig.py 里添加 -fdiagnostics-color=always 就会有颜色提示了
不好意思,一直没尝试,后来忘了。今天编译时又找不到报错在哪一行,于是就发了这个帖子。
我找到了rtconfig.py,但是不知道该加到哪里。
直接加到末尾新行,不符合语法。
写成这样又没效果:
SCONSFLAGS="-fdiagnostics-color=always"
-----------------------------------------------
0 BUILD = 'release'
1 if BUILD == 'debug':
2 CFLAGS_DBG = ' -O0 -gdwarf-2 -fdiagnostics-color=always'
3 AFLAGS_DBG = ' -gdwarf-2'
4 else:
5 CFLAGS_DBG = ' -O2 -g2 -fdiagnostics-color=always'
6 AFLAGS_DBG = ''
7
不知道该加到哪个flags里,就加到CFLAGS_DBG里了,我看下面还有CFLAGS和M_CFLAGS,也都用到了这个变量。
反正是起作用了。
感谢。
忘了之前的过程了...
2.0的sdk是从mango的github上下载的,现在好像仓库移除了。
2.1的sdk是从全志官网下载的,当时注册就能下载,现在貌似不行了,得签nda。
不过t113s3官方的sdk已经是tina5.x了吧。tina2.x是基于openwrt的,tina5.x是直接基于buildroot的了,好像是这样子。
之前用tina2.0时,make menuconfig里有qt选项,于是就想尽量用官方自带的,觉得可能更好,于是就折腾了一阵子。
而到tina2.1时,sdk里已经没有qt库了,也就死心了,安心单独编译qt。
cp: cannot stat '/home/embedfire/workspace/tina-t113/Tina_Linux_2022/Tina-Linux/out/t113-evb1/compile_dir/target/qt-everywhere-src-5.12.9/ipkg-install/usr/lib/libQt5MultimediaQuick.so*': No such file or directory
无论自己单独编译,还是用sdk自带的,编译qt都有个配置选项,里边配置编译哪些库。你可以看下是应该选这个库还是不该选。
编译qt库也挺费时间的。
https://club.rt-thread.org/ask/question/9faea7447d375649.html
看这篇文章,发现需要打开SAL选项,估计是
enable bsd socket operated by file system api.
但是我搜目前的rtt组件,没搜到这个,目前打开的是:
│ │ [*] SAL: socket abstraction layer ---> │ │
│ │ -*- Enable network interface device --->
而且,和local package里的lwip寸在冲突。
现在不用local lwip时,sqlite功能正常了。
-----------------------------------------------
一次插入8000条数据,可以成功,插入9000条,就卡住了,重启后发现目录下多了个journel.db。
删掉数据库,创新创建,多次插入8000调数据,可以成功,但发现插入一条数据的时间比插入8000调数据的时间还长。
比如,插入一条数据要16秒,插入8000调要12秒。
多次插入后,就出错了,用stu score再也无法查询出某范围的条数。复制数据到到pc,用db brower查看,也看到数据内容。
此时文件系统没有被占满,分配了7M空间,数据库才700多k。
------------------------------
删掉数据库,重新创建,然后每次只插入一条数据,发现时间大概话非1秒,有点难受啊。
用stu命令可以看到列出数据,看数据库最大条数是8564, 再新增也是这个数字。那么,数据库最大容量是8564?但实际不是,用stu score m n,可列出score值巍在m和n范围内的数据条,可以看的id有超过8664的。
莫名奇妙的例程能正常运行了。
dlk /data> create_student_tbl
/data/stu_info.dbdlk /data>
dlk /data> ls
Directory /data:
stu_info.db 12288
dlk /data> stu add 10
Insert 10 record(s): 1166ms, speed: 116ms/record
dlk /data> stu
test get all students
id:1 name:Student44408 score:40
id:2 name:Student44409 score:41
id:3 name:Student44411 score:43
id:4 name:Student44414 score:46
id:5 name:Student44418 score:50
id:6 name:Student44423 score:55
id:7 name:Student44429 score:61
id:8 name:Student44436 score:68
id:9 name:Student44444 score:76
id:10 name:Student44453 score:85
record(s):10
dlk /data> stu score 40 60
-------------------------------------
创建数据库,新增数据、删除、按分数范围查找,都能执行。
执行stu score时有个坑,按说stu score 40 60,就可以查找40-60分数的数据,结果本来是4个参数,有个可选的第5个参数,程序里只判断参数大于4个的情况下,也会去读取第5个参数,结果就卡住了。加个条件即可,参数大于5时才读第5个参数。
msh线程分配了10k空间,占用率85%。
-------------------------------------
上午发现stu add命令可以成功执行后,觉得之前尝试给msh分配的空间太大了,就由512k逐渐减下去,减到10k后sqlite例程的几个命令还可以使用,以为没事了。
下午切到win下,又试着重新编译sdk里的sqlite,结果又出现了上次的问题,create_student_tbl命令可以成功创建数据库,但是stu add命令就会失败,仍报错:
bind failed errmsg:database disk image is malformed
msh线程空间也改大了,无效。怀疑是spi速度的原因影响spi nor flash里的littlefs分区的读写,降低spi速度,无效。
又切回到ubuntu下,由于下午想尝试libmodbus,重新编译过。发现ubuntu下编译烧录后,stu add命令也是报错。
https://club.rt-thread.org/ask/question/9faea7447d375649.html
这个sqlite在spi和sd卡上没法用,慢到无法忍受.归根结底是文件系统速度太慢.我有在uffs和yaffs文件系统上测,文件系统速度是上去了。但是数据量增加到一定量数据库就报SQL error: database disk image is malformed。不知道什么鬼。
但是在SD卡文件系统上测试就不会
在rtt论坛搜到同样报错的帖子,我还是放弃单片机上跑sqlite吧,或者等artinchip来解决。
话说,artinchip的lunban-lite sdk里带的这个sqlite,也许是给d21x这类片子运行的吧。
还是得看readme.
358 ## 注意事项
1 - SQLite资源占用:RAM:250KB+,ROM:310KB+,所以需要有较充足的硬件资源。
2 - 根据应用场景创建合理的表结构,会提高操作效率。
3 - 根据应用场合理使用SQL语句,如查询条件,插入方式等。
4 - 如涉及到多表操作或联表查询,最好使用PowerDesigner等工具合理设计表。
我是在msh里执行create_student_tbl命令的,应该是需要比较大的内存,而msh默认分配了4k内存,改成40k后,可以创建数据库成功了。使用stu add xxx命令来增加数据条出错了,还在解决:
dlk />
dlk /> cd data
dlk /data> ls
Directory /data:
123 4
stu_info.db 12288
ui_font_Big.c 102408
dlk /data> stu add 1
01-01 08:31:52 E/app.dbhelper: bind failed errmsg:database disk image is malformed
01-01 08:31:52 E/app.dbhelper: db operator failed,rc=1
01-01 08:31:52 E/app.student_dao: add failed!
dlk /data>
dbhelper.c文件里,该行报错:
268 sqlite3_finalize(stmt);
1 if ((rc != SQLITE_OK) && (rc != SQLITE_DONE))
2 {
3 LOG_E("bind failed errmsg:%s", sqlite3_errmsg(db));
4 goto __db_exec_fail;
5 }
-------------------------------
msh栈空间改为400k,结果仍一样。
尝试改为1M,结果上电后,不运行了...
---------------------------------
student_dao.c里,执行stu add命令后,会调用到这个函数。
int student_add(rt_list_t *h)
{
return db_nonquery_operator("insert into student(name,score) values (?,?);", student_insert_bind, h);
}
db_nonquery_operator()执行一系列操作后,调用的是如下函数。
static int student_insert_bind(sqlite3_stmt *stmt, int index, void *arg)
{
int rc = 0;
rt_list_t *h = arg, *pos, *n;
student_t *s = RT_NULL;
rt_list_for_each_safe(pos, n, h)
{
s = rt_list_entry(pos, student_t, list);
sqlite3_reset(stmt); //reset the stmt
sqlite3_bind_text(stmt, 1, s->name, strlen(s->name), NULL); //bind the 1st data,is a string
sqlite3_bind_int(stmt, 2, s->score); //bind the 1st data,is a int
rc = sqlite3_step(stmt); //execute the stmt by step
}
if (rc != SQLITE_DONE)
return rc;
return SQLITE_OK;
}
感觉是这个函数执行后返回的值rc,根据rc值执行了报错输出。
@Gentlepig
写一大串没用的,难道你就没有怀疑是你输入的命令有问题?写了一大串也没有把重要细节show出来!
输入命令如下:
dlk /> df /rodata
disk free: 4.8 MB [ 9968 block, 512 bytes per block ]
dlk /> df /data
disk free: 6.8 MB [ 1764 block, 4096 bytes per block ]
dlk /> create_student_tbl
/rodata/stu_info.db
对应函数如下,无参数,目的是创建数据库:
static int create_student_tbl(void)
{
int fd = 0;
db_set_name("/data/stu_info.db");
fd = open(db_get_name(), O_RDONLY);
rt_kprintf(db_get_name());
if (fd < 0)
{
/* there is not the .db file.create db and table */
const char *sql = "CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
return db_create_database(sql);
}
else if (db_table_is_exist("student") > 0)
{
/* there is the table int db.close the db. */
close(fd);
LOG_I("The table has already existed!\n");
return RT_EOK;
}
else
{
/* there is not the table int db.create the table */
const char *sql = "CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
return db_create_database(sql);
}
}
MSH_CMD_EXPORT(create_student_tbl, create sqlite db);
详细文件见:
https://gitee.com/artinchip/luban-lite/blob/master/packages/third-party/sqlite/student_dao.c
手头的板子没焊接sd相关,打算先用spi nor flash存储做个尝试。
rtt配置里勾选了littlefs和sqlte,sqlite里勾选了example。
/rodata配置为fatfs,分配了5M;/data配置为littlefs,分配了7M。
student_dao.c里默认数据库存在/data/stu_info.db。
编译后烧录到板子上,执行crate_student_tbl命令,按说应该在/data目录下生成stu_info.db数据库,可串口终端一直卡在这个命令这里,不过光标还是闪烁的。
等了几分钟后,仍是这个效果,就重启板子,发现/data下有stu_info.db文件,虽然大小为0。
执行stu命令,应该显示数据库所有数据,结果仍是卡住且光标正常闪烁。
以为是文件系统的问题,将student_dao.c里创建数据库的位值改为/rodata,这个是fatfs格式的。
结果执行create_student_tbl命令后,还是卡住,重启后,在/rodata目录下,并没有db数据库文件生成。
目前用d133定时采集can总线上的数据,然后在rgb屏幕上的lvgl界面上显示出来。
但是想保存采集到的数据,方便其他设备查询历史记录,或者在lvgl界面上查询历史记录。
请教,有什么好的办法?
问了几个群里,有推荐sqlite3和flashdb的。想知道,使用数据库有什么好处?
还有就是目前使用的spi nor flash,如果用fatfs,好想说并不适合频繁擦写。
目前有两种需求:
1, 采集can总线上定时发送过来的数据,每次保存,或几次采集后保存一次,可能保存频率很高;
2, 采集can总线上不定时发送过来的,一般是系统出现问题时才发送过来,保存频率较低。
更新1.0.5版本的sdk后,上电时can容易进错误中断的现象消除了。
对比新旧两版test_can例程,发现新例程在打开并配置好can后,增加了句打开can中断的语句。
//enable CAN TX interrupt
rt_device_control(can_tx_dev, RT_DEVICE_CTRL_SET_INT, NULL);
上一版的例程里没这么一句,但是却能进can中断。奇怪。
另,新版的sdk,lvgl的rtp使能后正常了,但是旋转屏幕却变得不正常了。
在lv_port_disp.c里的lv_port_disp_init()函数里,增加这一句:
// disp_drv.rotated = LV_DISP_ROT_180;
画面视觉效果没有旋转,但是点击按钮没反映,而按旋转后的位值虚空点击,却出现了点击效果。
感觉是,画面貌似旋转了,但是呈现没旋转。
--------------------------------------------------------
比较下了,两版sdk,打开can时,参数里都带有中断方式参数,新版的,在设置完波特率等后,又通过ctrl命令打开中断。
于是对比了两版sdk里rtt_kernel里的can驱动部分,的rt_can_open(),发现给的参数里有中断方式,那么就在函数结尾处直接调用contrl命令打开中断。而新版里注释了这部分。
那么问题应该就是就板过早的打开了can接收中断,波特率还未配置,滤波器组也未配置,结果总线上有信息,于是就报错进错误中断了。
----------------------
lvgl屏幕旋转的问题是,忘了使能USE_DRAW_BUF这个宏定义。
win10下,sdk应该是1.0.4, 之前编译通过了。今天尝试再次编译,结果报错找不到stddef.h这个文件。
编译d133默认工程也是报这个错误。
搜了下,在rtdef.h里有:
#include <rtconfig.h>
#ifdef RT_USING_LIBC
#include <stdint.h>
#include <stddef.h>
#include <stdarg.h>
#endif /* RT_USING_LIBC */
又搜到:
在开启了 RT_USING_LIBC 后,GCC 编译使用 newlib
未开启 RT_USING_LIBC 时,GCC 编译使用 minilibc
dlib 是 RT-Thread 针对 IAR 编译器的移植适配(使用标准库接口时注意开启 RT_USING_LIBC)
armlibc 是 RT-Thread 针对 MDK 编译器的移植适配
https://blog.csdn.net/wandersky0822/article/details/120130059
但是,我印象中我没做啥设置修改啊。
-----------------------------
在me菜单里,搜了下RT_USING_LIBC,看其依赖关系,现在没处于选中状态啊。
-----------------------------
> m
scons: Reading SConscript files ...
args.outfile: F:\MCU\ArtinChip\luban-lite/partition_table.h
cc1.exe: warning: is shorter than expected
Newlib version:3.2.0
F:\MCU\ArtinChip\luban-lite\kernel\rt-thread
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: output\d13x_kunlunpi88-nor_rt-thread_helloworld
CC application\rt-thread\helloworld\main.c
CC bsp\artinchip\drv\audio\drv_audio.c
In file included from kernel\rt-thread\include/rtthread.h:27,
from application\rt-thread\helloworld\main.c:9:
kernel\rt-thread\include/rtdef.h:55:10: fatal error: stddef.h: No such file or directory
55 | #include <stddef.h>
| ^~~~~~~~~~
compilation terminated . CC bsp\artinchip\drv\audio\drv_dmic.c
我用的这个就是功率电感吧
功率电感一般是那种绕线的,比如4030封装之类的。
1、打开 USE_DRAW_BUF;
2、设置变量 disp_drv.rotated = LV_DISP_ROT_90;
3.由于LVGL的旋转方向和触摸定义的旋转方向反了,1.0.3的SDK需要手动对调下90,270。后续SDK会更新掉这个问题。
LV_DISP_ROT_90
这是设置LVGL的旋转。
看sdk菜单里有frame旋转功能,但是我总是设置不成功。我设置旋转180度,结果rgb屏幕就变成雪花点了。
> Board options > Display Parameter ────────────────────────────────
┌───────────────── framebuffer rotation degree ─────────────────┐
│ Use the arrow keys to navigate this window or press the │
│ hotkey of the item you wish to select followed by the <SPACE │
│ BAR>. Press <?> for additional information about this │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ (X) 0 │ │
│ │ ( ) 90 │ │
│ │ ( ) 180 │ │
│ │ ( ) 270 │ │
│ │ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────┘ │
├───────────────────────────────────────────────────────────────┤
│ <Select> < Help > │
└───────────────────────────────────────────────────────────────┘
bit4 R/W 0x0 SLEEP_MOD:Sleep Mode,休眠模式,只在复位模式可写
0x0:正常操作。控制器唤醒。
0x1:休眠模式。CAN无总线活动和无中断发生。
bit3 R/W 0x0 FILTER_MOD:Acceptance Filter Mode,接收过滤器模式
0x0:双过滤模式。使用两个过滤器。
0x1:单过滤模式。使用一个4字节过滤器。
bit2 R/W 0x0 SELFTEST_MOD:Self Test Mode,自测模式
0x0:正常操作。发送成功需有应答。
0x1:自测模式。在SELF_REQ自接收请求指令下,无需其它节点
参与也能完成整个节点测试,发送成功无需应答。
bit1 R/W 0x0 LISTEN_MOD:Listen Only Mode,只听模式
0x0:正常操作。错误计数停止于当前值 。
0x1:只听模式。只接收总线上数据,不产生应答信号,
也不更新接收错误计数。
bit0 R/W 0x1 RST_MOD:Reset Mode,复位模式
0x0:正常操作。控制器返回正常操作模式。
0x1:复位模式。发送或接收中止,控制器处于可配置状态。
这是can状态寄存器的描述。
程序里出错时打印了状态寄存器的值,我看是0xA2和0xF3差不多交替出现。这么看,像是在自动切换复位模式和正常模式。
[E] hal_can_bus_error_msg()340 0xA2
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Stuff Error, [E] hal_can_bus_error_msg()335 ID28~21
[E] hal_can_bus_error_msg()340 0xF3
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Other Error, [E] hal_can_bus_error_msg()335 Tolerate dominant bits
[E] hal_can_bus_error_msg()340 0xA2
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Other Error, [E] hal_can_bus_error_msg()335 Tolerate dominant bits
[E] hal_can_bus_error_msg()340 0xF3
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Other Error, [E] hal_can_bus_error_msg()335 Tolerate dominant bits
[E] hal_can_bus_error_msg()340 0xA2
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Stuff Error, [E] hal_can_bus_error_msg()335 ID28~21
[E] hal_can_bus_error_msg()340 0xA2
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Other Error, [E] hal_can_bus_error_msg()335 Tolerate dominant bits
[E] hal_can_bus_error_msg()340 0xF3
[E] hal_can_bus_error_msg()303 error in RX direction, [E] hal_can_bus_error_msg()314 Stuff Error, [E] hal_can_bus_error_msg()335 ID28~21
这是can错误处理函数,直接CAN_INTR_ERRB错误,进hal_can_bus_error_msg()函数。
看到里边有对发送错误计数寄存器的读取staus.txerr,超过阈值后,将can设置为复位模式。
虽然有对接收错误计数寄存器stauts.rxerr的读取,但是没看到有其它地方调用到。
另有对溢出错误的累加计数。
而看错误提示,应该是:
ERRB_INT:Bus Error Interrupt,总线错误中断(节点检测到总线上发生了错误)。
错误信息里提到的是,接收方向错误,Tolerate dominant bits错误。
static void hal_can_error_handle(can_handle *phandle, u32 err_status)
{
u32 can_status;
u8 errcode;
errcode = readb(phandle->can_base + CAN_ERRCODE_REG) &
CAN_ERRCODE_SEGCODE_MASK;
can_status = readl(phandle->can_base + CAN_STAT_REG);
phandle->status.rxerr = readl(phandle->can_base + CAN_RXERR_REG);
phandle->status.txerr = readl(phandle->can_base + CAN_TXERR_REG);
if (err_status & CAN_INTR_ERRB) {
hal_can_bus_error_msg(phandle);
}
if (err_status & CAN_INTR_ARBLOST) {
hal_can_arblost_msg(phandle);
}
if (err_status & CAN_INTR_ERRP) {
if (phandle->status.current_state == PASSIVE_STATUS)
phandle->status.current_state = WARNING_STATUS;
else
phandle->status.current_state = PASSIVE_STATUS;
}
if (err_status & CAN_INTR_OVF) {
phandle->status.othererrcnt++;
phandle->status.recverrcnt++;
hal_can_set_mode(phandle, CAN_MODE_RST);
hal_can_mode_release(phandle, CAN_MODE_RST);
if (phandle->callback)
phandle->callback(phandle, (void *)CAN_EVENT_RXOF_IND);
/* clear bit */
writel(CAN_MCR_CLR_OVF, phandle->can_base + CAN_MCR_REG);
}
if (err_status & CAN_INTR_ERRW) {
if (can_status & CAN_STAT_BUS)
phandle->status.current_state = BUS_OFF;
else if (can_status & CAN_STAT_ERR)
phandle->status.current_state = WARNING_STATUS;
else
phandle->status.current_state = ACTIVE_STATUS;
}
if (phandle->status.current_state == BUS_OFF)
hal_can_mode_release(phandle, CAN_MODE_RST);
if (phandle->status.txerr > CAN_ERRP_THRESHOLD &&
errcode == CAN_ERRCODE_ACK_SLOT)
{
writel(CAN_MCR_ABORTREQ, phandle->can_base + CAN_MCR_REG);
hal_can_set_mode(phandle, CAN_MODE_RST);
hal_can_mode_release(phandle, CAN_MODE_RST);
}
}
hal_can_bus_error_msg()函数里,打印出了错误的方向、错误的类型、在哪个阶段出的错。
static void hal_can_bus_error_msg(can_handle *phandle)
{
u8 i;
u8 errinfo = readb(phandle->can_base + CAN_ERRCODE_REG);
u8 errtype = (errinfo & CAN_ERRCODE_ERRTYPE_MASK) >> 6;
u8 errdir = (errinfo & CAN_ERRCODE_DIR) >> 5;
u8 errcode = errinfo & CAN_ERRCODE_SEGCODE_MASK;
for (i = 0; i < ARRAY_SIZE(bus_err_dir); i++) {
if (errdir == bus_err_dir[i].code) {
hal_log_err("%s, ", bus_err_dir[i].msg);
if (i)
phandle->status.recverrcnt++;
else
phandle->status.snderrcnt++;
break;
}
}
for (i = 0; i < ARRAY_SIZE(bus_err_type); i++) {
if (errtype == bus_err_type[i].code) {
hal_log_err("%s, ", bus_err_type[i].msg);
switch (i) {
case 0:
phandle->status.biterrcnt++;
break;
case 1:
phandle->status.formaterrcnt++;
break;
case 2:
phandle->status.stufferrcnt++;
break;
default:
phandle->status.othererrcnt++;
break;
}
break;
}
}
for (i = 0; i < ARRAY_SIZE(bus_err_code); i++) {
if (errcode == bus_err_code[i].code) {
hal_log_err("%s\n", bus_err_code[i].msg);
break;
}
}
}
翻了手册,看到这么一段话:
错误报警阈值ERRWT将作为报警功能提示当前发生的总线错误,且在控制器进入被动错误状态之前被触发。在复位模式下,ERRWT数值可在错误报警阈值寄存器(CAN_ERRWT)中进行配置。当TEC和/或REC数值大于等于ERRWT时,ERR_STAT 被置1。当TEC 和REC 数值都小于ERRWT时, ERR_STAT被复位0。只要ERR_STAT或BUS_STAT位值发生变化,便会触发错误报警中断ERRW_INT。
当TEC和/或REC数值大于127 时,节点进入被动错误状态。当TEC和REC数值都小于等于127时,节点重新变为主动错误状态。节点在主动错误和被动错误状态之间切换时,都将触发被动错误中断ERRP_INT。
当TEC 数值大于255 时,节点进入总线关闭离线状态。此时,控制器将REC数值置为0、TEC数值置为127、BUS_STAT位置1、产生错误报警中断ERRW_INT、控制器进入复位模式。
为了返回主动错误状态,必须进行离线恢复。首先需要退出复位模式,进入正常操作模式;然后要求节点在总线上检测到128 次11 个连续隐性位。每一次检测到11 个连续隐性位时,TEC 数值都将减1,当离线恢复完成后(TEC 数值从127 减小到0),BUS_STAT位复位为0,从而触发错误报警中断ERRW_INT。
看can相关寄存器,有个CAN_MODE寄存器,0为复位模式,3为接收过滤。
irqreturn_t hal_can_isr_handler(int irq_num, void *arg)
{
u32 int_status;
can_handle *phandle = (can_handle *)arg;
int_status = readl(phandle->can_base + CAN_INTR_REG);
if (int_status & (CAN_INTR_ERRB | CAN_INTR_ARBLOST | CAN_INTR_ERRP |
CAN_INTR_WAKEUP | CAN_INTR_OVF | CAN_INTR_ERRW))
hal_can_error_handle(phandle, int_status);
if (int_status & CAN_INTR_TX) {
phandle->status.sndpkgcnt++;
if (phandle->callback)
phandle->callback(phandle, (void *)CAN_EVENT_TX_DONE);
}
if ((int_status & CAN_INTR_RX) && !(int_status & CAN_INTR_OVF)) {
hal_can_rx_frame(phandle->can_base, &phandle->msg);
if (phandle->callback)
phandle->callback(phandle, (void *)CAN_EVENT_RX_IND);
}
writel(int_status, phandle->can_base + CAN_INTR_REG);
return IRQ_HANDLED;
}
aic_hal_can.c文件里,can中断函数中,是先看状态寄存器,一旦出现错误,就先去进行错误处理。
如果d133先上电,而总线上其它设备还没上电,则也会报can发送错误,这是可以理解的,can总线上没有其它can设备是发送不成功的。但其它can设备一上电,这个发送错误就会立刻消除了。
而接收错误这里,大部分情况下会一直错下去。
烧录镜像选择分区就可以了,rodata属于只读分区,如果是需要读写的文件,放在data分区就可以了
靠群里朋友的帮助解决了。
menuconfig里,file system image0,设置的fatfs文件系统,名字是rodata.fatfs,挂载到了/rodata分区。但还有个额外选项 FATFS enable write func in spinor 需要选中,fatfs文件系统才能可写。
----------------------------------------------------------
物理分区、文件系统分区,我还是有点晕乎。
partition_tab.h里应该定义的是物理分区吧,分成了4个部分。spl分区应该是存放boot程序。os分区应该是存放编译的可执行程序。另两个应该是存放资源文件。
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WORD, "spl",FAL_USING_NOR_FLASH_DEV_NAME, 0,262144,0}, \
{FAL_PART_MAGIC_WORD, "os",FAL_USING_NOR_FLASH_DEV_NAME, 262144,2097152,0}, \
{FAL_PART_MAGIC_WORD, "rodata",FAL_USING_NOR_FLASH_DEV_NAME, 2359296,6291456,0}, \
{FAL_PART_MAGIC_WORD, "data",FAL_USING_NOR_FLASH_DEV_NAME, 8650752,7340032,0}, \
}
#endif
board.c里是文件系统分区,其中有名为/data和/rodata的文件系统分区,/rodata分区挂载的是fatfs格式的blk_rodata类型的设备,/data分区挂载的是littlefs格式的data类型的设备。
这里最糊涂了,blk_rodata怎么来的?物理分区是如何挂载到/rodata的?
#ifdef RT_USING_DFS_ROMFS
#include "dfs_romfs.h"
static const struct romfs_dirent _mountpoint_root[] =
{
{ROMFS_DIRENT_DIR, "ram", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "data", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "rodata", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "udisk", RT_NULL, 0},
};
const struct romfs_dirent romfs_root =
{
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_mountpoint_root, ARRAY_SIZE(_mountpoint_root)
};
#endif
const struct dfs_mount_tbl mount_table[] = {
#ifdef RT_USING_DFS_ROMFS
{RT_NULL, "/", "rom", 0, &romfs_root, 0},
#endif
#ifdef LPKG_RAMDISK_TYPE_INITDATA
{"ramdisk0", "/ram", "elm", 0, 0, 0},
#endif
#if (defined(AIC_USING_FS_IMAGE_TYPE_FATFS_FOR_0) || defined(AIC_USING_FS_IMAGE_TYPE_FATFS_FOR_1))
{"blk_rodata", "/rodata", "elm", 0, 0, 0},
#endif
#ifdef LPKG_USING_LITTLEFS
{"data", "/data", "lfs", 0, 0, 0},
#endif
#ifdef LPKG_USING_DFS_UFFS
{"data", "/data", "uffs", 0, 0, 1},
#endif
#ifdef AIC_USING_SDMC1
{"sd0", "/sdcard", "elm", 0, 0, 0},
#endif
#if (defined(AIC_USING_USB0_HOST) || defined(AIC_USING_USB1_HOST))
{"udisk", "/udisk", "elm", 0, 0, 0xFF},
#endif
{0}
};
#endif
望清楚的朋友帮解惑。
比如有些图片,想传到板子上。不想把这些文件打包进烧录镜像里的话,能不能通过usb传到板子上?
使能了usb device,然后选了usb msc device,然后里面有个两个选项,ram template和storage template。
选了ram template后,win10上弹出个500k的盘符,提示要格式化,格式化后,做个修改,再重启,还提示要格式化...
选storage template模式,默认挂载路径是/sdcard,我没接sd接口,而且,想存到spi nor flash里。我看/rodata目录也是fat格式,就设置了这个目录,结果烧录后运行,提示:
[E/FAL] (blk_dev_write:106) This config only supports read!
请教,有什么办法,通过usb口,直接读写板子上spi nor flash的数据?
/* when define USE_DRAW_BUF, disp_drv.rotated can be
LV_DISP_ROT_90/LV_DISP_ROT_180/LV_DISP_ROT_270
*/
// disp_drv.rotated = LV_DISP_ROT_90;
留意注释,USE_DRAW_BUF也要使能
这个是lvgl软件旋转吧。
看 配置菜单里的 Graphics Support,应该是可以直接硬件支持旋转的吧,我想要的是这个效果。
默认的开机彩色方格,是没有使用lvgl的吧。
----------------------------------------
配置菜单里旋转180后,因为是花屏,盲点rtp校准,然后盲点屏幕上的按钮,发现调试串口发现这个警告出现了很多次。
[W] hal_ge_control()549 Invailid ioctl: 00004703
----------------------------------------
配置菜单里不旋转,lvgl里使能USR_DRAW_BUF, disp_drv.rotated = LV_DISP_ROT_180;确实能旋转了。
好奇这种旋转,有没有额外的性能开销?
但配置菜单里有这个旋转功能,还是想使用这个功能。
比如 netif_list 为空?甚至还没初始化,是个脏值。
不检查就直接访问么?
确实是这个问题,lvgl线程和lwip_test_example优先级相同,改成lwip线程优先级更高一点就没事了。
请教,netif_list没初始化时,lvgl线程调用netif_list->ip_addr为什么会卡死?因为该指针是个不正常的位置值,进行读取造成程序无法运行?
另,如何检查呢?不懂指针的检查方法?
-------------------------------
搜了下,说是c语言指针未初始化时为NULL,也就是0.
那么netif_list为0时,调用netif_list->ip_addr为什么程序会卡死?
-------------------------------
gpt回答的:
在C语言中,如果一个指针未初始化,那么访问该指针所指向的结构体变量会导致未定义的行为。这可能会导致程序崩溃、产生奇怪的结果,或者其他不可预测的行为。
未初始化的指针会包含一个未知的内存地址,当你尝试通过这个指针去访问结构体的成员时,实际上是在尝试读取一个未知内存地址的内容,这是非常危险的行为。这种行为可能导致程序崩溃,或者读取到不可预测的数据,因为该内存区域可能被其他数据所覆盖,或者根本不存在有效数据。
因此,在使用指针之前,一定要确保将其初始化为合适的值,比如将其设置为一个有效的内存地址,或者使用NULL来表示空指针。
目前用的1.0.4sdk,不旋转的话,lvgl, awtk都能运行,rtp也正常。开机默认有个彩色方格显示。
我想将屏幕旋转180,按d133-doc教程:
┌─────────────────────────────────────────────── Display Parameter ───────────────────────────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). Highlighted letters │
│ are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes features. Press <Esc><Esc> to exit, <?> │
│ for Help, </> for Search. Legend: [*] built-in [ ] excluded <M> module < > module capable │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ [*] Display Support │ │
│ │ [ ] Ai PQ Tool Support │ │
│ │ select Display interface (Display RGB interface) ---> │ │
│ │ RGB interface options ---> │ │
│ │ select framebuffer format (argb8888) ---> │ │
│ │ [*] Support double framebuffer │ │
│ │ [*] Display color block │ │
│ │ framebuffer rotation degree (180) ---> │ │
│ │ Display Panels ---> │ │
│ │ panel backlight control (gpio) ---> │ │
│ │ (PE.13) panel backlight enable pin │ │
│ │ [ ] panel backlight enable pin low active │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ <Select> < Exit > < Help > < Save > < Load > │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
结果,开机的彩色放个都编程灰色混乱的了。
想在屏幕上显示本机ip,查看ifconfig命令的实现,看到是读取了全局变量netif_list或netif_default。
于是在Lvgl界面初始化里加了个label,初始化值为netif_list->ip_addr,按钮回调函数里,也更新这个label值为netif_list->ip_addr.
结果下载后第一次运行,能正常显示本机地址。但是重启后,就进不到应用程序了,串口中断也卡住不更新了。
后来发现在设置lalbe值为netif_list->ip_addr之前,加个rt_thread_mdelay(),不管多小。界面就又正常了。
请教,这是为什么?
void test_ui_init()
{
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
lv_obj_set_pos(btn, 50, 50); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
lv_label_set_text(label, "get ip address"); /*Set the labels text*/
lv_obj_center(label);
rt_thread_mdelay(1);
labelIpaddr = lv_label_create(lv_scr_act());
lv_label_set_text_fmt(labelIpaddr, "local ip addr:0x%X", 0xaa55);
lv_label_set_text_fmt(labelIpaddr, "local ip addr: %s", ip4addr_ntoa(&netif_list->ip_addr));
lv_obj_set_pos(labelIpaddr, 200, 50);
lv_obj_set_size(labelIpaddr, 400, 50);
}
前面是dap的主控 后面是目标的主控 为了拖着烧录用的 好像是这样
我现在用的合宙的air32f103cbt6开发板,烧写的是air32f103xb_air32f103rb_if.hex。但是不光可以给ari32f103cb烧写程序,还可以给stm32f103cb, ve烧写程序,还可以给gd32f103cb, ve烧写程序。
-----------------------------
打开src/board目录下可以看到各对应的.c文件,比如stm32f072rb.c:
#include "target_family.h"
#include "target_board.h"
const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0720",
.family_id = kStub_HWReset_FamilyID,
.target_cfg = &target_device,
.board_vendor = "STMicroelectronics",
.board_name = "NUCLEO-F072RB",
};
stm32f103rb.c:
#include "target_family.h"
#include "target_board.h"
const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0001",
.family_id = kStub_HWReset_FamilyID,
.target_cfg = &target_device,
.board_vendor = "LuatOS",
.board_name = "Air32 MINI DAPLink",
};
感觉是这样的,这几个是给对应nucleo板上的stlink更新成dapllink用的。
各种nucleo板,虽然板载给用户使用的mcu有各种各样的,m3,m4,m0,l0,l4等,但上边都板载了个stm32f103cb作为stlink。
--------------------------------------
stm32f103xb_if这个工程,没有指定特定目标板,编译时报错,对比了下工程,没有包含类似stm32f103cb.c这样的目标板配置文件,算是少个参数。
MDK: CMSIS-DAP Cortex-M Target Driver Setup中的Download Function选中Erase Full Chip
试了下,不行。erase full chip可能不会擦除option bytes部分吧。
---------------------------------------------------------------------------
https://gitee.com/delbertz/openocd-toolbox
找到这么个工具,可惜不支持gd系列的。
d133,跑lvgl例程,硬件上是画了rgb888接口到lcd。然后sdk里菜单配置lcd也是rgb888, 顺序是bgr。
lvgl配置里,有个色深,只有16和32可选,我就选了32。
结果运行后,屏幕有些区域有些闪,字体看不到,或者放大发虚。
按群友配置,rgb565,色深16,就正常了。我又改成argb8888,色深32,也正常了。
rgb888的话,我的理解是正好通过24条信号线传到了屏里。那么argb8888呢?这是怎么传输的啊?lcd颜色信号线只有24条啊。
另,lcd配置里还有个data mirror选项,这个是干什么用的?
│ │ rgb mode (PRGB) ---> │ │
│ │ interface format (PRGB 24 BIT) ---> │ │
│ │ data order (BGR) ---> │ │
│ │ clock phase select (0 degree) ---> │ │
│ │ [ ] data mirror │ │
│ │
看test_rtp_draw程序,有两处xy交换,一处是校准是,画出十字光标后,获取测试点坐标,获取后,进行了次xy转换。
然后画线程序画线时,将获取的触控坐标进行xy转换,再瞄点。
按这个,在lvgl_rtp相关部分加入这两个xy交换,就可以了。
lv_tpc_rtp.c
if (data->x_coordinate > 0 || data->y_coordinate > 0) {
press_flag = 1;
rt_device_control(rtp_dev, RT_TOUCH_CTRL_SET_X_TO_Y, (void *)data);
lv_tpc_run.c
#ifdef AIC_USING_RTP
extern void lv_convert_adc_to_coord(struct rt_touch_data *data);
rt_device_control(dev, RT_TOUCH_CTRL_SET_X_TO_Y, (void *)(&(read_data[i])));
lv_convert_adc_to_coord(&read_data[i]);
#endif
请教,这里为什么要进行xy坐标交换?
Pre-Boot Program ... (24-03-28 14:17 853acea)
SPINOR
cs=0, phase=3
cs=1, phase=2
Psram_init done.
goto run SPL
tinySPL [Built on May 6 2024 15:16:22]
[W] usbh_get_connect_id()107 usb 0 port change wait failed.
[E] main()133 Not find udisk.
qspi0 freq (input): 99000000Hz
qspi0 freq ( bus ): 49500000Hz
qspi0 freq ( bus ): 99000000Hz
Selecting default config 'Luban-lite firmware'
spl read: 631304 byte, 13254 us -> 46514 KB/s
spl read: 235968 byte, 5011 us -> 45986 KB/s
spl read: 8924 byte, 494 us -> 17640 KB/s
169281 : Run APP
_ _ ___ ___ _ _
/ \ _ __| |_|_ _|_ __ / __| |__ (_)_ __
/ _ \ | '__| __|| || '_ \| | | '_ \| | '_ \
/ ___ \| | | |_ | || | | | |__| | | | | |_) |
/_/ \_\_| \__|___|_| |_|\___|_| |_|_| .__/
|_|
Welcome to ArtInChip Luban-Lite 1.0 [Built on May 10 2024 11:41:54]
qspi0 freq (input): 99000000Hz
qspi0 freq ( bus ): 49500000Hz
01-01 12:13:24 I/NO_TAG: Flash ID: 0xef4018
01-01 12:13:24 I/NO_TAG: Find a Winbond flash chip. Size is 16777216 bytes.
qspi0 freq (input): 99000000Hz
qspi0 freq ( bus ): 99000000Hz
01-01 12:13:24 I/NO_TAG: norflash0 flash device is initialize success.
01-01 12:13:24 I/NO_TAG: Probe SPI flash norflash0 by SPI device qspi01 success.
[I] aic_find_panel()62 find panel driver : panel-rgb
[I] aicfb_probe()950 fb0 allocated at 0x40045920
[I] hal_ge_init()342 cmd queue hal, cmdq buffer size = 2048
[I] hal_ge_init()400 dither line phys: 0x40334180
01-01 12:13:24 I/RTP: x_plate 235 y_plate 665
01-01 12:13:24 I/touch: rt_touch init success
01-01 12:13:24 I/RTP: ArtInChip RTP loaded
01-01 12:13:24 I/WDT: ArtInChip WDT loaded
Reboot action: Watchdog-Reset, reason: Command-Reboot
Startup time: 0.473 sec
info: cmd ring buf size:1920
info: cmd ring buf size:1920
[I] rtp_get_fb_info()97 Screen width: 800, height: 480
dlk /> 01-01 12:13:39 I/RTP: Unsupported cmd: 0x1501
01-01 12:13:39 I/RTP: Unsupported cmd: 0x150b
电阻屏触控不准。
不运行lvgl程序,运行test_rtp_draw校准,然后画线,看着还算跟手,没有啥偏移。
lvgl例程里,也有触控校准部分,运行lvgl后,先执行了校准,然后进lvgl界面,但是触控偏移很大。可以左右滑动、上下滑动总是失败。
看串口信息,有两个关于rtp的警告:
Unsupported cmd: 0x1501
Unsupported cmd: 0x150b
报错如下。
bsp\artinchip\hal\syscfg\hal_syscfg.c: In function 'syscfg_gmac_init':
bsp\artinchip\hal\syscfg\hal_syscfg.c:408:42: error: 'SYSCFG_GMAC_RXDLY_SEL_SHIFT' undeclared (first use in this function); did you mean 'SYSCFG_GMAC_TXDLY_SEL_SHIFT'?
408 | cfg |= (AIC_DEV_GMAC0_RXDELAY << SYSCFG_GMAC_RXDLY_SEL_SHIFT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| CC bsp\artinchip\sys\d13x\time.c
SYSCFG_GMAC_TXDLY_SEL_SHIFT
bsp\artinchip\hal\syscfg\hal_syscfg.c:408:42: note: each undeclared identifier is reported only once for each function it appears in
CC bsp\artinchip\sys\d13x\trap_c.c
scons: *** [output\d13x_cbs-nor_rt-thread_can2eth\bsp\artinchip\hal\syscfg\hal_syscfg.o] Error 1
scons: building terminated because of errors.
之前遇到过这个问题,忘了是怎么解决的了,好像是自己加了个这个定义。
今天更新到1.0.4后,再次编译,又遇到这个错误了。
请教,该如何解决?
Windows
请先安装 python(64 位系统要安装 64 位版本的 python),scons 和 Visual Studio C++(版本 >=2017)
如果没有安装 pywin32,请 pip 安装:
pip install pywin32
如果没有安装nodejs,请到 nodejs下载并安装。
编译运行 (在命令行模式下,进入 awtk 所在的目录,并运行下列命令):
scons
bin\demoui
---------------------------------
以上是readme里的,已安装了vsc++。
3rd\cjson\cJSON.c(40): fatal error C1083: 无法打开包括文件: “string.h”: No such file or directory
参考官方原理图画的板子,用的rtp,目前测量rtp四线,1-3间电阻值约为683欧,2-4间电阻约为210欧。宽边出线。
按如下设置。
┌──────────────────────────────────────────── RTP touch panel options ────────────────────────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). Highlighted letters │
│ are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes features. Press <Esc><Esc> to exit, <?> │
│ for Help, </> for Search. Legend: [*] built-in [ ] excluded <M> module < > module capable │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ [*] Using touch panel RTP │ │
│ │ (15) The sample period of RTP(in cycle mode) │ │
│ │ (3800) The pressure threshold of RTP │ │
│ │ (683) The x-plate value of RTP touchscreen │ │
│ │ (210) The Y-plate value of RTP touchscreen │ │
│ │ (0xffff) The press detect enable debounce │ │
│ │ (0x4f00004f) The precharge delay of RTP │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ <Select> < Exit > < Help > < Save > < Load > │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
按这个配置来,校准后,任意画线只能在屏幕对角线上出现点。
如果AIC_RTP_Y_PLATE值设为0的话,在屏幕画线的画,屏幕上的点就会很分散,类似满天星。
另,AIC_RTP_MAX_PRESSURE值该如何选取?
https://blog.csdn.net/awangdea99/article/details/107227193
服务端使用tcplistener接收连接请求。客户端使用tcpclient.connect主动连接。
在一对一的情况下(1个服务端只连接1个客户端时),服务端调用client.Close()主动关闭连接后,客户端接收函数(revString = br.ReadString();)立马报异常,因此可通过捕获此异常来进行重连操作。
但是,当一对多的情况下(1个服务端同时连接多个客户端),服务端对所有的client调用client.Close()主动关闭连接后,经常有少数(一般是一个)客户端无法捕获上面的异常,因此就无法通过捕获异常来重连。
为了解决上述问题,我试了网上很多方法,都不能解决此问题:
这是通病吗?
现在感觉是我对tcp的连接/断开理解不正确。
尝试只用一个板子当作tcp client连接pc的tcp server,建立tcp连接后,pc端断开tcp server或直接关掉tcp server软件,板子作为tcp client的send()函数,都能返回-1,这和预想的一样。试验了很多次,都是这个结果。
但是当用两个板子都作为tcp client去连接pc的tcp server时,断开tcp server,两个板子的send()函数,至少有一个能返回-1。有时候两个都返回-1,有时候一个返回-1,另一个仍然返回发送的数据长度。
感觉tcp server端,不能保证和所有的tcp client实现完整的断开操作。
那么,tcp client端,就适合用send()返回值来判断tcp的连接状态。
还有其他办法来判断tcp连接状态吗?tcp client这里,我需要判断tcp连接状态退出tcp while循环,进行下一次重连操作。
list_sem看到的信号量列表里,sem加数字的这4个信号量,应该都是lwip建立的。但是不知道对应的哪几个。
src/api/tcpip.c:485: err_t err = sys_sem_new(&call->sem, 0);
src/api/sockets.c:2026: if (sys_sem_new(&API_SELECT_CB_VAR_REF(select_cb).sem, 0) != ERR_OK) {
src/api/sockets.c:2371: if (sys_sem_new(&API_SELECT_CB_VAR_REF(select_cb).sem, 0) != ERR_OK) {
src/api/api_lib.c:1318: err = sys_sem_new(API_EXPR_REF(API_VAR_REF(msg).sem), 0);
src/api/api_msg.c:752: if (sys_sem_new(&conn->op_completed, 0) != ERR_OK) {
src/core/sys.c:139: err_t err = sys_sem_new(&delaysem, 0);
-------------------------------------
今天试验,发现断开tcp server后,板子继续tcp send()能返回发送数据长度时,不一定有信号量阻塞tcp线程。
/> list_sem
semaphore v suspend thread
---------------- --- --------------
sem126 000 1:lwip_test_exampl
sem53 000 0
sem6 000 0
sem3 000 0
can data sem 000 1:udp and tcp thre
rxSem 000 1:canRxThread
can0tl 001 0
shrx 000 0
sem0 000 1:ping_thread
qspi0_s 000 0
heap_cma 001 0
heap_sys 001 0
是这样持续了几分钟后,tcp线程才被一个信号量阻塞。
----------------------------------------------
这是sdk里网络驱动里,发送数据的底层函数:
static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
aicmac_netif_t *aic_netif = (aicmac_netif_t *)netif;
struct pbuf *q;
aicmac_dma_desc_t *pdesc;
int ret = ERR_OK;
#ifndef CONFIG_MAC_ZERO_COPY_TXBUF
u8 *buffer;
uint16_t framelength = 0;
uint32_t bufferoffset = 0;
uint32_t byteslefttocopy = 0;
uint32_t payloadoffset = 0;
#else
uint32_t p_cnt = 0;
uint32_t p_type = 0;
uint32_t empty_desc_cnt = 0;
uint32_t index;
uint32_t tmpreg = 0;
uint32_t i = 0;
#endif
pr_debug("%s\n", __func__);
if ((netif == NULL) || (p == NULL)){
pr_err("%s invalid parameter.\n", __func__);
return ERR_MEM;
}
aicos_mutex_take(eth_tx_mutex, AICOS_WAIT_FOREVER);
pdesc = dctl[aic_netif->port].tx_desc_p;
/* before read: invalid cache */
aicmac_dcache_invalid((uintptr_t)pdesc, sizeof(aicmac_dma_desc_t));
#ifndef CONFIG_MAC_ZERO_COPY_TXBUF
buffer = (u8 *)(unsigned long)(pdesc->buff1_addr);
bufferoffset = 0;
for (q = p; q != NULL; q = q->next) {
if ((pdesc->control & ETH_DMATxDesc_OWN) != (u32)RESET) {
pr_err("%s no enough desc for transmit.(len = %u)\n", __func__, q->len);
ret = ERR_MEM;
goto error;
}
/* Get bytes in current lwIP buffer */
byteslefttocopy = q->len;
payloadoffset = 0;
/* Check if the length of data to copy is bigger than Tx buffer size*/
while ((byteslefttocopy + bufferoffset) > ETH_TX_BUF_SIZE) {
/* Copy data to Tx buffer*/
memcpy((u8_t *)((u8_t *)buffer + bufferoffset),
(u8_t *)((u8_t *)q->payload + payloadoffset),
(ETH_TX_BUF_SIZE - bufferoffset));
/* after write: flush cache */
aicmac_dcache_clean((uintptr_t)((u8_t *)buffer + bufferoffset),
(ETH_TX_BUF_SIZE - bufferoffset));
/* Point to next descriptor */
pdesc = (aicmac_dma_desc_t *)(unsigned long)(pdesc->buff2_addr);
/* before read: invalid cache */
aicmac_dcache_invalid((uintptr_t)pdesc, sizeof(aicmac_dma_desc_t));
/* Check if the buffer is available */
if ((pdesc->control & ETH_DMATxDesc_OWN) != (u32)RESET) {
pr_err("%s no enough desc for transmit.(len = %u)\n", __func__, q->len);
ret = ERR_MEM;
goto error;
}
buffer = (u8 *)(unsigned long)(pdesc->buff1_addr);
byteslefttocopy = byteslefttocopy - (ETH_TX_BUF_SIZE - bufferoffset);
payloadoffset = payloadoffset + (ETH_TX_BUF_SIZE - bufferoffset);
framelength = framelength + (ETH_TX_BUF_SIZE - bufferoffset);
bufferoffset = 0;
}
/* Copy the remaining bytes */
memcpy((u8_t *)((u8_t *)buffer + bufferoffset),
(u8_t *)((u8_t *)q->payload + payloadoffset), byteslefttocopy);
/* after write: flush cache */
aicmac_dcache_clean((uintptr_t)((u8_t *)buffer + bufferoffset),
byteslefttocopy);
bufferoffset = bufferoffset + byteslefttocopy;
framelength = framelength + byteslefttocopy;
}
/* Prepare transmit descriptors to give to DMA*/
aicmac_submit_tx_frame(aic_netif->port, framelength);
#else
/* Count number of pbufs in a chain */
q = p;
while (q != NULL) {
if (q->len > ETH_DMATxDesc_TBS1){
pr_err("%s too large pbuf.(len = %d)\n", __func__, q->len);
ret = ERR_MEM;
goto error;
}
p_cnt++;
q = q->next;
}
/* Scan empty descriptor for DMA tx */
while (((pdesc->control & ETH_DMATxDesc_OWN) == (uint32_t)RESET) &&
(empty_desc_cnt < ETH_RXBUFNB)) {
empty_desc_cnt++;
if (empty_desc_cnt >= p_cnt)
break;
/* Point to next descriptor */
pdesc = (aicmac_dma_desc_t *)(unsigned long)(pdesc->buff2_addr);
if (pdesc == dctl[aic_netif->port].tx_desc_unconfirm_p){
pr_info("%s don't overwrite unconfirm area.\n", __func__);
break;
}
/* before read: invalid cache */
aicmac_dcache_invalid((uintptr_t)pdesc, sizeof(aicmac_dma_desc_t));
}
if (p_cnt > empty_desc_cnt){
pr_err("%s no enough desc for transmit pbuf.(pbuf_cnt = %d, empty_desc = %d)\n",
__func__, p_cnt, empty_desc_cnt);
ret = ERR_MEM;
goto error;
}
pbuf_ref(p);
q = p;
p_type = p->type_internal;
for(i=0; i<p_cnt; i++){
index = pdesc->reserved1;
if (index >= ETH_RXBUFNB){
pr_err("%s get dma desc index err.\n", __func__);
pbuf_free(p);
ret = ERR_MEM;
goto error;
}
if (i == (p_cnt-1)){
dctl[aic_netif->port].tx_buff[index] = p;
}else{
dctl[aic_netif->port].tx_buff[index] = NULL;
}
/* flush data cache */
if (p_type == PBUF_POOL){
aicmac_dcache_clean((uintptr_t)q->payload, q->len);
}else{
aicos_dcache_clean_range((unsigned long *)q->payload, q->len);
}
/* Set Buffer1 address pointer */
pdesc->buff1_addr =
(uint32_t)(unsigned long)(q->payload);
/* Set frame size */
pdesc->buff_size = (q->len & ETH_DMATxDesc_TBS1);
/* after write: flush cache */
aicmac_dcache_clean((uintptr_t)&pdesc->buff_size, 2*sizeof(uint32_t));
/*set LAST and FIRST segment */
tmpreg = ETH_DMATxDesc_TCH;
if (i == 0)
tmpreg |= ETH_DMATxDesc_FS;
if (i == (p_cnt-1))
tmpreg |= ETH_DMATxDesc_LS | ETH_DMATxDesc_IC;
/* TCP/IP Tx Checksum Insertion */
if (mac_config[aic_netif->port].coe_tx)
tmpreg |= ETH_DMATxDesc_CIC_TCPUDPICMP_Full;
/* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
tmpreg |= ETH_DMATxDesc_OWN;
pdesc->control = tmpreg;
/* after write: flush cache */
aicmac_dcache_clean((uintptr_t)&pdesc->control, sizeof(uint32_t));
/* Point to next descriptor */
pdesc = (aicmac_dma_desc_t *)(unsigned long)(pdesc->buff2_addr);
q = q->next;
}
dctl[aic_netif->port].tx_desc_p = pdesc;
/* Resume DMA transmission */
aicmac_resume_dma_tx(aic_netif->port);
#endif
error:
/* Give semaphore and exit */
aicos_mutex_give(eth_tx_mutex);
return ret;
}
看代码,用rtt+lwip,建了两个线程,eth_rx和eth_phy_poll。
大概是这样的:
eth_phy_poll线程,检查phy状态,连上或没连上。个人感觉这里指的不是socket连接状态,可能是网线是否连通。
eth_rx线程,等待网口中断发送来的信号,根据其值,判断是接收中断,还是发送完成中断。然后进行响应处理。
实在想不出,tcp socket的连接状态,由哪里判断的。
本来两个线程,can线程和tcp线程。有时候,会发现tcp线程不再打印信息,感觉像是阻塞了。
用list_sem看,多了个sem87这个信号量,阻塞了tcp线程。但我没建这个信号量啊。
semaphore v suspend thread
---------------- --- --------------
sem220 000 1:lwip_test_exampl
sem87 000 1:udp and tcp thre
sem6 000 0
sem3 000 0
can data sem 042 0
rxSem 000 1:canRxThread
can0tl 001 0
shrx 000 0
sem0 000 1:ping_thread
qspi0_s 000 0
heap_cma 001 0
heap_sys 001 0
--------------------------------
https://club.rt-thread.org/ask/question/822103778869d33f.html
在rtt论坛也搜到了类似问题,但没找到解决办法。
貌似就是lwip创建了个信号量,阻塞住了创建socket的这个线程。
Gentlepig 说:楼主电阻屏调通了吗?我校准后总是不符,手画了个圆,结果在屏上却是个斜线。
我的电阻触摸还没调好,就算校准了也是偏差很大。
大概直到电阻触控总是校准不好的原因了。
我基本上是参考官方开发板原理图画的,rtp和ctp用的是同样4根线,官方板把两个接口都保留了。注意,ctp这里其实是i2c信号线,原理图里有4个4.7K的上拉电阻。感觉rtp不需要上拉。
我将这4个上拉电阻去掉了,在屏幕上画图形,不再是缩小或变形的图形了,但是位移很大,应该需要重新校准。
但是我执行test_rtp_draw -c,出现校准光标后,按下屏幕却不再有任何反应,像是卡死了一样...
我看楼主板子上也有这4个上拉电阻,可以考虑去掉试试。
------------------------------------------
最终还是没校准成功,暂时放弃rtp校准。