i2c on BeagleBone

I'm hoping to interface via i2c to a Dallas 1-wire chip. I have some

Can I compile C code natively on board and get a linked object that
will run? I presently get undefined reference to `i2c_smbus_read_byte'
as if it's looking for a library somewhere.

Has anyone got a working example?



Hi Wayne,

In some 2.6.x.x kernel this and some similar inline functions were
removed from "i2c-dev.h". You can find them in older kernel versions
and simply append them to your i2c-dev.h. Also I saw a special driver
for Dallas in kernel configurator. It may simplify your task.
About compilation - I didn't ever compiled code on a board, but I
think it is possible: you need to install gcc (perhaps it is possible
via package manager) and just compile your code. As for me - I prefer
cross compiling.

Everything compiles fine. It fails at the link stage when trying to
find the routines.



You might be running into a conflict between kernel headers and i2c-
tools headers. There are 2 "i2c-dev.h" headers out there, one is
distributed with kernel and one is distributed with i2c-tools.

Without seeing some error message, I can't help you much. here's some
quick checks for you tho.

Assuming you are working on a kernel driver for your 1-wire chip, make
sure your Makefile is using the correct kernel source.
Assuming you are writing a user-space program, just make sure you are
not linking against the kernel file.

See "Documentation/i2c/dev-interface" in kernel tree for more details.