Changing nxtCAM I²C address

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

Changing nxtCAM I²C address

Postby XTinX » Thu Aug 20, 2009 2:35 pm

Hi everyone,

as I want to plug more than 4 sensors on my nxt brick I've changed the i2c of my nxtcam from 0x02 to 0x04. The problem is I didn't achieve to find the sensor attribute corresponding to the i2c address. I noticed the attribute "address" in the I2CSensor class but the default value is 1, not 2 (so I'm not sure it's the same thing)

So what should I modify ?

Thx
XTinX
New User
 
Posts: 11
Joined: Thu Aug 20, 2009 2:29 pm

Postby XTinX » Thu Aug 20, 2009 2:41 pm

Sorry, I've just seen the "changeAddress" method. But anyway I still don't understand why the default address is 0x01 and not 0x02 ... Can someone help me ?

Thx
XTinX
New User
 
Posts: 11
Joined: Thu Aug 20, 2009 2:29 pm

Postby gloomyandy » Thu Aug 20, 2009 3:05 pm

That's because 1 and 2 are actually the same. The problem is how you interpret the number. In the i2c specification i2c addresses go from 1 to 0x7f. However when they are sent over the connection the address is left shifted by 1 and the bottom bit is used to indicate if the request is a read or a write. Because of this some people use the on the wire address range of 2 to 0xff (with odd numbered values not allowed) as the i2c address range (so they use the address after it has been shifted left and with the low bit always set to 0). leJOS uses the i2c standard way, many Lego related docs use the on the wire way. So address 1 in leJOS is the same as 2 on the wire...

Andy

PS How did you change the i2c address used by your nxtcam?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby XTinX » Thu Aug 20, 2009 3:27 pm

thank you very much for the tip.

I changed the address of my cam using the nxt executable file made by mindsensors :

http://www.mindsensors.com/index.php?mo ... ment_id=91

You just need to flash the nxt with the original firmware !

So if I changed the address from 0x02 to 0x04 with that software (that means with the wire value) then the correct address in lejos is 2 right ?
XTinX
New User
 
Posts: 11
Joined: Thu Aug 20, 2009 2:29 pm

Postby gloomyandy » Thu Aug 20, 2009 3:38 pm

Yes the address will be 2 under leJOS. You may want to take a look at this thread...
http://lejos.sourceforge.net/forum/viewtopic.php?t=1636

Another user has reported problems with getting the changed address to stick. So you may want to make sure that you can use the new address (after power on/off of the nxt), from the Lego environment, I think that mindsensors supply a program that will scan for a device and report the address...

Please report back and let us know how you get on with this, as other users would find the information of use...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby XTinX » Fri Aug 21, 2009 8:42 am

I used a mindsensor program nammed like "device explorer" and I could see my nxtcam with the new 0x04 address.

However, I was programming with robotc c and the robot c source file of change address didn't work. So I uploaded back the lego firmware and ran the rxe file directly from the nxt. (robotc is really not reliable).
XTinX
New User
 
Posts: 11
Joined: Thu Aug 20, 2009 2:29 pm

Postby gloomyandy » Fri Aug 21, 2009 10:53 am

Thanks for the update....
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Changing nxtCAM I²C address

Postby nxtfan » Sat Jul 07, 2012 1:29 pm

Hi,

I tried to change the i2c address of my ultrasonic sensors using the two rxe files provided by Mindsensor but had no success... Anyone knows why? Thanks a lot.

Best,
Dennis
nxtfan
New User
 
Posts: 11
Joined: Sat Jun 09, 2012 10:36 am

Re: Changing nxtCAM I²C address

Postby kirkpthompson » Sat Jul 07, 2012 5:16 pm

The Ultrasonic sensors are not made by mind sensors and don't support having their address changed.

-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 282
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff