Dear IMX Community,
Am using the I2C1 Bus for configuring the EEPROM (CAT24C08) & RTC (PCF8563) & did the following changes as below, but when I checked the logs, I2C device registration is getting failed, could you please let me know any other configuration needs to be done or any thing needs to be changed for getting registered , could you please kindly do the needful as am stuck with this issue from 2 days :smileysad:
Am using L2.6.35_10.12.01_ER_source I.MX28 BSP's for my custom board
Any help would be greatly appreciated
Thanks in advance,
For EEPROM:
=======================================================================================================
Device Driver
Misc devices
EEPROM support --->
<*> I2C EEPROMs from most vendors
FOR RTC:
=====================================================================================================
Device Drivers --->
<*> Real Time Clock --->
<*> Philips PCF8563/Epson RTC8564
For I2C BUS DRIVER:
=======================================================================================================
Device Driver
<*> I2C support --->
Enable I2C1 module
Board file changes /linux-2.6.35.3/arch/arm/mach-mx28/mx28evk.c :
=======================================================================================================
static struct at24_platform_data eepromat24c08 = {
.byte_len = SZ_8K / 8, // 1024 BYTES (EEPROM SIZE IN BYTES) = 1024*8 = 8192 bits = 1 Kb
.page_size = 16, // PAGE SIZE IN BYTES FOR WRITES , total 64 pages of 16 bytes = 8192 bits = 1Kb
};
static struct i2c_board_info __initdata mxs_i2c_device[] = {
// { I2C_BOARD_INFO("sgtl5000-i2c", 0xa), .flags = I2C_M_TEN },
// EEPROM
{
I2C_BOARD_INFO("24c08", 0x50), .flags = I2C_M_TEN,
.platform_data = &eepromat24c08,
},
//RTC
{ I2C_BOARD_INFO("pcf8563", 0x51), .flags = I2C_M_TEN }
};
static void __init i2c_device_init(void)
{
i2c_register_board_info(0, mxs_i2c_device, ARRAY_SIZE(mxs_i2c_device));
i2c_register_board_info(1, mxs_i2c_device, ARRAY_SIZE(mxs_i2c_device));
}
PAD CONFIGURATION for I2C1:(arch/arm/mach-mx28/mx28evk_pins.c):
=======================================================================================================
{
.name = "I2C1_SCL",
.id = PINID_I2C1_SCL,
.fun = PIN_FUN2,
.strength = PAD_8MA,
.voltage = PAD_3_3V,
.drive = 1,
},
{
.name = "I2C1_SDA",
.id = PINID_I2C1_SDA,
.fun = PIN_FUN2,
.strength = PAD_8MA,
.voltage = PAD_3_3V,
.drive = 1,
},
Using CHIP DRIVER file for EEPROM (drivers/misc/eeprom/at24.c) & for RTC (/drivers/rtcrtc-pcf8563.c)
==============================================
Kernel logs w.r.t I2C1
i2c i2c-1: Failed to register i2c client dummy at 0x51 (-16)
at24 1-0050: address 0x51 unavailable
at24: probe of 1-0050 failed with error -98
Many Thanks in advance,
Solved! Go to Solution.
This not i.mx specific at all. Basically you need to install the mtd-utils package into your rootfs.
Then use flash_eraseall , mtdinfo, flashcp, etc.
Or you can also use standard dd commands:
dd if=/dev/mtd0 of=temp.bin bs=512 count=1
Hi, I've the same problem, I'm stuck in:
i2c i2c-1: Failed to register i2c client dummy at 0x51 (-16)
at24 1-0050: address 0x51 unavailable
at24: probe of 1-0050 failed with error -98
Can you tell me what have you done for making the eeprom probed?
Thanks in advance.
Regards.
Dear All,
I'm trying to validate only EEPROM for time being & got the following logs, could any body please confirm that whether driver is getting registered successfully or not & the device file eeprom is created or not, because after this when I used echo & cat commands I facing, "cat:read connection timeout error", but before this I feel my write is not happening using echo, & after this I tried using the test application as mentioned below, but it is, unable to open the device
Could any body please help me in resolving this read & write issue to eeprom as am stuck with this unable to proceed further, any help would be greatly appreciated
1. Kernel Console Output
The following kernel output (or similar) shows the EEPROM driver was started.
at24 at24_probe I2C for EEPROM device at address 0x50
at24 1-0050: 1024 byte at24 EEPROM (writable)
2. Trying to write to eeprom & trying to read
root@freescale /sys/bus/i2c/devices$ ls
1-0050 1-0051 1-0052 1-0053 i2c-0 i2c-1
root@freescale /sys/bus/i2c/devices$ cd 1-0050
root@freescale /sys/devices/platform/mxs-i2c.1/i2c-1/1-0050$ echo 0123456789 > eeprom
Statussssssssssssss of at24_eeprom_write function = -110
root@freescale /sys/devices/platform/mxs-i2c.1/i2c-1/1-0050$ ls
driver eeprom modalias name power subsystem uevent
root@freescale /sys/devices/platform/mxs-i2c.1/i2c-1/1-0050$
3. Tried using the test application as shown below "test_i2c.c"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <errno.h>
#include <string.h>
int main(void)
{
unsigned char buffer[10]={0x00,'a','b','c','d','e'};
int fd = open("/sys/devices/platform/mxs-i2c.1/i2c-1/1-0050/", O_RDWR);
if (fd < 0) {
perror("open i2c device:");
return 1;
}
write(fd, &buffer, 6);
buffer[0]=0x00;
read(fd, &buffer, 8);
/*printf("%c ", buffer[0]);
printf("%c ", buffer[1]);
printf("%c ", buffer[2]);
printf("%c ", buffer[3]);
printf("%c ", buffer[4]); */
close(fd);
}
root@freescale /$ ./i2c1_test_eeprom
open i2c device:: Is a directory
Awaiting for any of your suggestions or replies
Thanks in advance
Your I2C flash is getting probed.
In order to read/write to the the I2C flash, you could use the 'mtd-utils' package.
Could you please help me how to use 'mtd utils' to write/read into my eeprom (cat24c08)
This not i.mx specific at all. Basically you need to install the mtd-utils package into your rootfs.
Then use flash_eraseall , mtdinfo, flashcp, etc.
Or you can also use standard dd commands:
dd if=/dev/mtd0 of=temp.bin bs=512 count=1
kernel console out:
at24 1-0050: 1024 byte at24 EEPROM (writable)
I tried using i2c tools but I dont see my eeprom address
root@freescale ~$ ls /dev/i2*
/dev/i2c-0 /dev/i2c-1
root@freescale ~$ i2cdetect -y -a -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- 11 -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2e --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- 46 -- -- -- -- -- -- -- -- --
50: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
root@freescale ~$
could you pls let me know what could be issue?
Srinivasan
Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help please feel
free to contact Freescale.
Thanks,
Yixing
Please close this issue it is resolved, thanks a lot fro your support
Hi Srinivasan,
I am also getting the same problem.at24@50 is probed but not able to write to EEPROM.
Can you tell me how have you solved the issue