Hey Forum
I hope you can help me. I’m on a education project and I have some questions.
I have a problem with the config of the GPIO (I2C-HW-Controller)
I have two diffrent usecases in my project.
- I2C HW-Controller #1 is a master
- I2C HW-Controller #1 is a slave
So I have to change the I2C-controller config between the master and the slave mode.
If it is possible, I should do that while the BBB and his phyton/c++ program is running.
Now here are my questions:
If its possible give my a nice explanation and not only a code piece. 
I have to learn & understand how all that stuff works.
Thanks a lot
Hey Forum
I hope you can help me. I’m on a education project and I have some questions.
I have a problem with the config of the GPIO (I2C-HW-Controller)
I have two diffrent usecases in my project.
- I2C HW-Controller #1 is a master
- I2C HW-Controller #1 is a slave
So I have to change the I2C-controller config between the master and the slave mode.
If it is possible, I should do that while the BBB and his phyton/c++ program is running.
Now here are my questions:
If its possible give my a nice explanation and not only a code piece. 
I have to learn & understand how all that stuff works.
Linux does not support slave mode for either I2C or SPI. Even though the BBB hardware can support SCL being generated on another device, the Linux I2C driver does not support this. Either you have to create your own I2C slave driver or you can do this with the PRU.
Regards,
John
From: <david.berger95@gmail.com>
Reply-To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
Date: Friday, September 12, 2014 at 3:50 AM
To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
Subject: [beagleboard] How to change GPIO Mode
> Hey Forum
> I hope you can help me. I'm on a education project and I have some
> questions.
>
> I have a problem with the config of the GPIO (I2C-HW-Controller)
>
> I have two diffrent usecases in my project.
> 1. I2C HW-Controller #1 is a master
> 2. I2C HW-Controller #1 is a slave
> So I have to change the I2C-controller config between the master and the
> slave mode.
> If it is possible, I should do that while the BBB and his phyton/c++
> program is running.
>
> Now here are my questions:
> * How can I switch between I2C master and slave mode? (Device tree?)
> *
> * Can I do that while the BBB is running? (Or is a reboot of BBB
> necessary?) If its possible give my a nice explanation and not only a
> code piece.
I have to learn & understand how all that stuff works.
Linux does not support slave mode for either I2C or SPI. Even though the BBB
hardware can support SCL being generated on another device, the Linux I2C
driver does not support this. Either you have to create your own I2C slave
driver or you can do this with the PRU.
Currently that is true, but I noticed some code being proposed on one of the
kernel lists to enable this. So shortly (i.e a kernel release or two) it will
be possible - assuming the code gets accepted.
On the subject of the PRU and its use of I2C, is there any sample code around
that shows this being done?
David
From: <david.berger95@gmail.com>
Reply-To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
Date: Friday, September 12, 2014 at 3:50 AM
To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
Subject: [beagleboard] How to change GPIO Mode
> Hey Forum
> I hope you can help me. I'm on a education project and I have some
> questions.
>
> I have a problem with the config of the GPIO (I2C-HW-Controller)
>
> I have two diffrent usecases in my project.
> 1. I2C HW-Controller #1 is a master
> 2. I2C HW-Controller #1 is a slave
> So I have to change the I2C-controller config between the master and
the
> slave mode.
> If it is possible, I should do that while the BBB and his phyton/c++
> program is running.
>
> Now here are my questions:
> * How can I switch between I2C master and slave mode? (Device tree?)
> *
> * Can I do that while the BBB is running? (Or is a reboot of BBB
> necessary?) If its possible give my a nice explanation and not only a
> code piece.
I have to learn & understand how all that stuff works.
Linux does not support slave mode for either I2C or SPI. Even though
the BBB
hardware can support SCL being generated on another device, the Linux
I2C
driver does not support this. Either you have to create your own I2C
slave
driver or you can do this with the PRU.
Currently that is true, but I noticed some code being proposed on one of
the
kernel lists to enable this. So shortly (i.e a kernel release or two) it
will
be possible - assuming the code gets accepted.
You are correct, but I only see work being done on the I2C slave framework:
https://lkml.org/lkml/2014/9/12/125
I don¹t see any work being done on a SPI slave framework.
On the subject of the PRU and its use of I2C, is there any sample code
around
that shows this being done?
The only reference I¹ve seen is a bit banger driver using the PRU:
https://github.com/mcdonamp/RH_ROBO_Quadcopter/tree/master/code/i2c_bitbang
/pru_sw
Regards,
John
>> From: <david.berger95@gmail.com>
>> Reply-To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
>> Date: Friday, September 12, 2014 at 3:50 AM
>> To: "beagleboard@googlegroups.com" <beagleboard@googlegroups.com>
>> Subject: [beagleboard] How to change GPIO Mode
>>
>> > Hey Forum
>> > I hope you can help me. I'm on a education project and I have some
>> > questions.
>> >
>> > I have a problem with the config of the GPIO (I2C-HW-Controller)
>> >
>> > I have two diffrent usecases in my project.
>> > 1. I2C HW-Controller #1 is a master
>> > 2. I2C HW-Controller #1 is a slave
>> > So I have to change the I2C-controller config between the master and
>>
>>the
>>
>> > slave mode.
>> > If it is possible, I should do that while the BBB and his phyton/c++
>> > program is running.
>> >
>> > Now here are my questions:
>> > * How can I switch between I2C master and slave mode? (Device tree?)
>> > *
>> > * Can I do that while the BBB is running? (Or is a reboot of BBB
>> > necessary?) If its possible give my a nice explanation and not only a
>> > code piece.
I have to learn & understand how all that stuff works.
>>
>> Linux does not support slave mode for either I2C or SPI. Even though
>>
>>the BBB
>>
>> hardware can support SCL being generated on another device, the Linux
>>
>>I2C
>>
>> driver does not support this. Either you have to create your own I2C
>>
>>slave
>>
>> driver or you can do this with the PRU.
>
>Currently that is true, but I noticed some code being proposed on one of
>the
>kernel lists to enable this. So shortly (i.e a kernel release or two) it
>will
>be possible - assuming the code gets accepted.
You are correct, but I only see work being done on the I2C slave framework:
https://lkml.org/lkml/2014/9/12/125
I don¹t see any work being done on a SPI slave framework.
True
>On the subject of the PRU and its use of I2C, is there any sample code
>around
>that shows this being done?
The only reference I¹ve seen is a bit banger driver using the PRU:
https://github.com/mcdonamp/RH_ROBO_Quadcopter/tree/master/code/i2c_bitbang
/pru_sw
There is reference to two I2C ports in the global table, but I am unclear as
to how to use them. An example from TI would be nice.
David