页次: 1
https://whycan.cn/files/members/2596/2433a8f8c825c24769c0ceec075b30b.jpg我的触摸基本也OK了(他这个I2C跑100~200 k才可以),cache的话试着把FB的内存分配到写穿区域
请教下,这个I2C频率哪个文件可以改?sys_config.fex没看到改的地方,是要到源码去改吗?
先确认命令行qmake &make工作是否正常?
也是一样的错误
make: c:命令未找到
Makefile:617: recipe for target 'moc_mainwindow.o' failed
make: [moc_mainwindow.o] Error 127 (ignored)
Wl,-rpath,/usr/lib -o test2 main.o mainwindow.o moc_mainwindow.o -L/home/cos/x3/x3_sdk/out/astar-parrot/compile_dir/target/qt-everywhere-opensource-src-5.10.1/ipkg-install/usr/lib -lQt5Widgets -L/home/cos/x3/x3_sdk/out/astar-parrot/staging_dir/target/lib\\ -L/home/cos/x3/x3_sdk/out/astar-parrot/staging_dir/target/usr/lib -lQt5Gui -lQt5Core -L/home/cos/x3/x3_sdk/out/astar-parrot/staging_dir/target/home/cos/x3/x3_sdk/out/astar-parrot/staging_dir/target/usr/lib -lGLESv2 -lUMP -lpthread
make: Wl,-rpath,/usr/lib:命令未找到
Makefile:223: recipe for target 'test2' failed
make: [test2] Error 127 (ignored)
请教各位大神,qtcreator编译出现这个问题
Makefile:584: recipe for target 'moc_predefs.h' failed
make: c:命令未找到
make: [main.o] Error 127 (ignored)
make: c:命令未找到
make: [mainwindow.o] Error 127 (ignored)
/bin/sh: 1: -dM: not found
make: [moc_predefs.h] Error 127 (ignored)
提示找不到C命令;已经正确配置了交叉编译链;桌面版的可以编译运行
应用获取摄像头数据参考文件如下, 下载之后另存为.c就行了(因为不支持上传后缀.c的文件所以重命名了而已)。
testApp.gz
可以获取jpg图片了,谢谢楼主!
应用获取摄像头数据参考文件如下, 下载之后另存为.c就行了(因为不支持上传后缀.c的文件所以重命名了而已)。
testApp.gz
谢谢楼主,我自己参考网上写的获取不到数据,不知道是程序有问题还是驱动初始化没改好,等下用你这个程序测试下
tianjjff 说:vip888888 说:板子就买的这个了。
工程用的大佬的这个,已经支持了ov2640 https://whycan.com/t_5221.html。
https://whycan.com/files/members/4813/TINY200.jpg请教下在linux中直接获取jpeg的方法,底层的话可以直接改驱动输出jpeg。这个底层输出jpeg我大概改的有点点输出,图片看起来有点错位。
https://whycan.com/files/members/4813/camera.jpg
我应用上还是按照YUYV的方式初始化摄像头的。以此来获取一帧数据。但是好像不是很好使。
https://whycan.com/files/members/4813/camera1.png
https://whycan.com/files/members/4813/camera2.png请问楼主,改输出jpeg是怎么改的?改初始化寄存器吗?可否参考下
网上一搜就有了,2640手册没有关于jpeg方面的说明,我也就网上搜的然后加到初始化就行了。
谢谢楼主,网上搜到了寄存器代码,已经改了初始化;测试应用能发下参考下吗?还不会v4l2编程
板子就买的这个了。
工程用的大佬的这个,已经支持了ov2640 https://whycan.com/t_5221.html。
https://whycan.com/files/members/4813/TINY200.jpg请教下在linux中直接获取jpeg的方法,底层的话可以直接改驱动输出jpeg。这个底层输出jpeg我大概改的有点点输出,图片看起来有点错位。
https://whycan.com/files/members/4813/camera.jpg
我应用上还是按照YUYV的方式初始化摄像头的。以此来获取一帧数据。但是好像不是很好使。
https://whycan.com/files/members/4813/camera1.png
https://whycan.com/files/members/4813/camera2.png
请问楼主,改输出jpeg是怎么改的?改初始化寄存器吗?可否参考下
请教下aodzip大佬,你的ov2640怎么测试的,我这边接上ov2640,出现/dev/video0,使用命令如下抓不到图片
# fswebcam -S 5 -d /dev/video0 -p UYVY -r 800x600 test.jpg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Unable to find a compatible palette format.
查看csi中断次数,显示也为0
28: 0 sun4i_irq 32 Edge 1cb0000.csi
好像并没有触发csi中断
修改 drivers/mtd/spi-nor/spi-nor.c:
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { "mx25l51235f", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) },
启动log, 64M spi flash OK:
[ 0.935189] 6 cmdlinepart partitions found on MTD device spi32766.0 [ 0.941502] Creating 6 MTD partitions on "spi32766.0": [ 0.946657] 0x000000000000-0x000000050000 : "uboot" [ 0.953878] 0x000000050000-0x0000000a0000 : "logob" [ 0.960793] 0x0000000a0000-0x0000000f0000 : "logoa" [ 0.967459] 0x0000000f0000-0x000000100000 : "dtb" [ 0.974305] 0x000000100000-0x000000600000 : "kernel" [ 0.981114] 0x000000600000-0x000004000000 : "rootfs"
生成多个随机数bin文件:
cd /opt dd if=/dev/urandom of=*.bin bs=1M count=8
# md5sum * f7a1c8476056e68c4da1196b334e14e9 1.bin fec2bb418ebbe9eac54e9f20d1990c5e 2.bin 58ded8e3dc0a3b6ddcfa0a09b7c9d900 3.bin ff0080fa3cd0d1134c3e78a6b9f41bdb 4.bin d4061aa0567478cae0b19fe2a8953f07 5.bin
多次启动后文件大小和校验和均正常.
请教个问题,比如用32Mnor,固件只有16M大小,打包成16M固件(主要提升烧写速度,uboot识别flash为32M了),剩下的16M空间如何操作才能使用?
方便传一下你的设备树吗
我的设备树关于串口的就这里,也没啥
dtsi文件
pio: pinctrl@1c20800 {
compatible = "allwinner,suniv-f1c100s-pinctrl";
reg = <0x01c20800 0x400>;
interrupts = <38>, <39>, <40>;
clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
clock-names = "apb", "hosc", "losc";
gpio-controller;
interrupt-controller;
#interrupt-cells = <3>;
#gpio-cells = <3>;
spi0_pins_a: spi0-pins-pc {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
/*
uart0_pe_pins: uart0-pe-pins {
pins = "PE0", "PE1";
function = "uart0";
};
*/
uart0_pins_a: uart0@0 {
pins = "PE0", "PE1";
function = "uart0";
};
uart1_pins_a: uart1@0 {
pins = "PA2", "PA3";
function = "uart1";
//bias-pull-up;
};
uart2_pins_a: uart2@0 {
pins = "PE7", "PE8";
function = "uart2";
//bias-pull-up;
};
};
uart0: serial@1c25000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25000 0x400>;
interrupts = <1>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART0>;
resets = <&ccu RST_BUS_UART0>;
status = "disabled";
};
uart1: serial@1c25400 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25400 0x400>;
interrupts = <2>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART1>;
resets = <&ccu RST_BUS_UART1>;
status = "disabled";
};
uart2: serial@1c25800 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25800 0x400>;
interrupts = <3>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART2>;
resets = <&ccu RST_BUS_UART2>;
status = "disabled";
};
dts文件
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins_a>;
status = "okay";
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins_a>;
status = "okay";
};
&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins_a>;
status = "okay";
};
sunxi-fel启动u-boot, 用fatls 显示 TF 卡文件正常:
=> fatls mmc 0:1 lost.dir/ android/ 555152547 6a.mp4 205590075 ardurino.mp4
但是把这个 u-boot 烧录到 TF卡, 启动不正常:
U-Boot SPL 2019.01-rc3-g829407b58f-dirty (Feb 02 2020 - 21:32:54 +0800) DRAM: 256 MiB Trying to boot from MMC1 MMC: no card present spl: mmc init failed with error: -123 SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
看起来这个u-boot默认去找 emmc(MMC1), 而不是 TF卡(MMC0) ?
请问楼主这个怎么解决的,我的uboot一上电也是打印这个错误
基于Buildroot 2020.02,可以一键编译UBoot、Linux和Rootfs并生成Flash镜像。
地址: https://github.com/jiangming1399/buildroot_configs
用法:在Buildroot目录下执行
make BR2_EXTERNAL=$PATH_TO_CONFIGS menuconfig #将 $PATH_TO_CONFIGS 替换为实际的配置目录 make lotlab_fam_zkswe_defconfig # 载入某个指定硬件的defconfig make -j
基本上都是最简的配置,没有添加什么额外的东西。主要特点有:
- 4.5s开机
- 支持OverlayFS
- 支持开机Logodefconfig主要有这些区别:
- lotlab_fam_zkswe_defconfig :适用于ZKSWE串口屏的配置,8MFlash,480*272
- jxhmi_5_inch_defconfig:适用于本论坛开源串口屏的配置,16M Flash,800*480,交换红蓝
- jxhmi_4_3_inch_defconfig:适用于本论坛开源串口屏的配置,16M Flash,480*272,交换红蓝要改可以自己改,至于怎么做这个我之后有空的话可能会开个贴子,或者直接查阅Buildroot的手册就行
以下由 @哇酷小二 2020-04-30 更新:
---------------------------------------------不方便用git的朋友请此处下载: jiangming1399_buildroot_configs.tgz
请教下楼主,编译后出现这个错误怎么解决?
>>> Executing post-image script support/scripts/genimage.sh
support/scripts/genimage.sh: 行 44: genimage: 未找到命令
Makefile:823: recipe for target 'target-post-image' failed
https://github.com/staunchheart/LVGLBuilder
这个设计器可以用QT编译。
新建项目时可以设置屏的大小,实际上没有用,
真正修正改大小在main.cpp中,将lvgl.init(xxx,xxx);
遇到的坑,,用VC2015 QT5.10 没有编译过去,然后我改用Mingw+QT5.10
报错的地方是'assert' was not declared in this scope assert
在报错的代码加上#include <cassert>
编译就可以使用了。贴两张图
请问下app_create函数怎么生成的,我这边qt编译启动后设计界面没找到怎么生成C文件
我好像也是这个
楼主,我按照这个克隆uboot “git clone https://github.com/linux-sunxi/u-boot-sunxi u-boot-sunxi” 编译后可以用sunxi-fel启动正常了
主线uboot,我是直接ftp://ftp.denx.de/pub/u-boot/ 这个网站下面下载 u-boot-2020.04-rc3.tar.bz2,然后步骤是
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make Sinlinx_SinA33_defconfig
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make
不知道这样编译是不是有问题,还是编译前还需要做什么?
楼上可能需要换个sunxifei的版本,你是不是用的f1c100的
请教下怎么sunxi-fel看版本啊?我直接就是git clone https://github.com/linux-sunxi/sunxi-tools 然后make的
楼主你好,我买的根你一样的A33的板子,可是执行ums 2 mmc 1 的时候,出现
g_dnl_register: failed!, error: -6
g_dnl_register:failed的错误,pc上也没有出现U盘符,我用的u-boot版本是2020.04, DTS 用的是Sinlunx_A33_defconfig,
是不是那里还需要特别设定一下,我插入的是板子上的otg USB插口
你好,请教下,我也是一样的板子,最u-boot-2020.04-rc3,dts也是Sinlunx_A33_defconfig,uboot编译完显示
===================== WARNING ======================
This board does not use CONFIG_DM_VIDEO Please update
the board to use CONFIG_DM_VIDEO before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================
用sunxi-fel加载uboot无法成功,显示:
~/A33/u-boot-2020.04-rc3$ sudo sunxi-fel uboot u-boot-sunxi-with-spl.bin
usb_bulk_send() ERROR -7: Operation timed out
串口输出下面两行就没了
U-Boot SPL 2020.04-rc3-00140-g50be9f0 (Mar 15 2020 - 16:15:26 +0800)
DRAM: 512 MiB
不知道是哪里的问题
参考这个帖子: https://whycan.cn/t_2039.html
我在荔枝派zero跑是ok的,直接用V3s输出的时钟。
以下 2019-03-26 更新:
----------------------------------
驱动代码:
https://github.com/torvalds/linux/tree/master/drivers/media/platform/sunxi/sun6i-csi
https://github.com/torvalds/linux/blob/master/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
https://github.com/torvalds/linux/blob/master/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c设备树配置方法:
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/media/sun6i-csi.txt
谢谢晕哥!!!
引脚复用应该也设置了吧,最好贴一下代码分析
首先设置IO为CSI,然后配置上拉,打开CSI时钟,复位CSI,使能CSI_EN
//-----SET CSI IO ----------------------
PE_CFG0 &= 0X00000000;
PE_CFG0 |= 0X22222222;
PE_CFG1 &= 0XFFFF0000;
PE_CFG1 |= 0X00002222;
PE_PULL0 &= 0XFF000000;
PE_PULL0 |= 0X00555555;
DRAM_GATING_REG |= 0x02;
delay_ms(1);
//---open csi clk-------
BUS_CLK_GATING_REG1 |= (1 << 8);
//---CSI-CLK EN --------------
CSI_CLK_REG &= ~((1 << 15) | (7 << 8) | (0X0F << 1));
CSI_CLK_REG |= ((1 << 15) | (5 << 8) | (1 << 1));
//--csi reset--------------
BUS_SOFT_RST_REG1 |= (1 << 8);
//---CSI_EN----------
CSI_EN_REG |= 0x01;
tianjjff 说:DVP驱动可否参考一下,正在驱动摄像头
CSI部分驱动如下。没有考虑什么通用性,只是针对我需要的数据格式。(UYVY -> YUV422)
只有捕捉单张图像,没有视频。/* * driver/csi-f1c100s.c */ #include <xboot.h> #include <clk/clk.h> #include <reset/reset.h> #include <gpio/gpio.h> #include <csi/csi.h> enum { CSI_EN = 0x000, CSI_CFG = 0x004, CSI_CAP = 0x008, CSI_SCALE = 0x00c, CSI_FIFO0_BUFA = 0x010, CSI_FIFO0_BUFB = 0x014, CSI_FIFO1_BUFA = 0x018, CSI_FIFO1_BUFB = 0x01c, CSI_FIFO2_BUFA = 0x020, CSI_FIFO2_BUFB = 0x024, CSI_BUF_CTL = 0x028, CSI_BUF_STA = 0x02c, CSI_INT_EN = 0x030, CSI_INT_STA = 0x034, CSI_HSIZE = 0x040, CSI_VSIZE = 0x044, CSI_BUF_LEN = 0x048, }; enum { CSI_SIZE_MASK = 0x1fff, // 13 bits }; struct csi_f1c100s_pdata_t { virtual_addr_t virt; char * clk; char * dramclk; int reset; int hsync; int hsynccfg; int vsync; int vsynccfg; int pclk; int pclkcfg; int database; int datacfg; int databits; }; static void csi_f1c100s_get_size(struct csi_t * csi, int* width, int* height) { struct csi_f1c100s_pdata_t * pdat = (struct csi_f1c100s_pdata_t *)csi->priv; if (width) { *width = (read32(pdat->virt + CSI_HSIZE) >> 16) & CSI_SIZE_MASK; } if (height) { *height = (read32(pdat->virt + CSI_VSIZE) >> 16) & CSI_SIZE_MASK; } } static void csi_f1c100s_set_size(struct csi_t * csi, int width, int height) { struct csi_f1c100s_pdata_t * pdat = (struct csi_f1c100s_pdata_t *)csi->priv; uint32_t hsize = read32(pdat->virt + CSI_HSIZE); hsize &= ~(CSI_SIZE_MASK << 16) & ~(CSI_SIZE_MASK << 0); hsize |= ((width * 2) & CSI_SIZE_MASK) << 16; // YUV每像素2字节 write32(pdat->virt + CSI_HSIZE, hsize); uint32_t vsize = read32(pdat->virt + CSI_VSIZE); vsize &= ~(CSI_SIZE_MASK << 16) & ~(CSI_SIZE_MASK << 0); vsize |= (height & CSI_SIZE_MASK) << 16; write32(pdat->virt + CSI_VSIZE, vsize); // buffer len uint32_t buflen = read32(pdat->virt + CSI_BUF_LEN); buflen &= ~(CSI_SIZE_MASK << 0); buflen |= (width & CSI_SIZE_MASK); // Y最长,每像素1字节 write32(pdat->virt + CSI_BUF_LEN, buflen); } static void csi_f1c100s_set_buffer(struct csi_t * csi, void* buffer, int len) { struct csi_f1c100s_pdata_t * pdat = (struct csi_f1c100s_pdata_t *)csi->priv; // 只用BUFA,3个FIFO必须都设置上 write32(pdat->virt + CSI_FIFO0_BUFA, (uint32_t)buffer); write32(pdat->virt + CSI_FIFO1_BUFA, (uint32_t)buffer + len * 2 / 4); write32(pdat->virt + CSI_FIFO2_BUFA, (uint32_t)buffer + len * 3 / 4); write32(pdat->virt + CSI_BUF_CTL, read32(pdat->virt + CSI_BUF_CTL) & ~(1 << 0)); } static int csi_f1c100s_capture_still(struct csi_t * csi) { struct csi_f1c100s_pdata_t * pdat = (struct csi_f1c100s_pdata_t *)csi->priv; // begin capture write32(pdat->virt + CSI_CAP, read32(pdat->virt + CSI_CAP) | (1 << 0)); // clear int status write32(pdat->virt + CSI_INT_STA, read32(pdat->virt + CSI_INT_STA)); // wait for capture start then stop ktime_t timeout = ktime_add_ms(ktime_get(), 2000); int captured = 0; do { if(read32(pdat->virt + CSI_INT_STA) & (1 << 0)) { captured = 1; break; } } while(ktime_before(ktime_get(), timeout)); return captured; } static struct device_t * csi_f1c100s_probe(struct driver_t * drv, struct dtnode_t * n) { struct csi_f1c100s_pdata_t * pdat; struct csi_t * csi; struct device_t * dev; virtual_addr_t virt = phys_to_virt(dt_read_address(n)); char * clk = dt_read_string(n, "clock-name", NULL); char * dramclk = dt_read_string(n, "dram-clock-name", NULL); pdat = malloc(sizeof(struct csi_f1c100s_pdata_t)); if(!pdat) return FALSE; csi = malloc(sizeof(struct csi_t)); if(!csi) { free(pdat); return FALSE; } pdat->virt = virt; pdat->clk = strdup(clk); pdat->dramclk = strdup(dramclk); pdat->reset = dt_read_int(n, "reset", -1); pdat->hsync = dt_read_int(n, "hsync-gpio", -1); pdat->hsynccfg = dt_read_int(n, "hsync-gpio-config", -1); pdat->vsync = dt_read_int(n, "vsync-gpio", -1); pdat->vsynccfg = dt_read_int(n, "vsync-gpio-config", -1); pdat->pclk = dt_read_int(n, "pclk-gpio", -1); pdat->pclkcfg = dt_read_int(n, "pclk-gpio-config", -1); pdat->database = dt_read_int(n, "data-gpio-base", -1); pdat->datacfg = dt_read_int(n, "data-gpio-config", -1); pdat->databits = dt_read_int(n, "data-bits", -1); csi->name = alloc_device_name(dt_read_name(n), -1); csi->get_size = csi_f1c100s_get_size; csi->set_size = csi_f1c100s_set_size; csi->set_buffer = csi_f1c100s_set_buffer; csi->capture_still = csi_f1c100s_capture_still; csi->priv = pdat; clk_enable(pdat->clk); clk_enable(pdat->dramclk); if(pdat->reset >= 0) { reset_deassert(pdat->reset); } if(pdat->hsync >= 0) { if(pdat->hsynccfg >= 0) { gpio_set_cfg(pdat->hsync, pdat->hsynccfg); } gpio_set_pull(pdat->hsync, GPIO_PULL_UP); } if(pdat->vsync >= 0) { if(pdat->vsynccfg >= 0) { gpio_set_cfg(pdat->vsync, pdat->vsynccfg); } gpio_set_pull(pdat->vsync, GPIO_PULL_UP); } if(pdat->pclk >= 0) { if(pdat->pclkcfg >= 0) { gpio_set_cfg(pdat->pclk, pdat->pclkcfg); } gpio_set_pull(pdat->pclk, GPIO_PULL_UP); } if (pdat->database) { for (int i = 0; i < pdat->databits; i++) { if(pdat->datacfg >= 0) { gpio_set_cfg(pdat->database + i, pdat->datacfg); } gpio_set_pull(pdat->database + i, GPIO_PULL_UP); } } // input format: YUV422 // input sequence: UYVY // output format: planar YUV 422 // vref polarity: high // href polarity: low // pclk polarity: high write32(pdat->virt + CSI_CFG, (3 << 20) | (0 << 16) | (2 << 8) // YUV | (1 << 2) | (1 << 1) | (0 << 0)); write32(pdat->virt + CSI_EN, read32(pdat->virt + CSI_EN) | (1 << 0)); if(!register_csi(&dev, csi)) { clk_disable(pdat->clk); free(pdat->clk); clk_disable(pdat->dramclk); free(pdat->dramclk); free_device_name(csi->name); free(csi->priv); free(csi); return NULL; } dev->driver = drv; return dev; } static void csi_f1c100s_remove(struct device_t * dev) { struct csi_t * csi = (struct csi_t *)dev->priv; struct csi_f1c100s_pdata_t * pdat = (struct csi_f1c100s_pdata_t *)csi->priv; if(csi && unregister_csi(csi)) { clk_disable(pdat->clk); free(pdat->clk); clk_disable(pdat->dramclk); free(pdat->dramclk); free_device_name(csi->name); free(csi->priv); free(csi); } } static void csi_f1c100s_suspend(struct device_t * dev) { } static void csi_f1c100s_resume(struct device_t * dev) { } static struct driver_t csi_f1c100s = { .name = "csi-f1c100s", .probe = csi_f1c100s_probe, .remove = csi_f1c100s_remove, .suspend = csi_f1c100s_suspend, .resume = csi_f1c100s_resume, }; static __init void csi_f1c100s_driver_init(void) { register_driver(&csi_f1c100s); } static __exit void csi_f1c100s_driver_exit(void) { unregister_driver(&csi_f1c100s); } driver_initcall(csi_f1c100s_driver_init); driver_exitcall(csi_f1c100s_driver_exit);
以下为SCCB部分,SCCB只是I2C的特例,所以就在I2C驱动里加了2个函数:
int i2c_sccb_write(const struct i2c_device_t * dev, uint8_t reg, uint8_t data) { uint8_t msg_data[2] = { reg, data }; struct i2c_msg_t msg[1]; msg[0].addr = dev->addr; msg[0].flags = 0; msg[0].len = 2; msg[0].buf = msg_data; int ret = i2c_transfer(dev->i2c, msg, 1); return (ret == 1) ? 1 : 0; } int i2c_sccb_read(const struct i2c_device_t * dev, uint8_t reg, uint8_t* out) { uint8_t msg_data[2] = { reg, 0xee }; struct i2c_msg_t msg[2]; // write address msg[0].addr = dev->addr; msg[0].flags = 0; msg[0].len = 1; msg[0].buf = msg_data; // read back msg[1].addr = dev->addr; msg[1].flags = I2C_M_RD; msg[1].len = 1; msg[1].buf = msg_data + 1; int ret = i2c_transfer(dev->i2c, msg, 2); if (ret == 2) { *out = msg_data[1]; return 1; } else { return 0; } }
多谢大神,谢谢分享!!!@Quotation
我记得这个安装过了,当时显示是0个需要更新,说明已经存在了,我再卸载重新试下,谢谢晕哥
scripts/dtc/pylibfdt/Makefile:26: recipe for target 'scripts/dtc/pylibfdt/_libfdt.so' failed
make[3]: *** [scripts/dtc/pylibfdt/_libfdt.so] Error 1
scripts/Makefile.build:425: recipe for target 'scripts/dtc/pylibfdt' failed
make[2]: *** [scripts/dtc/pylibfdt] Error 2
scripts/Makefile.build:425: recipe for target 'scripts/dtc' failed
make[1]: *** [scripts/dtc] Error 2
Makefile:491: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
CHK include/config.h
CFG u-boot.cfg
请问下编译uboot出现如下错误是什么问题呢,百度了没找到解决方法
touch.h
/************************************************ name : touch.h desc : author : HuangXinfeng date : 2018.09.07 ************************************************/ #ifndef __TOUCH_H__ #define __TOUCH_H__ #ifdef __cplusplus extern "C" { #endif #define TP_BASE_ADDR 0x01c24800 #define TP_CTRL0 0x00 #define TP_CTRL1 0x04 #define TP_CTRL2 0x08 #define TP_CTRL3 0x0c #define TP_INT_FIFOC 0x10 #define TP_INT_FIFOS 0x14 #define TP_TPR 0x18 #define TP_CDAT 0x1c #define TEMP_DATA 0x20 #define TP_DATA 0x24 /* TP_CTRL0 bits */ #define ADC_FIRST_DLY(x) ((x) << 24) /* 8 bits */ #define ADC_FIRST_DLY_MODE(x) ((x) << 23) #define ADC_CLK_SEL(x) ((x) << 22) #define ADC_CLK_DIV(x) ((x) << 20) /* 3 bits */ #define FS_DIV(x) ((x) << 16) /* 4 bits */ #define T_ACQ(x) ((x) << 0) /* 16 bits */ /* TP_CTRL1 bits */ #define STYLUS_UP_DEBOUN(x) ((x) << 12) /* 8 bits */ #define STYLUS_UP_DEBOUN_EN(x) ((x) << 9) #define TOUCH_PAN_CALI_EN(x) ((x) << 6) #define TP_DUAL_EN(x) ((x) << 5) #define TP_MODE_EN(x) ((x) << 4) #define TP_ADC_SELECT(x) ((x) << 3) #define ADC_CHAN_SELECT(x) ((x) << 0) /* 3 bits */ /* on sun6i, bits 3~6 are left shifted by 1 to 4~7 */ #define SUN6I_TP_MODE_EN(x) ((x) << 5) /* TP_CTRL2 bits */ #define TP_SENSITIVE_ADJUST(x) ((x) << 28) /* 4 bits */ #define TP_MODE_SELECT(x) ((x) << 26) /* 2 bits */ #define PRE_MEA_EN(x) ((x) << 24) #define PRE_MEA_THRE_CNT(x) ((x) << 0) /* 24 bits */ /* TP_CTRL3 bits */ #define FILTER_EN(x) ((x) << 2) #define FILTER_TYPE(x) ((x) << 0) /* 2 bits */ /* TP_INT_FIFOC irq and fifo mask / control bits */ #define TEMP_IRQ_EN(x) ((x) << 18) #define OVERRUN_IRQ_EN(x) ((x) << 17) #define DATA_IRQ_EN(x) ((x) << 16) #define TP_DATA_XY_CHANGE(x) ((x) << 13) #define FIFO_TRIG(x) ((x) << 8) /* 5 bits */ #define DATA_DRQ_EN(x) ((x) << 7) #define FIFO_FLUSH(x) ((x) << 4) #define TP_UP_IRQ_EN(x) ((x) << 1) #define TP_DOWN_IRQ_EN(x) ((x) << 0) /* TP_INT_FIFOS irq and fifo status bits */ #define TEMP_DATA_PENDING BIT(18) #define FIFO_OVERRUN_PENDING BIT(17) #define FIFO_DATA_PENDING BIT(16) #define TP_IDLE_FLG BIT(2) #define TP_UP_PENDING BIT(1) #define TP_DOWN_PENDING BIT(0) /* TP_TPR bits */ #define TEMP_ENABLE(x) ((x) << 16) #define TEMP_PERIOD(x) ((x) << 0) /* t = x * 256 * 16 / clkin */ #ifdef __cplusplus } #endif #endif
touch.c
/************************************************ name : touch.h desc : author : HuangXinfeng date : 2018.09.08 ************************************************/ #include "touch.h" #include "io.h" struct IntTypeStu { u32_t INTC_VECTOR_REG; u32_t INTC_BASE_ADDR_REG; u32_t INTC_CTRL_REG; u32_t INTC_PEND_REG0; u32_t INTC_PEND_REG1; u32_t INTC_EN_REG0; u32_t INTC_EN_REG1; }; void TouchInit() { u32_t addr; u32_t val; /* 配置 GPIOA0 为 TPX1 TPY1 TP X2 TPY2*/ addr = 0x01c20800 + 0x00; val = read32(addr); val &= ~(0x0000ffff); //低14位清0 val |= 0x22222222; //010 TP模式即每位都是2 write32(addr, val); val = read32(TP_BASE_ADDR+TP_CTRL0); /*24M / 6 = 4Mhz(CLK_IN)/ 2^13(8192) = 488.28125 hz*/ /*Conversion Time = 1 / (4MHz/13Cycles) = 3.25us*/ /*触摸ADC获取时间T_ACQ = CLK_IN /(16*(1+63)) = 3906.25hz 左右*/ write32(TP_BASE_ADDR+TP_CTRL0, (0x1f << 23)|ADC_CLK_SEL(0) | ADC_CLK_DIV(2) | FS_DIV(7) | T_ACQ(63)); /*00: FIFO store X1,Y1 data for single touch no pressure mode*/ val = read32(TP_BASE_ADDR+TP_CTRL2); val = (0x08 << 28) | TP_MODE_SELECT(0) | (0 << 24)|0xFFF; write32(TP_BASE_ADDR+TP_CTRL2, val); val = read32(TP_BASE_ADDR+TP_CTRL3);//使能滤波器 write32(TP_BASE_ADDR + TP_CTRL3, FILTER_EN(1) | val); write32(TP_BASE_ADDR + TP_TPR, TEMP_ENABLE(1) | TEMP_PERIOD(1953));//温度转换寄存器 val = read32(TP_BASE_ADDR+TP_CTRL1); val = (5<<12) | (1<< 9) | (0<<8) | (1 << 5) | TP_MODE_EN(0) | 0x00; //4通道使能 write32( TP_BASE_ADDR + TP_CTRL1, val); write32( TP_BASE_ADDR + TP_CDAT, 0xc00); write32( TP_BASE_ADDR + 0x38, 0x22); write32(TP_BASE_ADDR + TP_INT_FIFOC , TEMP_IRQ_EN(1) | OVERRUN_IRQ_EN(0) | DATA_IRQ_EN(1) | FIFO_TRIG(0x02) | TP_DATA_XY_CHANGE(0)| FIFO_FLUSH(1) | TP_UP_IRQ_EN(1) | TP_DOWN_IRQ_EN(1)); // write32(TP_BASE_ADDR + TP_INT_FIFOC, 0x00); addr = 0x01c20400 + 0x20; //INT Enable register0 val = read32(addr); val |= (1 << 20); write32(addr, val); val = read32(0x01c20400 + 0x30); val &= ~(1 << 20); //释放屏蔽位 write32(0x01c20400 + 0x30, val); }
main.c
extern int touchx,touchy,temperature; __irq void HandleIRQ() { u32_t x, y; u32_t val; if(read32(INTC_PEND_REG0) & (1 << 13))//定时器0中断 { SystickMs(); write32(TIMER_BASS_ADDR+TMR_IRQ_STA_REG, 0x01);//清除中断 } else if(read32(INTC_PEND_REG0) & (1 << 20))//触摸屏中断 { val = read32(0x01C24800 + 0x14); if (val & (1 << 16))//fifo data irq { if (((val<<17) >> 8) > 5) { touchx = x = read32(TP_BASE_ADDR+TP_DATA); touchy = y = read32(TP_BASE_ADDR+TP_DATA); x = 1; } } if (val & (1 << 18))//温度传感器中断 { temperature = read32(TP_BASE_ADDR+0x20); } if (val & (1 << 0))//按下中断 { x = 1; } if (val & (1 << 1))//抬起中断 { y = 1; } write32(TP_BASE_ADDR+TP_INT_FIFOS, val); // write32(TP_BASE_ADDR + TP_INT_FIFOC , read32(0x01C24800 + 0x14) | FIFO_FLUSH(1)); // write32(TP_BASE_ADDR+TP_INT_FIFOS, read32(0x01C24800 + 0x14) | (0x01) | (1 << 17)); // write32(0x01c20400+ 0x10 , (1 << 20) ); } } int main(void) { ...... *((void * volatile *)0x00000038) = (void *volatile)HandleIRQ;//IRQ地址 ...... }
晕哥,我看了下这个文件有的寄存器手册里面找不到,
比如#define TP_TPR 0x18
#define TEMP_DATA 0x20 这两个寄存器在手册里没有,我看的是F1C600的手册
tianjjff 说:晕哥,请教下,我的nano已经焊接到了底板上面,怎么跳线到触摸接口上面,没看到上面的X1 Y1等的焊盘
板子拍个照片, 因为荔枝派nano有几个版本。
这样看得到吗?
晕哥,请教下,我的nano已经焊接到了底板上面,怎么跳线到触摸接口上面,没看到上面的X1 Y1等的焊盘
tianjjff 说:晕哥 说:实在抱歉,不过挖坑网实至名归
晕哥,请问一下,我按照您这个新的Windows工具可以烧录,然后自己写了一个最简单的裸机程序烧录进去后,结果一上电就会自动进入FEL模式,我需要怎么做才能运行裸机程序呢?
烧到 flash 的裸机程序需要符合全志的规则,
要加魔数(eGON.BT0), 长度字节, 和校验码, 都通过之后, BROM才会认为是合法的启动程序(BOOT0)
https://github.com/xboot/xboot/blob/master/developments/sunxi/mksunxi/mksunxi.c
好的,谢谢晕哥!!!
loodao 说:晕哥 说:为了不再给大家造成困扰,我把文件重新整理了 V3s 和 F1C100s 两个文件夹,
哥:你这个坑挖得太深了,我折腾了几天了,谢谢
实在抱歉,不过挖坑网实至名归
晕哥,请问一下,我按照您这个新的Windows工具可以烧录,然后自己写了一个最简单的裸机程序烧录进去后,结果一上电就会自动进入FEL模式,我需要怎么做才能运行裸机程序呢?
页次: 1