页次: 1
&spi1 {
clock-frequency = <100000000>;
pinctrl-0 = <&spi1_pins_a &spi1_pins_b>;
pinctrl-1 = <&spi1_pins_c>;
pinctrl-names = "default", "sleep";
spi_slave_mode = <0>;
spi1_cs_number = <1>;
spi1_cs_bitmap = <1>;
spi_dbi_enable = <0>;
status = "okay";
spi_board1@0 {
device_type = "spi_board1";
compatible = "rohm,dh2228fv";
spi-max-frequency = <0x5f5e100>;
reg = <0x0>;
spi-rx-bus-width = <0x4>;
spi-tx-bus-width = <0x4>;
status = "disabled";
};
st7789v@0 {
status = "okay";
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <60000000>;
rotate = <0>;
bgr;
fps = <60>;
buswidth = <8>;
reset = <&pio PD 15 GPIO_ACTIVE_LOW>;
dc = <&pio PD 14 GPIO_ACTIVE_LOW>;
latch = <&pio PD 16 GPIO_ACTIVE_HIGH>;
debug = <1>;
};
};调试触摸芯片,旧的芯片是GT911,现在改为FT6336U,使用tina sdk内部的focaltech_toch驱动,设备树:
ctp@38 { /* FT6336U的I2C地址通常为0x38 */
compatible = "focaltech,fts";
reg = <0x38>;
status = "okay";
interrupt-parent = <&pio>;
interrupts = <PD 22 IRQ_TYPE_LEVEL_LOW>;
focaltech,reset-gpio = <&pio PG 10 GPIO_ACTIVE_HIGH>;
focaltech,irq-gpio = <&pio PD 22 IRQ_TYPE_LEVEL_LOW>;
focaltech,max-touch-number = <2>;
focaltech,display-coords = <0 0 800 480>;
focaltech,reg_vdd = <®_pio3_3>;
focaltech,reg_avdd = <®_pio3_3>;
};发现通信失败
[ 2.144381] [FTS]fts_ts_init: Enter
[ 2.151606] [FTS]fts_ts_init: Exit(1401)
[ 2.728245] [FTS]fts_ts_probe: Enter
[ 2.732327] [FTS]fts_parse_dt: Enter
[ 2.736370] [FTS]max_touch_number=2
[ 2.740291] [FTS]fts_parse_dt: Exit(933)
[ 2.744695] [FTS]fts_input_dev_init: Enter
[ 2.749495] input: fts_ts as /devices/platform/soc@3000000/sunxi-i2c2/i2c-2/2-0038/input/input2
[ 2.759547] [FTS]fts_input_dev_init: Exit(246)
[ 2.764567] [FTS]fts_ctpm_get_upgrade_array: Enter
[ 2.769985] [FTS][Info]CHIP TYPE ID = 0x6426
[ 2.790619] [FTS][Error]fts_i2c_write: i2c_transfer(write) error, ret=-22
[ 2.826527] [FTS][Error][IIC]: i2c_transfer(read) error, ret=-22!!
[ 2.833487] [FTS][Error]hidi2c change to stdi2c error!!
[ 2.839363] [FTS]fts_ctpm_get_upgrade_array: Exit(167)
[ 2.845147] [FTS]fts_gpio_configure: Enter
[ 2.861129] [FTS]fts_gpio_configure: Exit(787)
[ 3.134647] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.141692] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.194668] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.201707] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.254638] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.261683] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.314687] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.321725] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.374642] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.381686] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.434635] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.441673] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.494633] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.501677] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.554633] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.561670] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.614634] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.621681] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.674644] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.681683] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.734640] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.741683] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.794635] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.801673] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.854633] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.861677] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.914632] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.921670] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 3.974632] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-22!!
[ 3.981676] [FTS][Info]TP Not Ready, ReadData = 0x0
[ 4.019035] [FTS][Mode]create sysfs succeeded
[ 4.023926] [FTS]fts_ts_probe: Exit(1156)我了解的大致思路是 用ion申请硬件内存,将NV21的数据放在里面,用G2D转换,然后再拷贝的自己的内存中,
但是我ion申请内存老是失败
请大佬们指点下
头文件
//
// Created by zx on 2025/10/18.
//
#ifndef LVGLDEMO_MODULES_ION_UTILS_H
#define LVGLDEMO_MODULES_ION_UTILS_H
//#include "ion.h"
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdint.h>
#include <stddef.h>
//#include <linux/ion.h>
#ifdef __cplusplus
extern "C" {
#endif
// =============================
// ION HEAP MASK 定义
// =============================
// 这些定义适用于 Allwinner T113 / TinaLinux 内核
#define ION_HEAP_SYSTEM_MASK (1 << 0)
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << 1)
#define ION_HEAP_CARVEOUT_MASK (1 << 2)
#define ION_HEAP_DMA_MASK (1 << 4)
#define ION_HEAP_CMA_MASK (1 << 8) // 常用于G2D、视频帧缓冲等
#define ION_HEAP_RESERVE_MASK (1 << 9) // 部分平台有专用保留区
// 一般建议默认使用 CMA 堆
#define ION_T113_DEFAULT_HEAP_MASK ION_HEAP_DMA_MASK|ION_HEAP_CARVEOUT_MASK
#define AW_ION_CACHED_FLAG 1 /* mappings of this buffer should be cached, ion will do cache maintenance when the buffer is mapped for dma */
#define AW_ION_CACHED_NEEDS_SYNC_FLAG 2 /* mappings of this buffer will created at mmap time, if this is set caches must be managed manually */
typedef struct {
int buf_fd; // dma-buf fd,用于 mmap
size_t size; // 申请的大小
void *vir_addr; // 映射的虚拟地址
unsigned long phys_addr; // 物理地址(可选,如果支持)
} my_ion_buf_t;
// 初始化与反初始化
int my_ion_init(void);
void my_ion_deinit(void);
// 分配与释放
my_ion_buf_t * my_ion_alloc(size_t size, unsigned int heap_mask);
void my_ion_free(my_ion_buf_t *buf);
// 地址映射
int my_ion_mmap(my_ion_buf_t *buf);
void my_ion_munmap(my_ion_buf_t *buf);
void my_ion_dest(void);
#endif //LVGLDEMO_MODULES_ION_UTILS_H源文件
/******************************************************************************************
*文件名: ion_utils.c.c
*创建时间:2024/12/29
*说明:
******************************************************************************************/
/******************************************************************************************/
/*****************************************头文件********************************************/
/******************************************************************************************/
#include "ion_utils.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "zx_log.h"
/******************************************************************************************/
/*****************************************局部变量声明**************************************/
/******************************************************************************************/
static int g_ion_fd = -1;
// ========== 内核头文件定义复制 ==========
struct ion_allocation_data
{
size_t len;
size_t align;
unsigned int heap_id_mask;
unsigned int flags;
int handle;
};
struct ion_handle_data
{
int handle;
};
struct ion_fd_data
{
int handle;
int fd;
};
#define ION_IOC_MAGIC 'I'
#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
/******************************************************************************************/
/*****************************************局部函数声明**************************************/
/******************************************************************************************/
/******************************************************************************************/
/********************************************其他******************************************/
/******************************************************************************************/
/******************************************************************************************/
/********************************************开始******************************************/
/******************************************************************************************/
int my_ion_init(void)
{
my_ion_deinit();
g_ion_fd = open("/dev/ion", O_RDWR);
if (g_ion_fd < 0)
ZX_LOG_E("open /dev/ion failed\r\n");
return g_ion_fd;
}
void my_ion_deinit(void)
{
if (g_ion_fd >= 0)
{
close(g_ion_fd);
g_ion_fd = -1;
}
}
my_ion_buf_t *my_ion_alloc(size_t size, unsigned int heap_mask)
{
struct ion_allocation_data alloc_data;
my_ion_buf_t *buf = calloc(1, sizeof(my_ion_buf_t));
if (!buf)
{
ZX_LOG_E("calloc my_ion_buf_t failed\r\n");
return NULL;
}
memset(&alloc_data, 0, sizeof(alloc_data));
alloc_data.len = size;
alloc_data.align = 4096;
alloc_data.heap_id_mask = heap_mask;
alloc_data.flags = AW_ION_CACHED_FLAG | AW_ION_CACHED_NEEDS_SYNC_FLAG;
alloc_data.handle = -1;
if (ioctl(g_ion_fd, ION_IOC_ALLOC, &alloc_data) < 0)
{
ZX_LOG_E("ION_IOC_ALLOC failed\r\n");
free(buf);
buf = NULL;
} else
{
buf->buf_fd = alloc_data.handle;
buf->size = size;
}
return buf;
}
int my_ion_mmap(my_ion_buf_t *buf)
{
struct ion_fd_data fd_data;
if (!buf)
return -1;
memset(&fd_data, 0, sizeof(fd_data));
fd_data.handle = buf->buf_fd;
if (ioctl(g_ion_fd, ION_IOC_MAP, &fd_data) < 0)
{
ZX_LOG_E("ION_IOC_MAP failed\r\n");
return -1;
}
buf->vir_addr = mmap(NULL, buf->size, PROT_READ | PROT_WRITE, MAP_SHARED, buf->buf_fd, 0);
if (buf->vir_addr == MAP_FAILED)
{
ZX_LOG_E("ion mmap failed\r\n");
buf->vir_addr = NULL;
return -1;
}
return 0;
}
void my_ion_munmap(my_ion_buf_t *buf)
{
if (buf && buf->vir_addr)
{
munmap(buf->vir_addr, buf->size);
buf->vir_addr = NULL;
}
}
void my_ion_free(my_ion_buf_t *buf)
{
if (!buf)
return;
if (buf->buf_fd >= 0)
{
struct ion_handle_data handle_data = {.handle = buf->buf_fd};
ioctl(g_ion_fd, ION_IOC_FREE, &handle_data);
close(buf->buf_fd);
buf->buf_fd = -1;
}
free(buf);
}
void my_ion_dest(void)
{
int res = -1;
res = my_ion_init();
if (res < 0)
return;
// 分配 2MB 连续内存(供 G2D、视频使用)
my_ion_buf_t *buf = my_ion_alloc(2 * 1024 * 1024, ION_T113_DEFAULT_HEAP_MASK);
if (!buf)
{
ZX_LOG_E("alloc failed\r\n");
my_ion_deinit();
return;
}
// 映射
res = my_ion_mmap(buf);
if (res < 0)
ZX_LOG_E("mem map fail!\r\n");
else
{
ZX_LOG_I("ION virtual addr: %p, size=%zu\n", buf->vir_addr, buf->size);
}
// 用完释放
my_ion_munmap(buf);
my_ion_free(buf);
my_ion_deinit();
}
/****************************************end of file***************************************/请教一个问题,我现在开发应用交叉编译使用的头文件路径是out目录里面的staging_dir,有些功能需要使用linux内核的头文件,这个应该使用什么路径下的
现在是用的头文件路径有:
include_directories(/home/xsx/t113/Tina-Linux/out/t113-bingpi_m2/staging_dir/target)
include_directories(/home/xsx/t113/Tina-Linux/out/t113-bingpi_m2/staging_dir/target/usr/include)
include_directories(/home/xsx/t113/Tina-Linux/out/t113-bingpi_m2/staging_dir/target/usr/include/allwinner)
但是这里面没有内核的头文件,比如<linux/ion.h>
是应该包含/Tina-Linux/lichee/linux-5.4/include/linux路径么
知道的大佬指点下,非常非常感谢
xsxled:{
compatible = "xsx,userled";
#address-cells = <1>;
#size-cells = <1>;
reg = <0X01C208D8 0X04 0X01C208E8 0X04 >;
status = "okay";
};
编译报错无法解析设备树
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8
DTC arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb
Error: arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts:134.8-9 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb] Error 1
make[1]: *** [dtbs] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [sub-make] Error 2
大佬指点下新手,感谢
是不是这个 https://aicdoc.artinchip.com/topics/ic/pwm/pwm-module-d12x.html
如果技术支持真的那么差,那就难搞了,刚入手的D211
我昨天才到的D211开发板,现在只能烧录demo程序,原理图文件也没要到,不知道是不是周末,淘宝都没人
https://whycan.com/files/members/2275/472f604b53b2e03ea79a7ab4b779502.jpg
这板子还是不错的,显示全引出,摄像头也有引出,主要是这个价格还不贵
大佬,板子我已经收到货了,但是官方没给原理图资料啊,这咋用呢,你有资料么
老板链接:https://item.taobao.com/item.htm?id=756136592420&pisk=fFIBrfjnBXcQK78KuTewlMND20-5O6Z4RY9RnTnEeHKpwY1OeLppeUp9WpJKyUdz-_T5a1YRYHWF1vj1G0oUtyX-V3-8gSr409DHq3F44XZs0XvHFDEywUntnd9CiSr40Oi1ASj7g8fZwnLXU3ppyQdTCL9Jp3Lp2ce6eLlpwBCRBFqxCciTFOFsjcuMQ47bdDDELG9TZIBB0dvNfIYpMFds2NS6deOApMAhWjvObGT27YykXtbN9dtbVcKBlMjXWMFiVFfW6Usp5ynOGH1WkMLsemXwfBt6BieroCS6T_IBW-oXzhI2kHQaSW8yAK1Rx6MS2sIyemRb7LuSCEmWCIy_C40u5M_kDYEFlSTpIpTaCRGdrepMCIy_C40kJdvB_Rws9af..&skuId=5213194116169&spm=a1z10.1-c-s.w4004-25403352918.2.69195c979rfHH8
要的走闲鱼:【闲鱼】https://m.tb.cn/h.gJrKXTx?tk=y2l037LzCoG CA6496 「我在闲鱼发布了【bingpi m1,配件:v3s主板,wifi,5寸屏。】」
点击链接直接打开
U-Boot SPL 2018.01-05679-g013ca45-dirty (Dec 01 2022 - 16:42:03)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05679-g013ca45-dirty (Dec 01 2022 - 16:42:03 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM: 32 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected xt25f128b with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
mmc_init: -95, time 22
starting USB...
No controllers found
USB is stopped. Please issue 'usb start' first.
starting USB...
No controllers found
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
starting USB...
No controllers found
No ethernet found.
No ethernet found.
=> u-boot用的是荔枝派官方nano-v2018.01分支,flash芯片已经改为xt25f128b
小白求助啊,感谢大神指点
页次: 1