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?

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?

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.

Who is online

Users browsing this forum: No registered users and 2 guests

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