Code Monkey home page Code Monkey logo

Comments (15)

mbenkmann avatar mbenkmann commented on May 13, 2024 2

I'm seriously looking into working on this. Has anyone else started on this? I'm still looking for the best option. I think I will try a CUSE solution first.
@kornpow You said you looked into CUSE. How far did you get? I'm at the point where I've googled it and am looking at the top search results. Did you get further into the topic?

from i2cdriver.

mbenkmann avatar mbenkmann commented on May 13, 2024 1

Maybe a firmware for i2cdriver could be developed that is compatible with the simple device supported by this Linux driver:

/usr/src/linux/drivers/i2c/busses/i2c-tiny-usb.c

which is for this device

https://github.com/harbaum/I2C-Tiny-USB

from i2cdriver.

mbenkmann avatar mbenkmann commented on May 13, 2024 1

Okay. I've implemented the CUSE-based solution. You can find it here:

https://github.com/mbenkmann/i2cdriver/tree/master/c/linux

The program also includes a more powerful command line interface to all other features of the i2cdriver, so if you're on Linux this should be an all around better replacement for the bare bones i2ccl utility.

So far I've only implemented the pure i2c ioctls that are used e.g. by i2ctransfer(8) and stm32flash(1) but it's easy to add the SMBus-related stuff, too, so if you have a concrete need for it, open an issue.

from i2cdriver.

codehero avatar codehero commented on May 13, 2024

You could take a stab at writing a CUSE driver

from i2cdriver.

jamesbowman avatar jamesbowman commented on May 13, 2024

Looking around, it seems that CUSE is not very actively developed.

from i2cdriver.

kornpow avatar kornpow commented on May 13, 2024

Thanks, I also briefly looked into CUSE to see what it would take. I'm a little ways off before I can devote some time to this, but I'm definitely very interested so I hope to get a chance to take a stab at it.

from i2cdriver.

mickeyl avatar mickeyl commented on May 13, 2024

Any update on that? Just stumbled over the same "limitation".

from i2cdriver.

mickeyl avatar mickeyl commented on May 13, 2024

Indeed, that would be pretty cool. While I can work around the difference of talking to the I2CDriver vs. the I2C character device with an additional abstraction layer in my programs, it would be much nicer if that wasn't necessary.

from i2cdriver.

mbenkmann avatar mbenkmann commented on May 13, 2024

Unfortunately my idea does not seem possible because the USB frontend of the i2cdriver is provided by an FTDI chip and is therefore hardwired to be a USB serial device, so the USB protocol can't be changed. But I have a different idea. One could take the kernel driver ftdi_sio which handles the FTDI chip and add support for the I2C-related ioctls. The first time an I2C ioctl is used, the driver engages a translation layer that translates read()/write() data blocks from/to the i2cdriver's protocol. Finally you write a udev-rule that creates a symlink from /dev/i2c-... to /dev/ttyUSB...

The result would be that programs that use /dev/i2c-... would just work on the i2c-driver's device even though it's not a real i2c-bus from the Linux kernel's perspective because every i2c program always has an i2c-related ioctl before the first read()/write(), thereby activating the translation layer. Since the translation layer is active on a per-file descriptor basis, you can mix and match programs that use i2cdriver's native interface and those that use the i2c interface as you wish. E.g. you could use stm32flash to program an STM32 MCU via the i2cdriver and then without having to unplug/reset/whatever start the I2C driver's python helper program to debug the I2C bus functionality of your STM32.

from i2cdriver.

mickeyl avatar mickeyl commented on May 13, 2024

This would be frickin' awesome. Crossing fingers that you can make it happen!

from i2cdriver.

kornpow avatar kornpow commented on May 13, 2024

No I didn’t get too far, and haven’t been doing to much embedded systems lately but would love anything that makes using I2C on normal laptops easier!

from i2cdriver.

kornpow avatar kornpow commented on May 13, 2024

Not that I am going to use this any time soon, but IMO since you are already in there, why not add SMBus related stuff? Save someone the realization that what theyre trying to do is unimplemented.

from i2cdriver.

codehero avatar codehero commented on May 13, 2024

This is really cool, thanks! If I weren't so busy with other projects I would make a different i2cdriver device that wasn't written in (colorforth?)

Does this have a configurable clock stretch timeout?

(also issues don't seem to be enabled on your fork)

from i2cdriver.

mbenkmann avatar mbenkmann commented on May 13, 2024

Thanks for pointing that out. I wasn't aware that Issues weren't enabled by default. I enabled them now.
As for clock stretching, I'm not seeing a command to configure this in the i2cdriver manual.

from i2cdriver.

jamesbowman avatar jamesbowman commented on May 13, 2024

@codehero @mbenkmann is correct, there is no clock stretch timeout configuration value. iirc it's set to something like 250 ms.

@codehero is written in myForth, a machineForth-flavored Forth for 8051s. http://www.kiblerelectronics.com/myf/myf.shtml

from i2cdriver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.