Create and use own I2C-Device in Codesys

2017-06-18
2023-11-02
  • HerbertTheKing - 2017-06-18

    Hey Guys,
    I want to control the MCP23017 Port Expander via Codesys on the Raspberry Pi. But I don't really know how to relize it.

    Is there somebody, who did this or any similar projects before?

    For me it's necessary to know, how to work with any I2C Devices in Codesys (MCP23017 is not yet supported from Horter & Kalb)

    Please give me an short instruction. Thanks!

    Antworten auf Deutsch und Englisch sind okay.

    Datasheet MCP23017
    http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf

     
  • Anonymous - 2017-06-19

    Originally created by: dosnova

    I'm in the same situation....

     
  • eschwellinger

    eschwellinger - 2017-06-20

    HI;
    did you check the forum section:
    'CODESYS V3 Raspberry Pi share your devices & libraries & applications'
    or use the forum search.

    Guess you will find a ready to use library and devicedescription:
    l viewtopic.php?f=23&t=5872&p=10868#p11014 l
    BR
    Edwin

     
  • janbar - 2017-11-26

    Where can we find instruction how to make i2c slave device driver? Exist any template?

     
  • Ingo

    Ingo - 2017-11-29

    Hi,

    no template this far, but I hope that we have that in the future. But I can recommend you to have a look into the existing driver libraries. Those are provided in source, in the hope that they are usefull.

    Everyone seriously interested in driver development on the Pi is welcome to leave me a PM.

    BR,
    Ingo

    Gesendet von meinem LG-H870 mit Tapatalk

     
  • louisledee - 2018-01-24

    I'm not sure how to pm but Ingo Hornberger, can you send me a message? I'd like to create a driver for the raspberry pi.

     
  • Ingo

    Ingo - 2018-01-25

    Hi!
    Currently I only have some draft documentation for SPI. If you have some time left, I can provide you the first I2C draft as soon as it is available (via E-Mail).
    If not, I can try to assist you in the creation of your specific driver.

    Just let me know what you prefer.

    BR,
    Ingo

    Gesendet von meinem LG-H870 mit Tapatalk

     
  • louisledee - 2018-02-05

    Hey Ingo, you can email me and I can go from there for the time being. my email is simple, its my username here then gmail. Thanks for your help. I found a bit of documentation in the manual that I think would get me by, through lots of trial and error.

    On another note, my Raspberry Pi Zero just fried, I will need to get another board, do i have any luck getting the license on the new board that you or anyone here knows of?

     
  • kriskizlyk - 2018-04-09

    Ingo Hornberger hat geschrieben:
    Hi!
    Currently I only have some draft documentation for SPI. If you have some time left, I can provide you the first I2C draft as soon as it is available (via E-Mail).
    If not, I can try to assist you in the creation of your specific driver.

    Ingo

    I would like to create a driver for a INA226 device, would you be able to give me some quick guidance on how I create the library? I have seemed to figure out how to Add
    an existing Library, but how would I go about actually creating a new one?

     
  • louisledee - 2018-06-01

    kriskizlyk,

    Have you gotten anywhere with this?

     
  • NPI - 2018-07-20

    Hi Forum,

    I have the same problem. I bought the new Pixtend V2. Old IΒ²C examples doesn't run properly in the new Codesys Software. I can't see the source code, only when fail. A double click on the error opens the code. The librarys gets many errors.

    Why is the source hidden? Some of us need only a small example for IΒ²C-Bus i.e. step by step create a device.

    Anyone confirm whit the new Pixtend V2?

     
  • aliazzz

    aliazzz - 2018-07-21

    @ Ingo Hornberger;

    I am very interested in the draft documentation. Would you be so kind an please contact me to send this documentation?

    Aliazzz

     
  • patrickrjbrown - 2020-05-14

    I know this is a old (ish) thread, but i've got a similar question,

    I've got a sensor that i need to interface with on a machine i'm upgrading.. the thing is it produces a 5 digit BCD output... (which is a load of pins... ) so my plan is to program up a little arduino mega, and then use i2c to send the value into the PLC, (which is an raspberry Pi)

    so looking at some of the FB examples of the i2c seems i can just pick the data off the bus,

    but having not tested it yet i'm hoping someone has an example.. or give me some guidance..

    thanks

    Pb

     
    • aliazzz

      aliazzz - 2020-05-15

      Hi,

      Maybe you have found it yourself allready.

      Press Menu (upper left),
      Select Drivers, now the Device Drivers page opens.
      You can find many open source device drivers which are i2c or SPI based here.

      Select I/O Drivers => All the information to start writing your own device driver for i2c / SPI can be found here;

      https://forge.codesys.com/drv/io-drivers/doc/IndexMain/

      Hope this helps you in the right direction.

       

      Last edit: aliazzz 2020-05-15

Log in to post a comment.