Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 6/27/2024 in #middleware-and-os
How can I initialize the I2C bus on the BeagleBone Black Rev C running Embedded Linux?
Hey guys, how can I initialize the I2C bus on the BeagleBone Black Rev C running Embedded Linux? I am getting the error Failed to open the bus: No such file or directory, but I have verified that the I2C module is loaded and checked the device tree overlay. Here are the steps I took to verify the I2C module: 1. Loaded the I2C module using modprobe i2c-dev. 2. Checked that the device tree overlay for I2C is applied correctly. The error occurs when attempting to open the I2C bus
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>

int main() {
int file;
char *bus = "/dev/i2c-1";
if ((file = open(bus, O_RDWR)) < 0) {
perror("Failed to open the bus");
return 1;
}
return 0;
}
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>

int main() {
int file;
char *bus = "/dev/i2c-1";
if ((file = open(bus, O_RDWR)) < 0) {
perror("Failed to open the bus");
return 1;
}
return 0;
}
9 replies