-2

I am developing on a HummingBoard Pro (Armbian).

I want to talk with a peripheral using I2C. I read the datasheet and found that it provides datastream at the address 0xff. So I wrote a tool that periodically checks if data is available and prints it.

  • Is this a driver?
  • If it is a driver should it run in user space as the other programs?
  • Is there an alternative method (in order to avoid polling the peripheral)?
Fzza
  • 105
  • 1
  • 9
  • Which platform you are using ? Which processor,which OS? – Vagish Nov 27 '17 at 11:10
  • https://www.solid-run.com/product/hummingboard-pro-imx6s-wa-h/ Armbian Why this matter? – Fzza Nov 27 '17 at 11:12
  • 1
    It matters because you use terms that are only relevant in Linux programming, but do not mention anywhere in your question that you are using Linux. While most systems using I2C are micocontroller applications that use bare metal or RTOS. – Lundin Nov 27 '17 at 11:56
  • thanks.. I run top it uses 10% of cpu. Is because it run in user space? Should i move it in kernel space in some way? – Fzza Nov 28 '17 at 14:13

1 Answers1

1

First you are going to need to add your peripheral to the Linux device tree so that your Linux system knows it is there. I did a similar application with a Zynq 7000 Processing System. This is assuming your architecture allows your processor to speak directly with peripherals using Linux. http://www.wiki.xilinx.com/Linux+I2C+Driver

This is the Xilinx resource. It has an example of adding an i2c device to the device tree to access using the Cadence I2C driver. The Cadence I2C driver is used on a number of platforms. You should check for the Humming Bird Pro driver compatibility.

I assume you want to use the Linux I2C device interface. This is the approach I used and I assume it is the simplest. I would suggest you look at this to get an idea for what is involved on the software side. http://rts.lab.asu.edu/web_438/CSE438_598_slides_yhlee/438_6_Linux_I2C_SMBus.pdf

I will assume you know the difference between the user space and the kernel space and how to use device drivers in user space applications. If not, I would suggest you take a look at these Xilinx resources that I think do an excellent job of covering the topic for embedded software designers. https://forums.xilinx.com/xlnx/attachments/xlnx/ELINUX/10657/2/drivers-session3-uio-4public.pdf

John Frye
  • 255
  • 6
  • 22