I have a Xavier with Jetpack 4.1.1, and I’m trying to use the Jetsonhacks driver for the Adafruit I2c servo interface:
I’ve installed the I2C tools with the command “sudo apt-get install libi2c-dev i2c-tools” as per their instructions, and the interface board is properly detected under i2cdetect. But when I attempt to compile their example code, I get the error:
g++ servoExample.cpp ../src/JHPWMPCA9685.cpp -I../src -o servoExample
../src/JHPWMPCA9685.cpp: In member function ‘int PCA9685::readByte(int)’:
../src/JHPWMPCA9685.cpp:86:20: error: ‘i2c_smbus_read_byte_data’ was not declared in this scope
int toReturn = i2c_smbus_read_byte_data(kI2CFileDescriptor, readRegister);
^~~~~~~~~~~~~~~~~~~~~~~~
../src/JHPWMPCA9685.cpp:86:20: note: suggested alternative: ‘i2c_smbus_ioctl_data’
int toReturn = i2c_smbus_read_byte_data(kI2CFileDescriptor, readRegister);
^~~~~~~~~~~~~~~~~~~~~~~~
i2c_smbus_ioctl_data
../src/JHPWMPCA9685.cpp: In member function ‘int PCA9685::writeByte(int, int)’:
../src/JHPWMPCA9685.cpp:101:20: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
int toReturn = i2c_smbus_write_byte_data(kI2CFileDescriptor, writeRegister, writeValue);
^~~~~~~~~~~~~~~~~~~~~~~~~
../src/JHPWMPCA9685.cpp:101:20: note: suggested alternative: ‘i2c_smbus_ioctl_data’
int toReturn = i2c_smbus_write_byte_data(kI2CFileDescriptor, writeRegister, writeValue);
^~~~~~~~~~~~~~~~~~~~~~~~~
i2c_smbus_ioctl_data
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1
Does anyone know what’s going on here? In my attempts at researching this error, I’ve found a number of suggestions to include i2c-dev.h from i2c-tools instead of the kernel (which was never a problem in the Jetsonhacks I2C tutorials). If that’s what I need to do, does anyone know how to actually do that?
Thank you.
t