Using Pi as i2c slave device?


7 posts
by Echo5 » Fri Mar 08, 2013 8:41 pm
Greetings,

Can the Raspberry Pi be configured to run as an i2c slave device?

I want to setup the Pi using Wheezy to receive and save data sent by an i2c master device.

Does slave mode exist in any of the Python (Quick2Wire or python-smbus) or C++ i2c libraries? Are there any examples of how it can be implemented?

Thank you
Posts: 1
Joined: Fri Mar 08, 2013 8:34 pm
by abcabc » Fri Nov 15, 2013 3:11 am
I have searched for this also...

I'm using rpi and arduino with the smbus-package, no problem with rpi as master.
It's hard to find any real documentation about the smbus-package. Has anyone found any real documentation? Any other package?
It seems in the git-source-code that no slave functionality is included, but I'm not sure.
I can try to extend the smbus-package, but I want to check with you all first.
/abcabc
Posts: 7
Joined: Wed Mar 27, 2013 10:08 pm
by techpaul » Fri Nov 15, 2013 11:15 am
From memory the Linux driver does not support slave mode also I do not believe the slave functionality is available on the Pi.

I could be wrong but those are my recollections
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/
Posts: 1510
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
by msperl » Fri Nov 15, 2013 11:36 am
In principle there is support for BSC(=I2C like)/SPI slave in the HW (see page 160 in the peripherals document)

After quick scanning the pages, it seems it would require the use of:

  • GPIO18,19,20 and 21 for slave SPI
  • GPIO18 and 19 for slave I2C

But only GPIO 18 is available on the RPI, so there is not option for either I2C or SPI.

Why not trigger an interrupt on your device and implement polling on the RPI instead?

If that is no possibility, then maybe add an Arduino acting as a (proxy) slave to both sides?

Martin
Posts: 270
Joined: Thu Sep 20, 2012 3:40 pm
by abcabc » Fri Nov 15, 2013 3:41 pm
Thank you for your answer. The real problem for me was that it was annoying not to know, I have other solutions.
Posts: 7
Joined: Wed Mar 27, 2013 10:08 pm
by reachparagm » Fri Dec 19, 2014 11:31 am
abcabc,
I too have similar scenario. Did you get this to work ? Can you guide other on this ?
People on other forum mention of i2c BSC slave mode. Anybody got it to work ?
Posts: 1
Joined: Fri Dec 19, 2014 11:24 am
by joan » Fri Dec 19, 2014 12:42 pm
reachparagm wrote:abcabc,
I too have similar scenario. Did you get this to work ? Can you guide other on this ?
People on other forum mention of i2c BSC slave mode. Anybody got it to work ?

No one has written a driver to support I2C slave mode on the Pi, nor do I expect one ever to be written.
User avatar
Posts: 7489
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK