ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

I2c device open failed

asked 2022-03-04 08:15:19 -0600

1024son gravatar image

updated 2022-03-08 02:43:27 -0600

Hi all,

I follow a tutorial in interfacing BNO055 sensor. It was connected to my Odroid C4 via SCL (pin 5) and SDA (pin 3) and also 3.3V & Gnd. Ran command sudo i2cdetect -r -y 0 returns shows the address to be 0x29.

Ran the launch file and errors showed up.

PARAMETERS * /imu/imu_node/address: 40 * /imu/imu_node/device: /dev/i2c-0 * /imu/imu_node/frame_id: imu * /rosdistro: noetic * /rosversion: 1.15.14

setting /run_id to 159765cc-9bc4-11ec-b5b8-001e06489d9b process[rosout-1]: started with pid [6737] started core service [/rosout] process[imu/imu_node-2]: started with pid [6744] terminate called after throwing an instance of 'std::runtime_error' what(): i2c device open failed

[imu/imu_node-2] process has died [pid 6744, exit code -6, cmd /home/odroid/catkin_ws/devel/lib/imu_bno055/bno055_i2c_node __name:=imu_node __log:=/home/odroid/.ros/log/159765cc-9bc4-11ec-b5b8-001e06489d9b/imu-imu_node-2.log].

log file: /home/odroid/.ros/log/159765cc-9bc4-11ec-b5b8-001e06489d9b/imu-imu_node-2*.log

I have already edited the launch file, changing the device path to /dev/i2c-0 and also the address to 0x29.

Thank you.

Answer: For i2c device open failed, run command sudo chmod 666 /dev/i2c-0

For incorrect chip id,Change the launch file address to <launch> <node ns="imu" name="imu_node" pkg="imu_bno055" type="bno055_i2c_node" respawn="true" respawn_delay="2"> <param name="device" type="string" value="/dev/i2c-0"/> <param name="address" type="int" value="41"/> <!-- 0x29 == 40 is the default for BNO055 --> <param name="frame_id" type="string" value="imu"/> </node> </launch>

*0x29 is 41 and 0x28 is 40

edit retag flag offensive close merge delete


anyone please?

1024son gravatar image 1024son  ( 2022-03-06 01:10:28 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2022-03-06 11:17:53 -0600

Mike Scheutzow gravatar image

The linux account you are using to run ROS probably does not have read-write permission for the device /dev/i2c-0. As a quick hack, you can issue this command:

sudo chmod 666 /dev/i2c-0

but this will need to be repeated if you reboot the machine.

The better thing to do is to create a udev rule which will change the permissions on this device each time the machine boots.

edit flag offensive delete link more


Thanks for replying. after running sudo chmod 666 /dev/i2c-0, the error message changes what(): i2c device open failed to what(): incorrect chip ID.

The full error: PARAMETERS * /imu/imu_node/address: 40 * /imu/imu_node/device: /dev/i2c-0 * /imu/imu_node/frame_id: imu * /rosdistro: noetic * /rosversion: 1.15.14

NODES /imu/ imu_node (imu_bno055/bno055_i2c_node)


process[imu/imu_node-1]: started with pid [4568] terminate called after throwing an instance of 'std::runtime_error' what(): incorrect chip ID

[imu/imu_node-1] process has died [pid 4568, exit code -6, cmd /home/odroid/catkin_ws/devel/lib/imu_bno055/bno055_i2c_node __name:=imu_node __log:=/home/odroid/.ros/log/dec645e4-9e44-11ec-bc5c-001e06489d9b/imu-imu_node-1.log].

log file: /home/odroid/.ros/log/dec645e4-9e44-11ec-bc5c-001e06489d9b/imu-imu_node-1*.log ^C[imu/imu_node-1] killing on exit shutting down processing monitor...

1024son gravatar image 1024son  ( 2022-03-07 12:33:08 -0600 )edit

decimal 40 is not equal to hex 0x29.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-03-07 17:51:31 -0600 )edit

Hi there, I missed out on that as I am still learning. I changed it to 41 and it seems to be working now when and there are values to be seen and changes when the sensor is being move when running rostopic echo /imu/data. Although rviz shows error for imu when subscribing imu to topic /imu/data. Thanks again.

1024son gravatar image 1024son  ( 2022-03-08 02:39:44 -0600 )edit

answered 2022-03-06 09:07:18 -0600

I might try opening a simple python program and trying to talk to it. Alternatively, if you have Arduino IDE installed on your Odroid C4(?never used that) you can open the example app for the BNO055.

That might give a clue. For example, if the 2nd method connects and communicates then you will know to focus on a linux configuration problem or a ROS configuration problem.

You say you have edited the address from 40 to 0x29 but you don’t show the error message from 0x29. That forces us to make guesses about what you are seeing…

edit flag offensive delete link more


Thank you for replying and will try out your method and update promptly. The error message however ends with what I have shown. The next line/chunk is simply showing the same thing as it is retrying.

1024son gravatar image 1024son  ( 2022-03-07 12:25:37 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-03-04 08:15:19 -0600

Seen: 293 times

Last updated: Mar 08 '22