Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: perl to I2C

by GrandFather (Saint)
on Mar 22, 2023 at 20:13 UTC ( [id://11151137]=note: print w/replies, xml ) Need Help??


in reply to perl to I2C

I2C is a hardware thing and is not standardly available on desktop (including laptop) style computers. There are all sorts of "dongles" that can provide I2C interfaces via USB, but there is no standardization for managing such devices.

That said, CPAN offers many I2C related modules, but most are targeted at very specific hardware. If your application happens to involve one of those technologies then you may be in luck. If you describe your application and hardware we may be able to help more.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^2: perl to I2C
by afoken (Chancellor) on Mar 22, 2023 at 21:46 UTC
    I2C is a hardware thing and is not standardly available on desktop (including laptop) style computers.

    It is available on most Desktops and Laptops, but most people do not know. If your computer supports EDID (monitor detection), it uses I²C (see DDC2). It is available on most VGA connectors (pins 12 and 15), on all HDMI connectors (pins 15 and 16) , on all DVI Ports (pins 6 and 7) - but not on DisplayPort connectors. How? Your monitor contains a tiny I²C EEPROM (or some hardware that emulates that EEPROM) with information about the monitor. And the graphic adapter uses I²C on the two pins to read that EEPROM.

    Yes, that I²C port is a little bit hard to use, as you need some cooperation from the graphics card, but it is I²C. At least for Linux, there are some driver hacks to make the I²C port on the graphics card usable for any I²C device.

    I²C can also be used in laptops for HID devices, typically for keyboard and/or touchpad or trackpoint. That's almost completely transparent, because the chipset and/or the drivers hide that interface.

    Furthermore, SMbus, used to detect RAM modules, to control fans, to talk with laptop batteries, and to measure temperature and voltages, is also an I²C bus with slightly stricter rules and some extended features.


    Some FDTI USB to RS232 chips (e.g. FT232H) can also be repurposed to talk SPI or I²C, using the official FTDI drivers.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Sure, but that is all "under the hood" stuff. If that were what the OP were interested in it's highly likely the OP would already have the chops to provide their own answer. The one terse sentence we got from the OP points more toward controlling an I²C based device from a Windows computer than manipulating internal I²C devices.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
        The one terse sentence we got from the OP points more toward controlling an I²C based device from a Windows computer than manipulating internal I²C devices.

        That's what a FT232H based board could do.

        Also, a coworker got a recommendation to use https://spidriver.com/ to test third party SPI hardware by the maker of that hardware. It is open source hardware and software, with a repo at https://github.com/jamesbowman/spidriver. That device has two "sister devices" that speaks I²C instead of SPI: https://i2cdriver.com/, https://i2cdriver.com/mini.html, repo at https://github.com/jamesbowman/i2cdriver. There are no Perl modules yet, but if C and python can talk to the driver hardware via a simple (USB virtual) serial port, Perl should be able to do so, too. At least the serial port part is already done in Device::SerialPort and Win32::SerialPort, so all that's left to do is to stuff the right bytes into the serial port and pull out some other bytes.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11151137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-20 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found