View unanswered posts | View active topics It is currently Sat Oct 25, 2014 10:59 pm






Reply to topic  [ 4 posts ] 
Clock Stretching Allowed in I2C? 
Author Message
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post Clock Stretching Allowed in I2C?
Hello Everyone,

I have a question, Im helping someone program a custom I2C devise and am having problems reading bytes back from the device using the Test I2C terminal. We can write to the device and it responds correctly, its only when we try to read back that we get a buss error. We know the device is holding the clock line low while it processes information, does anyone know if RobotC allows the slave to hold the clock line low?

Any info would be great, thanks again B-)
Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Tue Jul 21, 2009 5:41 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3227
Location: Rotterdam, The Netherlands
Post Re: Clock Stretching Allowed in I2C?
Scott,

I have no experience with clock stretching sensors but I know that quite a lot of drivers/implementations that I've come across have issues with it. It would be useful to have as a feature. Perhaps one of the devs can answer this?

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Wed Jul 22, 2009 1:18 am
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post Re: Clock Stretching Allowed in I2C?
Ill have to pester Dick then ;-).

Scott B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Wed Jul 22, 2009 2:50 am
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post Re: Clock Stretching Allowed in I2C?
Dick emailed this to me:

Quote:
No. Not possible with the NXT. It is not a "true" I2C implementation.

In standards compliant I2c, the clock line is "open collector" (a hardware term) which allows the I2C master to send clock pulses but it also allows the I2C slave to pull the line low (i.e. "your clock stretching") to delay the I2C transaction. Unfortunately, this is not the implementation on the NXT.
· Clock line is a digital output line that is either high or low. It is not open collector.
· NXT firmware does not check for “clock stretching”.
· NXT has a series resistor and a pullup resistor on the I2C clock and data lines. This is for protecting the NXT against static electricity and other bad things if someone puts the wrong signals into the sensor port. Unfortunately, the end result is that the NXT sensor I2C is slower than the I2C specification standard.

It is possible to setup an output line on the NXT as Open Collector. I tried this a few years back and found that none of the NXT’s I2C sensors would work with it.

Standard NXT firmware uses a a clock signal around 10KHz. ROBOTC has some options to work faster but you can configure for the slow mode.

So, unfortunately no way to stall the transaction like you’ve described below.

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Wed Jul 29, 2009 3:09 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.