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.
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!
-----------------------------------------------------------------------------------------------------------------------
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.