I2C programming using cross compile tool-chain

Hi guys!

I received my DragonBoard410C a few days ago, following the guide LinuxUserGuide I installed Linux and also programmed the 3 applications successfully. At the moment I know how to use the user LEDs and the GPIOs.

Now I would like to use the I2C. Where I can find documentation to make a program for I2C peripheral in the same way (programming in a host PC with my IDE and the cross compile tool-chain) as I did for LED and GPIOs? I mean, I would like to understand the files of the different peripherals (allocated in /sys/class) in order to create programs for interface with SPI, I2C, etc… devices

I have taken a look at the Qualcomm document: Peripherals Programming Guide Linux Android from the developer Qualcomm web page. But i find it’s a different way of programming these peripherals. Am I right?

So I would find so helpful documentation explaining how to use the low-speed port SPI, I2C, UART, etc…

Thank you so much guys!


You want to create a user-space I2C device driver.
Kernel exposes i2c adapters/devices to user via device files in /dev/i2c-*.

The first step is to have a look at https://www.kernel.org/doc/Documentation/i2c/dev-interface

1 Like

Thank you @Loic, that’s exactly what I need! I’m totally new with Linux, and I don’t have so much of the needed concepts (I have just bought “Embedded Linux primer” and I hope this book helps me), but now, referring to questions like this, I know where I can get the info → Index of /doc/Documentation/.

I prefer to keep the post opened in case I had any doubt more related to this question.