i2c communication issues with mpc83xx

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

i2c communication issues with mpc83xx

1,092 次查看
garimella
Contributor I

I have a custom board using mpc83xx processor with i2c interface working very well from uboot. But I fail to access the i2c device when I tried to write small program. Following is by psuedo code.

/*Accessing i2c1 bus a master to transmit data*/

volatile unsigned char  *freq= (volatile unsigned char*)0xe0003004

volatile unsigned char  *ctrl= (volatile unsigned char*)0xe0003008

volatile unsigned char  *status= (volatile unsigned char*)0xe000300c

volatile unsigned char  *data= (volatile unsigned char*)0xe0003010

main()

{

*freq =0x01; 

*ctrl= 0xf8; //start

*data =0x50; // transmit slave address

printf("status is %x\n",*status);

*data = 0x00;// transmit reg address

*data= 0x01;

*data = 0x55;// transmit data

*ctrl = 0x00;//stop

}

result: no data update in the memory and status reg displays 0x81. 

Please advice.

标记 (1)
0 项奖励
回复
2 回复数

979 次查看
Pavel
NXP Employee
NXP Employee

Look at attached file. It is a I2C program example.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

979 次查看
garimella
Contributor I

Hi Pavel

That solved the problem for I2C. But I have another question. MPC83xx custom board has two ethernet ports. How do I access the 2nd lan port from Linux? I am able to transmit and receive from port 1.

0 项奖励
回复