Page 4 of 7

Re: Custom I2C sensor problem

Posted: 17 Jan 2011, 23:47
by gloomyandy
Hi,
Do you have access to an oscilloscope by any chance? If so can you see what is happening on the clock and data lines? Is the LED also 3.3V?

Before starting to transmit the firmware checks that both the clock and data pins are high (which they should be because of the pull up resistors). When you measure the voltage on these pins what voltage do you see?

Andy

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 00:16
by aswin0
I don't have an oscilloscope at hand.

Th blinkM is on the same board, also on 3.3v

Before communication is established the SCL reads o.9v and the SDA reads 1.5. This is true for both devices (plugged in independently after each other.). After the connection is made the blinkM gives 2,6 and 1,5 respectively. I use 47K pull ups.

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 03:43
by mattallen37
aswin0 wrote:Before communication is established the SCL reads o.9v and the SDA reads 1.5. This is true for both devices (plugged in independently after each other.). After the connection is made the blinkM gives 2,6 and 1,5 respectively. I use 47K pull ups.
It looks like the problem could be your pullups/the NXT. According to the datasheet, .9v is the absolute minimum VIH. VIL max is .1v. The NXT has built in 4k7 resistors in series with IO 0 and 1, and it appears that it HAS pullups BUILT IN!!! According to the schematic, it HAS 82k pullups built into the NXT, that go to VCC_RS485 (I think 5v, or at least 4.x) on all 8 IO lines. If it really DOES, then you MUST use a voltage level shifter. Even if it doesn't, I don't think you will be able to use the IMU, unless you put the pullups BEHIND the built in protection resistors (4k7), otherwise, it will act as a voltage divider, and you won't end up with low enough voltages. As far as I can tell, because of the configuration of the resistors that are built into the NXT, according to the datasheets, it is impossible to make the two work together without a shifter.

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 10:14
by aswin0
mattallen37 wrote: It looks like the problem could be your pullups/the NXT. According to the datasheet, .9v is the absolute minimum VIH. VIL max is .1v. The NXT has built in 4k7 resistors in series with IO 0 and 1, and it appears that it HAS pullups BUILT IN!!! According to the schematic, it HAS 82k pullups built into the NXT, that go to VCC_RS485 (I think 5v, or at least 4.x) on all 8 IO lines. If it really DOES, then you MUST use a voltage level shifter. Even if it doesn't, I don't think you will be able to use the IMU, unless you put the pullups BEHIND the built in protection resistors (4k7), otherwise, it will act as a voltage divider, and you won't end up with low enough voltages. As far as I can tell, because of the configuration of the resistors that are built into the NXT, according to the datasheets, it is impossible to make the two work together without a shifter.
Matt,

Thanks for the reply. I have some questions/remarks though.

I have seen the schematics and understand why you conclude that there are 82K pull ups. I think however they are not used twhen using I2C. When I measure the IO lines of the NXT when they are not connected to a device I measure no power at all. I would expect this when they are used as pull ups. I do think these internal pull ups are only used when using high speed communication between to NXTs over port one. (although that does not explain why these pull ups are also found on the other sensor ports).

Another thing that I do not understand is about the protection resistors. If they work the way you state, why is it that the blinkM (when running on 3.3V) isn't bothered by these? Does it have to do with the internal resistance of the IMU or the blinkM? And if so could I use resistors to make the internal resistance of the IMU equal to that of blinkM?

Anyway, I do have a level shifter can easily experiment with it. When I use a level shifter, what kind of pull ups do I use on both sides of the shifter? 82K on the NXT side and 4.7K on the sensor side (this is what they mention in the datasheet of the sensor)?

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 10:21
by gloomyandy
Matt you need to take a closer look at the NXT schematic the 82K pull ups are marked as not mounted on the board (that's what the NM notation on the schematic means).

Aswin it sounds like for some reason you are not seeing the lines being pulled up to a high level when you use the IMU. You may want to experiment with lower value pull ups...

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 22:10
by aswin0
gloomyandy wrote: Aswin it sounds like for some reason you are not seeing the lines being pulled up to a high level when you use the IMU. You may want to experiment with lower value pull ups...
I just tried 10K , 47K and 82K pull ups. None work for the NXT. they all work for the bus pirate.

I also started working with the logic level converter (llc). Until now it only serves as a pull up for the blinkM that is now getting 4.8V. This does not work, I get the infamous -35 error. So I think the 10K pull ups on the llc must be replaced for a higher impedance.

But I sure wish I could measure high and low voltage levels on the I2C lines.

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 23:01
by mattallen37
aswin0 wrote:Matt,

Thanks for the reply. I have some questions/remarks though.

I have seen the schematics and understand why you conclude that there are 82K pull ups. I think however they are not used twhen using I2C. When I measure the IO lines of the NXT when they are not connected to a device I measure no power at all. I would expect this when they are used as pull ups. I do think these internal pull ups are only used when using high speed communication between to NXTs over port one. (although that does not explain why these pull ups are also found on the other sensor ports).
Well, as Andy said, they are not mounted in the NXT. Also it is port 4 (not 1) that is used for high speed (RS485).
aswin0 wrote:Another thing that I do not understand is about the protection resistors. If they work the way you state, why is it that the blinkM (when running on 3.3V) isn't bothered by these? Does it have to do with the internal resistance of the IMU or the blinkM? And if so could I use resistors to make the internal resistance of the IMU equal to that of blinkM?
I looked at the blinkM datasheet, and it looks like it is supposed to be 5v, not 3.3v. Anyhow, I didn't see VIL for it, but if you are using 47k up to 3.3v for the blinkM, and it works, VIL must be at least 0.3v (vs. 0.1 for the IMU).
aswin0 wrote:Anyway, I do have a level shifter can easily experiment with it. When I use a level shifter, what kind of pull ups do I use on both sides of the shifter? 82K on the NXT side and 4.7K on the sensor side (this is what they mention in the datasheet of the sensor)?
Look up the datasheet, and find out what VIL is for the level shifter. To use 82k pullups on 5v lines (4.3-4.7), VIL needs to be at least 0.3v or so. On the other side (3.3v), use whatever they suggest, as the pullups are isolated from the NXT, so it would be the same as using an Arduino or other Ucontroller.

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 23:04
by mattallen37
gloomyandy wrote:Matt you need to take a closer look at the NXT schematic the 82K pull ups are marked as not mounted on the board (that's what the NM notation on the schematic means)...
Ok, sorry, I had no idea that is what NM meant. Thanks fer letting me know.

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 23:06
by mattallen37
aswin0 wrote:I just tried 10K , 47K and 82K pull ups. None work for the NXT. they all work for the bus pirate.
That is likely because the bus pirate doesn't (to my knowledge) have 4k7 resistors in series with it's IO lines acting like voltage dividers...

Re: Custom I2C sensor problem

Posted: 18 Jan 2011, 23:12
by gloomyandy
Aswin quick question. What voltage are the clock and data lines at if you have the IMU powered up, with the pull-ups connected but with neither the NXT or the bus pirate connected to them?

Andy