Problems interfacing to generic I2C device
Navigates to RoboticsConnection.com Home RoboticsConnection.com HomePage
RoboticsConnection User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Problems interfacing to generic I2C device Expand / Collapse
Author
Message
Posted Monday, April 21, 2008 12:10 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 3:19 PM
Posts: 11, Visits: 24
We are attempting to interface the Serializer to a Trinamic TMC222 stepper controller on a AVR card interface module using the I2C bus. I was getting no response from the C# routines, and verifying the protocol with a terminal interface returns <NACK> whenever a command is sent to read or write.

The device is factory programmed to address 0. So, to request a register read, I use the command:

i2c w 192 129

The same is true for a read command. Trying to read 9 bytes of register information like so:

i2c r 9

also results in a <NAK>. 

It did not appear that you were adding / deleting bits from the message, but trying different variations of the address byte, including setting the read/write bit would not return anything but a <NACK>.

Any insight would be appreciated.

Post #379
Posted Tuesday, April 22, 2008 9:29 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 3:19 PM
Posts: 11, Visits: 24
Correct me if I am wrong, but it would seem that I could send anything out the I2C buss, and the worst that would happen is I would get no response as the Serializer does not know what devices are connected. It simply marshalls the bits out the interface. Can anyone explain what causes the Serializer to return a <NACK> ?
Post #413
Posted Wednesday, April 23, 2008 8:00 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
If you get a NACK from the Serializer, then the command you sent it wasn't formatted correctly.  Thus, it doesn't understand what you're trying to tell it to do.

Double check the i2c command string you're sending it, and make sure it follows the protocol.  You can also attempt to post it here, and we can look at it.

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #419
Posted Wednesday, April 23, 2008 8:44 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 3:19 PM
Posts: 11, Visits: 24
Jason, thanks for the response.

Here are two commands that I think should work. First, I am writing a single byte command to the I2C device:

i2c w 193 129<cr>

Second, I am trying to read the 9 byte response from the same device

i2c r 192 9<cr>

Both commands return a <NACK>. Oddly, if I issue just a 'i2c r' or 'i2c w' command, I get an <ACK>. ALl other combinations return <NACK>.

Does the write command need to handshake with the device ?

Post #422
Posted Thursday, April 24, 2008 5:40 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 3:19 PM
Posts: 11, Visits: 24
Jason, any ideas ? I am pretty much dead in the water with this device.
Post #453
Posted Thursday, April 24, 2008 5:58 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
There must be a hidden character in there that you're sending that's causing the Serializer parsing logic to mis-understand the command.

The i2c command is pretty stable, and has worked on numerous devices, so I don't think there's a bug in the firmware.

You're not literally sending a "<cr>" sequence of characters, right?  If so, you should be sending a '\r' character or 0x0D.

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #454
Posted Thursday, April 24, 2008 8:37 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Thursday, June 26, 2008 3:19 PM
Posts: 11, Visits: 24
Jason,

I am typing the characters just as I described and the <cr> is simply a single return character (13). That is why I was wondering what circumstances would cause a <NACK> on every write command. If it is simply dumping bits on the bus, I should always get an <ACK>, assuming a properly formatted command.  If the serializer is expecting some response from the device that it is not getting, that would be the place to look.

Literally typing in the example commands from the manual always returns a <NACK> as well.

Too bad I can't get some sort of error code with the <NACK> to help isolate the problem. Any insight into how the Serializer implements the I2C protocol would be appreciated.

Post #457
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: jsummerour, ringo

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 10:37am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.172. 12 queries. Compression Disabled.