reachparagm
Posts: 10
Joined: Fri Dec 19, 2014 11:24 am

bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 4:27 am

while working on some small project, i cam across below url on github.
https://github.com/hendric-git/bsc-slave

I am interested in trying the bsc-slave driver to make RPI as a smbus slave which can be slave mode and remote ends(another rpi) can transmit.
the setup will be a RPI back-2-back setup.

I tried contacting him/her, but did not get any response. This is dormant for a long time.

Has anyone tried this ? Is there any equivalent of bsc slave driver on RPi today ?
I posted this on beginners forum, but this seem to be a better place.

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 6:25 am

I deleted your duplicate post in the beginners section - please don't post the same question on multiple forums.
Thank you.
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
joan
Posts: 14089
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 7:31 am

Using the Pi in slave mode is only really practical for short (perhaps 16 bytes or so) messages.

See http://abyz.me.uk/rpi/pigpio/python.html#bsc_i2c for one method.

Refer to http://abyz.me.uk/rpi/pigpio/python.html#bsc_xfer for the wiring.

reachparagm
Posts: 10
Joined: Fri Dec 19, 2014 11:24 am

Re: bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 7:05 pm

Thanks Joan for responding.

I looked at the example of bsc_i2c and bsc_xfer. I have two RPI (rev2modelB and Rpi3b+).
example mentions of "This example assumes GPIO 2/3 are connected to GPIO 18/19". Do they need to be connected ?

For this I will be doing a write transaction (cmd) from one RPi to other RPi to respond with WR too. Hence a Slave environment.
Also do I need to use "pi.set_pull_up_down(SDA, pigpio.PUD_UP); pi.set_pull_up_down(SCL, pigpio.PUD_UP)" ?

Also, just for curiosity, will the receive data be a single i2c/smbus transaction or can loop to capture chunk ?

User avatar
joan
Posts: 14089
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 7:59 pm

The slave I2C bus is GPIO 18/19. I use 2/3 connected to 18/19 so I can more easily generate I2C data for the test script.

A Pi I2C bus needs SDA and SCL both pulled-up to 3V3. That is a requirement for the bus to work.

The master end decides on the protocol and sets things like start/stop conditions.

Also see http://abyz.me.uk/rpi/pigpio/examples.h ... arduino_py

reachparagm
Posts: 10
Joined: Fri Dec 19, 2014 11:24 am

Re: bsc-slave driver porting on raspbain.

Fri Aug 31, 2018 10:06 pm

Thanks. Is it possible to use 23/24 on my rev2modelB as discussed in https://www.raspberrypi.org/forums/view ... 67#p538846
to sniff on line for return data ?
Seem like I do not have 1K8 pullups and bread-board available.
I hope will not fry up GPIO. :roll: Is there any script to check if GPIO is failed ?

User avatar
joan
Posts: 14089
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: bsc-slave driver porting on raspbain.

Sat Sep 01, 2018 3:02 pm

You can sniff GPIO traffic on any lines you want.

The Pi will only act as an I2C slave on GPIO 18/19 (because they are the only GPIO supported by the BSC slave hardware).

You can enable the internal pulls. They may be enough to operate an I2C bus, certainly it's worth trying. You only need one set of pull-ups on the bus so perhaps the "other" end already has pull-ups.

wiringPi has a pintest utility, pigpio has the gpiotest utility.

For gpiotest see https://elinux.org/R-Pi_Troubleshooting#Testing

Return to “Advanced users”