页次: 1
@varzhou
这是设备树指定CS极性,并不会在SPI数据传输完后,拉到相反电平,试过不行,用的IMX8芯片
验证是可以的,但是在构造spi的xfer时候,需要设计.cs_change = 1,才能生效
if (xfer->cs_change) {
if (list_is_last(&xfer->transfer_list,
&msg->transfers)) {
keep_cs = true;
} else {
spi_set_cs(msg->spi, false);
udelay(10);
spi_set_cs(msg->spi, true);
}
}
看了论坛中大佬的说法,5.x内核是ok的,但是我加上之后一直提示cs被already use,所以仔细查看了内核,原来是reg属性搞的鬼
贴修改
硬件连接:
SPI--》PC0", "PC1", "PC3"
CS0 -->"PC2"
CS1 --> "PB4"
注意IO占用问题。
sun8i0v3s.dtsi中
spi0_pins: spi0-pins {
pins = "PC0", "PC1", "PC2","PC3";//CLK MOSI MISO CS WP
function = "spi0";
};
spi0: spi@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
clock-names = "ahb", "mod";
num-cs = <2>;
/* pinctrl-names = "default";*/
/* pinctrl-0 = <&spi0_pins spi0_pin_lcd>;*/
resets = <&ccu RST_BUS_SPI0>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
//以上基本无改动
&pio {
spi0_cs_pins: spi0_cs_pins {
pins = "PC2", "PB4";
function = "gpio_out";
};
};
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
cs-gpios = <&pio 2 2 GPIO_ACTIVE_HIGH>, <&pio 1 4 GPIO_ACTIVE_HIGH>;
flash: W25M02GV@0 {
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};
partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};
partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
st7789v: st7789v@1{
compatible = "sitronix,st7789v";
spi-max-frequency = <50000000>;
reg = <1>;
spi-cpol;
spi-cpha;
dc-gpios = <&pio 1 5 GPIO_ACTIVE_LOW>;
//backlight
rotate = <270>;
fps = <60>;
buswidth = <8>;
};
};
以上改动后,内核配置上ST7789V驱动即可ok
战术撤退
屏幕休眠了
echo 0 > /sys/class/graphics/fb0/blank 是禁止休眠
echo 1 > /sys/class/graphics/fb0/blank 是使能休眠如果想屏幕永不休眠,在UBOOT启动参数bootargs中增加 consoleblank=0
不是屏幕休眠问题:一直重复的输出panel信息
drm: x 0:239 y 0:271 w 240 h 272
drm: flip
drm: Find plane property: FB_ID
drm: Find plane property: FB_ID
drm: Find plane property: CRTC_ID
drm: Find plane property: CRTC_ID
drm: Find plane property: SRC_X
drm: Find plane property: SRC_X
drm: Find plane property: SRC_Y
drm: Find plane property: SRC_Y
drm: Find plane property: SRC_W
drm: Find plane property: SRC_W
drm: Find plane property: SRC_H
drm: Find plane property: SRC_H
drm: Find plane property: CRTC_X
drm: Find plane property: CRTC_X
drm: Find plane property: CRTC_Y
drm: Find plane property: CRTC_Y
drm: Find plane property: CRTC_W
drm: Find plane property: CRTC_W
drm: Find plane property: CRTC_H
drm: Find plane property: CRTC_H
drm: Flush done
就是没有显示
配置SPI NAND之后,可以生成分区,但是就是无法挂载,好奇挂
[ 1.085484] 4 fixed-partitions partitions found on MTD device spi0.0
[ 1.091965] Creating 4 MTD partitions on "spi0.0":
[ 1.096769] 0x000000000000-0x000000100000 : "u-boot"
[ 1.104414] 0x000000100000-0x000000110000 : "dtb"
[ 1.110344] 0x000000110000-0x000000510000 : "kernel"
//dev下面的文件节点也是/mtdxry这是啥,可读文件??
# mount -t vfat /dev/mtd
mtd0 mtd0ro mtd1 mtd1ro mtd2 mtd2ro mtd3 mtd3ro
# mount -t vfat /dev/mtd
mtd0 mtd0ro mtd1 mtd1ro mtd2 mtd2ro mtd3 mtd3ro
# mount -t vfat /dev/mtd1 /mnt
mount: mounting /dev/mtd1 on /mnt failed: Block device required
@varzhou
抱歉我现在也没有那个配置,你发一下日志信息,看看是什么错误呢。
晕哥:
就是Run_V3s_LicheePi0.bat 这个脚本执行到文件系统下载窗口就自动推出了,但是使用你的那个文件系统又是正常的。
V3s/S3/f1c100s通过USB启动Linux,并把SD NAND/TF卡挂载为U盘, 可以dd或Win32DiskImager任烧写
https://whycan.com/t_2449.html是这个吗?
看过这个帖子的,里面没有Buildroot的配置喽,我也使用里面的文件是正常的,但是我自己配置出来的文件系统下载到文件系统时候就会被自动断开,无法下载
@varzhou
附上buildroot配置
BR2_arm=y
BR2_cortex_a7=y
BR2_ARM_FPU_VFPV4=y
BR2_CCACHE=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD="123456"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_KMOD=y
BR2_PACKAGE_UTIL_LINUX=y
BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_TAR_GZIP=y
平台V3S
自己配置了一个可以生成cpio.gz的buildroot文件系统。
但是,但是
使用xfel下载到文件系统这里就自动断开了,使用晕哥提供的文件系统来配合我的内核启动又是🆗的
########################################################
生成cpio.gz后,使用
sudo mkimage -A arm -T ramdisk -C none -n uInitrd -d rootfs.cpio.gz ../../rootfs.cpio.gz.uImage
来生成可从ram中启动的文件系统,问题是:下载中途断开了。
侃价460,爽快400
清单:野火STM32F429 V1核心板一块
野火5寸10点触摸MCU电容屏一块
野火OV2640摄像头一块
STLINK v2一个爽快有爽快玩法,侃价有侃价玩法。
buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 * 已支持DVP摄像头 *
https://whycan.com/t_5221.html(V3s/V3x/S3/S3L/R11通吃)小智V3x开发板smallwitpi lite u-boot/linux/buildroot测试
https://whycan.com/t_7248.html#p69178谁用谁知道。
晕哥有搞过制作一键刷机包吗?
0003-mtd-spi-nand-add-SPI-NAND-framework_20211130-1412.7z
我的也是和楼主一样的问题, winbond / gd /mx 的spi nand flash都测试过。
实际rainbow的sdk并不支持spi nand,仅支持spi nor,可以下面这个patch打上去试试
mianhua 说:请问显示的时候是不是已经用了DMA?
void fb_present(struct framebuffer_t * fb, struct render_t * render)
{
struct fb_f1c100s_pdata_t * pdat = (struct fb_f1c100s_pdata_t *)fb->priv;if(render && render->pixels)
{
pdat->index = (pdat->index + 1) & 0x1;
memcpy(pdat->vram[pdat->index], render->pixels, render->pixlen);
dma_cache_sync(pdat->vram[pdat->index], render->pixlen, DMA_TO_DEVICE);
f1c100s_debe_set_address(pdat, pdat->vram[pdat->index]);
}
}这里dma_cache_sync我没有看到dma具体实现,感觉还是靠memcpy软拷贝的
dma_cache_sync这个函数只是简单的同步一下cache,保证数据的一致性而已
varzhou 说:varzhou 说:可以吧uboot和kernel以及文件系统的配置一起github吗? 你共享那些有些不清晰哈
uboot和kernel直接上源码吧,不大,buildroot就上配置就好了,哈哈哈,白嫖党
辣个不是有了么:
br2配置文件: https://github.com/Kevincoooool/KS_V3S/blob/main/Buildroot/ksdiy.config
linux zImage & 设备树: https://github.com/Kevincoooool/KS_V3S/tree/main/Kernel
u-boot bin: https://github.com/Kevincoooool/KS_V3S/tree/main/Uboot
NES模拟器与游戏文件: https://github.com/Kevincoooool/KS_V3S/tree/main/Nes
硬件: https://github.com/Kevincoooool/KS_V3S/tree/main/Hardware
楼主上的这是只是DTS和buildroot的配置,有些还是不太清晰的。
所以我才建议上uboot和kernel的源码,以及buildroot的版本,qt版本等描述:cool
NB1 : enter phy init
NandHwInit: Start Nand Hardware initializing .....
uboot:nand version: 2 25 20150917 1145
Reg 0x01c20848: 0x3333
Reg 0x01c2085c: 0x55
Reg 0x01c20864: 0x10
uboot nand_request_tx_dma: reqest genernal dma for nand success, 0x43a31ab0
request general tx dma channel ok!
uboot nand_request_tx_dma: reqest genernal dma for nand success, 0x43a31acc
request general rx dma channel ok!
SPI nand ID: 21aaef 0
_SearchNandArchi fail[ERR]NandHwInit: SCN_AnalyzeNandSystem() failed!
NandHwInit: End Nand Hardware initializing ..... FAIL!
NB1 : nand phy init fail
NB1 : enter phy Exit
这里调用了一个spi nand库,难道这个库只能使用指定的spi nand芯片吗??
仔细研究了一下,上层配置的分区参数从log来看是ok的。
-total partitions:9-
-name- -start- -size-
bootlogo : 200000 1a0000
boot-res : 3a0000 40000
env : 3e0000 40000
boot : 420000 400000
rootfs : 820000 c800000
rootfs_data : d020000 c800000
misc : 19820000 10000
private : 19830000 40000
UDISK : 19870000 0
-----------------------------------
set root to /dev/nande
[NE]parameter error 606976,4 !
disable nand error: FDT_ERR_BADPATH
disable nand error: FDT_ERR_BADPATH
## error: update_fdt_dram_para : FDT_ERR_NOTFOUND
PowerBus = 2( 2:vBus 3:acBus other: not exist)
从这里来看,是uboot没有识别到nand。但是kernel是识别到了nand的各项参数。
===========================我是分界线==================================
总结:有点晕,kernel中以及识别成功了nand的各项参数,并且mbr也ok了。这里用的是tina的全志的nand静态库,很多东西都看不到,有没有可以移植到bsp的spinand可以替代???
[ 2.453877] [NAND]nand probe
[ 2.457131] kernel:nand version: 2 8 20190408 1958
[ 2.466256] NAND_ReadPhyArch: get old physic arch ok, use old cfg, now:0x2 0x6d - old:0x2 0x6d!
[ 2.506207] [NAND]nand0_cache_level is no used
[ 2.511608] [NAND]nand_capacity_level is no used
[ 2.520351] [NE]mbr read 12
[ 2.524225] [NE]mbr read ok!
[ 2.527441] [NE]mbr read end!
[ 2.530850] [NE]mbr partition start!
[ 2.535887] [NE]mbr partition ok!
[ 2.539617] [NE]mbr partition end!
[ 2.543395] [NE]new nand info init!!
[ 2.547639] [NE]mbr read 12
[ 2.551542] [NE]mbr read ok!
[ 2.554755] [NE]mbr read end!
[ 2.558048] [NE]get mbr_data table
[ 2.562983] [ND]ok get factory_bad_block table!
[ 2.569284] [NE]new_bad_block table new format!
[ 2.575129] [ND]ok get a new bad table!
[ 2.580580] [ND]build all_phy partition start!
[ 2.585528] [NE]mbr partition start!
[ 2.590278] [NE]mbr partition ok!
[ 2.593972] [NE]mbr partition end!
平台:V3S + tina
修改sys_partition.fex文件后,系统启动后查看df和实际的配置不一致
###################我是分界线#############################
[partition_start]
[partition]
name = bootlogo
size = 3328
downloadfile = "bootlogo.fex"
user_type = 0x8000
[partition]
name = boot-res
size = 512
downloadfile = "boot-resource.fex"
user_type = 0x8000
[partition]
name = env
size = 512
downloadfile = "env.fex"
user_type = 0x8000
[partition]
name = boot
size = 8192
downloadfile = "boot.fex"
user_type = 0x8000
[partition]
name = rootfs
size = 81920
downloadfile = "rootfs.fex"
user_type = 0x8000
[partition]
name = rootfs_data
size = 81920
user_type = 0x8000
[partition]
name = misc
size = 128
user_type = 0x8000
[partition]
name = private
size = 512
user_type = 0x8000
###################我是分界线#############################
root@None:/# cat /proc/partitions
major minor #blocks name
93 0 256 nanda
93 8 256 nandb
93 16 4096 nandc
93 24 40960 nandd
93 32 40960 nande
93 40 64 nandf
93 48 256 nandg
93 56 25536 nandh
179 0 15558144 mmcblk0
179 1 15554048 mmcblk0p1
###################我是分界线#############################
root@None:/# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 2048 2048 0 100% /
devtmpfs 11040 0 11040 0% /dev
tmpfs 27936 20 27916 0% /tmp
页次: 1