Reply by rickman February 14, 20062006-02-14
Vladimir Vassilevsky wrote:
> I see. All of the problems are because you are using Forth.
I appreciate the advice and now you have made me laugh! :-)
Reply by Vladimir Vassilevsky February 13, 20062006-02-13

rickman wrote:


> > Yes, I am sure this will work properly as long as you can set the data > output register to a 0. But the TI FAE seemed to think that you can't > write to the output register when it is in input mode. Do you get what > I am saying? If the output register defaults to a 1 at any time when I > switch it to output mode and I have to write a 0 to it after it is > driving, then it will be driving a 1 for a short time instead of a 0.
Not a problem if your device is I2C master and there is no other masters on the bus. You need to configure GPIO as the output only to drive the bus from "1" to "0" state. By the I2C diagram, you can drive the bus to "0" only if none of the slaves is holding the bus at "0". Thus it does not matter what is stored in the output register.
> This can create contention on the bus and potentially cause damage over > the long term. This will be going in military gear, so I don't want to > put in anything that may create a problem no matter how unlikely... you > know Murphy's law...
To be absolutely safe, put a diode and a pullup resistor.
> I know this is easy with a lot of other MCUs and DSPs (but then all the > other C55xx DSPs have I2C support too) but anyone done this with the > C5510?
I did it with BlackFin if it counts. There is a weirdness on the change of the pin direction with BlackFin also.
> How do you make sure that the output data register is a 0 when > you enable the pin output?
It does not have to be at "0". You can pull to "0" only if the bus is at "1". Thus the intermittent "1" is not going to conflict with anything.
> I guess I'll just have to get my hands on a DSK and try it. > > I want to have Forth running on the DSK and our hardware to help with > the debug and things like this, but I can't get the Forth vendor to > give me a price. I'll have to ping her again.
I see. All of the problems are because you are using Forth. Vladimir Vassilevsky DSP and Mixed-Up Signal Design Consultant http://www.abvolt.com
Reply by rickman February 13, 20062006-02-13
john wrote:
> Vladimir Vassilevsky wrote: > > Sure you can use GPIO for I2C. > > > > If you want to send '0' to the bus, you configure the pin as output. > > If you want to send '1' to the bus, you configure the pin as input. > > All you have to do is to change the pin direction on every transition. > > This simulates the open collector operation. I have done it that way > > with many microcontrollers and DSPs. Works just fine. > > > > Vladimir Vassilevsky > > > > DSP and Mixed-Up Signal Design Consultant > > > > http://www.abvolt.com > > > > > > > > > > rickman wrote: > > > > > I am looking to use the AIC31 codec with a TMS320C5510 and I have not > > > found much good info at ti.com on how to do this. Seems the 5510 is > > > the only member of the family without an I2C port built in. > > > > > > I was looking at bit banging the GPIO port to do this and I am not sure > > > you can make the port act like an open collector output. The data > > > sheet says the data register is for reading the input when in input > > > mode or you can write to it for the output mode. It is not clear if > > > you can write a 0 to the output register when still in input mode. If > > > not, it may be in the 1 state when the mode is set to output which > > > could cause a contention problem. > > > > > > I have asked my local FAE if the output data register can be written to > > > when the port is set for input mode and he didn't think it would work. > > > Anyone know if you can configure the GPIO port to work like an open > > > collector output? I don't have a DSK to try this on or I would. > > > > > I have done this using spare McBSP ports on the '5402 using Vladmir's > approach.
Yes, I am sure this will work properly as long as you can set the data output register to a 0. But the TI FAE seemed to think that you can't write to the output register when it is in input mode. Do you get what I am saying? If the output register defaults to a 1 at any time when I switch it to output mode and I have to write a 0 to it after it is driving, then it will be driving a 1 for a short time instead of a 0. This can create contention on the bus and potentially cause damage over the long term. This will be going in military gear, so I don't want to put in anything that may create a problem no matter how unlikely... you know Murphy's law... I know this is easy with a lot of other MCUs and DSPs (but then all the other C55xx DSPs have I2C support too) but anyone done this with the C5510? How do you make sure that the output data register is a 0 when you enable the pin output? I guess I'll just have to get my hands on a DSK and try it. I want to have Forth running on the DSK and our hardware to help with the debug and things like this, but I can't get the Forth vendor to give me a price. I'll have to ping her again.
Reply by john February 13, 20062006-02-13
Vladimir Vassilevsky wrote:
> Sure you can use GPIO for I2C. > > If you want to send '0' to the bus, you configure the pin as output. > If you want to send '1' to the bus, you configure the pin as input. > All you have to do is to change the pin direction on every transition. > This simulates the open collector operation. I have done it that way > with many microcontrollers and DSPs. Works just fine. > > Vladimir Vassilevsky > > DSP and Mixed-Up Signal Design Consultant > > http://www.abvolt.com > > > > > rickman wrote: > > > I am looking to use the AIC31 codec with a TMS320C5510 and I have not > > found much good info at ti.com on how to do this. Seems the 5510 is > > the only member of the family without an I2C port built in. > > > > I was looking at bit banging the GPIO port to do this and I am not sure > > you can make the port act like an open collector output. The data > > sheet says the data register is for reading the input when in input > > mode or you can write to it for the output mode. It is not clear if > > you can write a 0 to the output register when still in input mode. If > > not, it may be in the 1 state when the mode is set to output which > > could cause a contention problem. > > > > I have asked my local FAE if the output data register can be written to > > when the port is set for input mode and he didn't think it would work. > > Anyone know if you can configure the GPIO port to work like an open > > collector output? I don't have a DSK to try this on or I would. > >
I have done this using spare McBSP ports on the '5402 using Vladmir's approach. John
Reply by Randy Yates February 13, 20062006-02-13
Randy Yates <yates@ieee.org> writes:

> "rickman" <spamgoeshere4@yahoo.com> writes: >> [...] >> Anyone know if you can configure the GPIO port to work like an open >> collector output? > > I don't think you can. However, you might be able to play some trickery > like this with the XF pin, which can be either an input or an output.
Doh! See Vladimir's [correct] response and ignore this BS. GP I=Input O=Output. Hmmm... -- % Randy Yates % "Midnight, on the water... %% Fuquay-Varina, NC % I saw... the ocean's daughter." %%% 919-577-9882 % 'Can't Get It Out Of My Head' %%%% <yates@ieee.org> % *El Dorado*, Electric Light Orchestra http://home.earthlink.net/~yatescr
Reply by Vladimir Vassilevsky February 13, 20062006-02-13
Sure you can use GPIO for I2C.

If you want to send '0' to the bus, you configure the pin as output.
If you want to send '1' to the bus, you configure the pin as input.
All you have to do is to change the pin direction on every transition.
This simulates the open collector operation. I have done it that way 
with many microcontrollers and DSPs. Works just fine.

Vladimir Vassilevsky

DSP and Mixed-Up Signal Design Consultant

http://www.abvolt.com




rickman wrote:

> I am looking to use the AIC31 codec with a TMS320C5510 and I have not > found much good info at ti.com on how to do this. Seems the 5510 is > the only member of the family without an I2C port built in. > > I was looking at bit banging the GPIO port to do this and I am not sure > you can make the port act like an open collector output. The data > sheet says the data register is for reading the input when in input > mode or you can write to it for the output mode. It is not clear if > you can write a 0 to the output register when still in input mode. If > not, it may be in the 1 state when the mode is set to output which > could cause a contention problem. > > I have asked my local FAE if the output data register can be written to > when the port is set for input mode and he didn't think it would work. > Anyone know if you can configure the GPIO port to work like an open > collector output? I don't have a DSK to try this on or I would. >
Reply by Randy Yates February 13, 20062006-02-13
"rickman" <spamgoeshere4@yahoo.com> writes:
> [...] > Anyone know if you can configure the GPIO port to work like an open > collector output?
I don't think you can. However, you might be able to play some trickery like this with the XF pin, which can be either an input or an output. -- % Randy Yates % "Bird, on the wing, %% Fuquay-Varina, NC % goes floating by %%% 919-577-9882 % but there's a teardrop in his eye..." %%%% <yates@ieee.org> % 'One Summer Dream', *Face The Music*, ELO http://home.earthlink.net/~yatescr
Reply by rickman February 13, 20062006-02-13
I am looking to use the AIC31 codec with a TMS320C5510 and I have not
found much good info at ti.com on how to do this.  Seems the 5510 is
the only member of the family without an I2C port built in.

I was looking at bit banging the GPIO port to do this and I am not sure
you can make the port act like an open collector output.  The data
sheet says the data register is for reading the input when in input
mode or you can write to it for the output mode.  It is not clear if
you can write a 0 to the output register when still in input mode.  If
not, it may be in the 1 state when the mode is set to output which
could cause a contention problem.

I have asked my local FAE if the output data register can be written to
when the port is set for input mode and he didn't think it would work.
Anyone know if you can configure the GPIO port to work like an open
collector output?  I don't have a DSK to try this on or I would.