主题中讨论的其他器件:TPS65217
工具/软件:Linux
你(们)好
团队
我正在尝试在 Beagle Bone Black 板上测试 i2c-omap.c 驱动程序
我正在使用默认驱动程序存在
insmod 安装
[techveda@BBBlack:]# insmod i2c-origin.ko
[24.326899] tps65217 0-0024:TPS65217 ID 0xe 版本1.2
[24.333257] OMAP_i2c 44e0b000。i2c:总线0 rev0.11、频率为400kHz
[24.356118] OMAP-i2c 4802a000.i2c:总线1 rev0.11为100kHz
[24.373599] omap_i2c 4819c000.i2c:100kHz 时的总线2版本0.11
我将使用以下应用程序来测试这种情况
我确信已插入 i2c-OMAP 驱动程序
但是、当我尝试运行应用程序时、我会遇到超时错误
如下所示
错误:write()失败
[techveda@BBBlack:]#./i2c50
成功:打开(3)通过
成功:ioctl (fd、I2C_slave、0x50>>1)通过
执行 EEPROM 写入操作
[172.058433] OMAP-i2c 4in 819c000.i2c:控制器超时
[173.098410] OMAP_i2c 4819c000.i2c:控制器超时
错误:write()失败
[techveda@BBBlack:]#
[techveda@BBBlack:]#
无法根据源链接中的补丁程序确定错误
我已将延迟修改为6*1000
请帮我解决我所附的申请
如果有其他应用需要使用、请告诉我
我只想将内部存在的字节写入 EEPROM 并进行回读
从 dtsi 文件中、我找到 base_eeprom
&i2c2{ pinctrl-names ="默认值"; pinctrl-0 =<&i2c2_PINs>; 状态="正常"; 时钟频率=<100000>; cape eeprom0:capt_eprom0@ @ @54{compatible ="at、24c256";reg =<0x54>;#address-cores =<0x55>;cipro1 =<cipeprom =<0x55>;<ciprom1;<cip_1 = 0x256>=<ciprom1;<ciprom1 =<256;<ciprom1 =<cip_1 =<256;<ciprom1 =<256}<ciprom1 =<ciprom1;cip_1 =<ciprom1;cip_1; #size-cells =<1>; cape1_data:capt_data@0{ reg =<0 0x100>; }; }; capt_eeprom2:capt_eeprom2@56{ compatible ="at、24c256"; reg =<0x56>; #address-cells =<1>; #size-cells =<1>;
我的应用是这样的
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* chmod 666 /dev/i2c-0 */
int main (void)
{
//要写入 EEPROM
的数据 unsigned char wbuf[17]={0x00、0x11、0x12、0x13、0x14、 0x15、0x16、0x17、0x18、0x19、 0x1A、0x1B、0x1C、0x1D、0x1E、 0x1f};
unsigned char rbuf[16];
int i2c_addr = 0x54;
int status;
unsigned short int i;
//打开 I2C 设备
int fd = open ("/dev/i2c-2、O_RDWR);
if (fd < 0){
printf ("error:open (%d) failed\n"、SUd");
return -1;return -1;
i2c_dd
(iDfd)、设置 iDCfd (iDC_adfd)、iDCfd (iD/ iDd)
如果(状态< 0)
{
printf ("错误:ioctl (fd、I2C_slave、0x%02x)失败\n"、i2c_addr);
关闭(fd);
return -1;
}
printf ("\nSUCCESS:ioctl (FD、I2C_SLAVE、0x%02x>>>1)传递了\n"、i2c_addr);
//写入 EEPROM
printf ("\n 执行 EEPROM 写入操作\n");
写入(fd、wbuf、16);
睡眠(10);//直到 EEPROM 完成写入
(write (fd、wbuf、16)!= 16){
printf ("error:write () failed\n");
Close (fd);
return -fp (wbuf
)(
1);如果从 EEPROM 写入
操作("subforming (buf"、则为1)、则为1)/printf (wbuf)("printf ("(wbuf);//);/printf (wbuf (wbuf);/n= 1)(从 EEPROM (1);/printf (wbuf (1);/f (wbuf) read()的缓冲区指针初始化失败\n");
}
如果(read(fd,rbuf,16)!= 16){printf("error:
read()failed\n");
close (fd);
return -1;
}
for (i=0;i< 16;i++)
printf("ReadBuffer[%d]%d];return -1"; rfd)\n"preeeeeeee";
eneeeed"
请告诉我可以尝试做什么
谢谢你
Deepak R

