I2C1 interface for two devices on I.MX28

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2C1 interface for two devices on I.MX28

1,455 Views
srinivasanshanm
Contributor III

Dear I.MX Community,

As am new to this I.MX28 EVK & using ltib source, firstly I would like to validate the exisitng I2c interfaced peripherals on I.MX28 EVK, so could anybody please kindly let me know what are all the peripherals that is being interfaced to I2C in I.MX28 EVK & how to validate the same

I need to interface two devices ie., CAT24C08 (EEPROM) & PCF8563(RTC) on the same I2C1 bus in I.MX28, could anybody please kindly let me know how to get started in modifying the existing driver code as soon as possible,

Any help would be greatly appreciated

Kindly awaiting for your replies

Many Many Thanks in advance,

Labels (2)
0 Kudos
7 Replies

739 Views
srinivasanshanm
Contributor III

Hi,

Could you pls let me know hw to get started in modifying L2.6.35_10.12.01_ER_source as I have many other pheripherals to be interfaced to the same I2c1 bus but could you please let me know how to implement the EEPROM & RTC so that I can takecare othe other peripherals, simultaneously as soon as possible

Awaiitng for your replies

Many Thanks in advance

0 Kudos

739 Views
YixingKong
Senior Contributor IV

FabioEstevam, could you keep working on the customer's furhter question please?

Thanks,

Yixing

srinivasan shanmugam wrote:

Hi,

Could you pls let me know hw to get started in modifying L2.6.35_10.12.01_ER_source as I have many other pheripherals to be interfaced to the same I2c1 bus but could you please let me know how to implement the EEPROM & RTC so that I can takecare othe other peripherals, simultaneously as soon as possible

Awaiitng for your replies

Many Thanks in advance

0 Kudos

739 Views
srinivasanshanm
Contributor III

You can please close this ticket, thanks a lot for your support

0 Kudos

739 Views
fabio_estevam
NXP Employee
NXP Employee

It would be simple to add support to the EEPROM and RTC on your own board.

I would suggest you to use a recent kernel, such as 3.11 with device tree.

For a reference, you could look at:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx28-sps1.dt...

(Search for i2c and you will see how the EEPROM and RTC nodes were added).

0 Kudos

739 Views
srinivasanshanm
Contributor III

Hi Fabio,

Thanks a lot for your quick response

As am using L2.6.35_10.12.01_ER_source (ltib source ) for I.MX28, could you pls help me how to get started with the changes in this source w.r.t I2c-1, because we are not using kernel 3.11 or any other recent kernels

Many Many thanks once again

0 Kudos

739 Views
fabio_estevam
NXP Employee
NXP Employee

The beauty of device tree is that you can easily add support for your I2C devices without having to write a single line of C code.

That's why I suggested you to use 3.11.

However if you really need to use 2.6.35 you can look at mx28evk board file:

linux-2.6-imx.git - Freescale i.MX Linux Tree

and check how sgtl5000 is registered in the i2c bus.

739 Views
srinivasanshanm
Contributor III

Hi,

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 soon as possible if any thing is missing

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 (drivers/misc/eeprom/at24.c)

==============================================

LOGS:

=======

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Linux version 2.6.35.3-571-gcca29a0 (user@user-desktop) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #2 PREEMPT Mon Sep 23 12:10:43 IST 2013

CPU: ARM926EJ-S revision 5 (ARMv5TEJ), cr=00053177

CPU: VIVT data cache, VIVT instruction cache

Machine: Freescale MX28EVK board

Memory policy: ECC disabled, Data cache writeback

Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512

Kernel command line: noinitrd root=/dev/nfs rw nfsroot=10.9.68.68:/tools/rootfs ip=10.9.67.6:10.9.68.68:10.9.67.1:255.255.255.0::eth0:off console=ttyAM0,115200n8

PID hash table entries: 512 (order: -1, 2048 bytes)

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

Memory: 128MB = 128MB total

Memory: 124316k/124316k available, 6756k reserved, 0K highmem

Virtual kernel memory layout:

vector : 0xffff0000 - 0xffff1000 ( 4 kB)

fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)

DMA : 0xfde00000 - 0xffe00000 ( 32 MB)

vmalloc : 0xc8800000 - 0xf0000000 ( 632 MB)

lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)

modules : 0xbf000000 - 0xc0000000 ( 16 MB)

.init : 0xc0008000 - 0xc0030000 ( 160 kB)

.text : 0xc0030000 - 0xc04f7000 (4892 kB)

.data : 0xc04f8000 - 0xc0535ba0 ( 247 kB)

SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Hierarchical RCU implementation.

RCU-based detection of stalled CPUs is disabled.

Verbose stalled-CPUs detection is disabled.

NR_IRQS:288

Console: colour dummy device 80x30

console enabled

Calibrating delay loop... 226.09 BogoMIPS (lpj=1130496)

pid_max: default: 32768 minimum: 301

Security Framework initialized

SELinux: Initializing.

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

regulator: core version 0.5

NET: Registered protocol family 16

regulator: vddd: 800 <--> 1575 mV at 1500 mV fast normal

regulator: vdddbo: 800 <--> 1575 mV fast normal

regulator: vdda: 1500 <--> 2275 mV at 1800 mV fast normal

vddio = 3380000, val=10

regulator: vddio: 2880 <--> 3680 mV at 3380 mV fast normal

regulator: overall_current: fast normal

regulator: vbus5v:

regulator: mxs-duart-1: fast normal

regulator: mxs-bl-1: fast normal

regulator: mxs-i2c-1: fast normal

regulator: mmc_ssp-1: fast normal

regulator: mmc_ssp-2: fast normal

regulator: charger-1: fast normal

regulator: power-test-1: fast normal

regulator: cpufreq-1: fast normal

INSIDEEEEEEEEEEEE mx28_pinctrl_init

i.MX IRAM pool: 124 KB@0xc8820000

1111 INSIDEEEEEEEEEEEE mx28_gpio_init

222 INSIDEEEEEEEEEEEE mx28evk_pins_init

3333 INSIDEEEEEEEEEEEE 3333 mx28evk_init_pin_groupppp

INSIDEEEEE gpio_request

0 Kudos