You are not logged in.

#1 2018-10-04 03:55:51

beansandrice
Member
Registered: 2018-09-30
Posts: 3

[SOLVED] Interfacing i2c on the parallel port: i2c-parport & i2c-tools

Greetings! Typically between the wiki, IRC channel, and the forum content everything I have beem curious of has been well documented. Thank you all for participating in the community. Recently, however, I've tread into sparsely documented territory.

Onwards with my topic. Lately I have found myself super interested in embedded devices and learning how to communicate with them. Specifically, the i2c protocol for it's low cost and minimal hardware requirements. (Just a printer port and an interface.)

General procedure is to load the i2c-parport kernel module and then use the i2c-tools suite on the bus provided by the module.

However when I

 # modprobe i2c-parport type=7
 # i2cdetect /sys/bus/parport/devices/i2c-parport.0

From i2cdetect I am returned an:
"Error: I2C bus name does not match any bus present"

Some questions:
1. Is /sys/bus/parport/devices/i2c-parport.0 the bus I am a seeking to interface with? Or is there another path I should give to i2cdetect?

2. Where is i2cdetect present? In other words, what path does it follow that it does not find the i2c-parport.0 bus?

Last edited by beansandrice (2018-10-06 02:53:22)

Offline

#2 2018-10-04 04:11:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: [SOLVED] Interfacing i2c on the parallel port: i2c-parport & i2c-tools

From the man page, it doesn't look like you are supposed to use the full path to a sysfs node, but rather just the name, you can get a list of the available names from `i2cdetect -l`.  Have you checked the list output?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-10-04 04:23:03

beansandrice
Member
Registered: 2018-09-30
Posts: 3

Re: [SOLVED] Interfacing i2c on the parallel port: i2c-parport & i2c-tools

Indeed, the plot thickens...

 # i2cdetect -l
 #

There is no output from this command.

10/4/18 EDIT: I thought about this all day at work and tried again when I got home.

 # i2cdetect 0
 Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0'" No such file or directory

It seems I have found an answer to one of my original questions of where i2cdetect was looking. In doing so, it has lead me to the next question of how to I put the bus created by i2c-parport into the path it is searching.

I wonder if this is a time when ln would be useful.

 # mkdir /dev/i2c
 # cd /dev/i2c
 # ln -T /dev/parport0 0 
 # i2cdetect 0
 Error: Could not get adapter functionality matrix: Invalid argument

I am getting closer, got to find this adapter functionality matrix.

10/5/18 EDIT:

Still at it today! I have been searching around on the internet and found that I may have to use udev to create a device file for i2cdetect

Last edited by beansandrice (2018-10-06 00:25:36)

Offline

#4 2018-10-06 03:10:38

beansandrice
Member
Registered: 2018-09-30
Posts: 3

Re: [SOLVED] Interfacing i2c on the parallel port: i2c-parport & i2c-tools

It can be a challenge to get some things working without formal training. There is good literature at kernel.org

Solution:

 # modprobe i2c-dev
 # modprobe i2c-parport type=3
 # i2cdetect 14
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-14.
I will probe address range 0x03-0x77.
Continue? [Y/n]

I2C devices, typically controlled by kernel drivers, can be made available in userland at the /dev interface by loading the i2c-dev module. Loading the i2c-parport module will ONLY make the parallel port accessible as an i2c device in kernelspace. It is the i2c-dev module that gives userland access.

Last edited by beansandrice (2018-10-06 03:40:49)

Offline

Board footer

Powered by FluxBB