I.MX6 I2C Master Bus set to Slave

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I.MX6 I2C Master Bus set to Slave

2,579件の閲覧回数
michaelbukanon
Contributor I

Hi,

i'm working with the Freescale SABRE Platform for Smart Devices (I.MX6).

is it possible to set the I2C-2 Bus to slave and give him a new "slave-address".

I want to connect a new extern master and write in a register to read it later.

is that even possible?

salut!

ラベル(3)
0 件の賞賛
返信
4 返答(返信)

1,189件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Michael

I believe this is possible, one can look at mxc_i2c_slave_test example

in imx-test package

http://repository.timesys.com/buildsources/i/imx-test/imx-test-3.14.28-1.0.0/

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,189件の閲覧回数
michaelbukanon
Contributor I

Hi,

first, thanks for your help.

I test the example, but thats only for testing connected devices?

How can i set the Master-Bus to slave?

salut!

0 件の賞賛
返信

1,189件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

I believe it is performed in main(), see attached mxc_i2c_slave_test.c

..

fd = open(I2C_MASTER_DEV, O_RDWR);

    if (fd < 0) {

printf("i2c-slave-test:master thread:open device error\n");
goto fail;

    }

    ret = ioctl(fd, I2C_SLAVE_FORCE, I2C_SLAVE_ADDR);

    if (ret < 0) {

printf("i2c-slave-test:master thread:ioctl error\n");
goto fail;

    }

    pthread_create(&slave_thread_id, 0, slave_thread, (void *)0);

....

~igor

0 件の賞賛
返信

1,189件の閲覧回数
michaelbukanon
Contributor I

i got this:

root@imx6qsabresd:/unit_tests# ./mxc_i2c_slave_test.out

i2c-slave-test:open device error

i2c-slave-test: slave thread: Fail

i2c-slave-test:master thread:about to receive 100 bytes

i2c-slave-test:master thread: read error

i2c-slave-test:master thread: Fail

the mxc_i2c_slave_test is unchanged.

where is my fault?

salut!

0 件の賞賛
返信