Generic I2c peripherals management

Runtime
dormouse75
2020-01-19
2020-01-21
  • dormouse75

    dormouse75 - 2020-01-19

    Hello,
    I need to menage an I2C peripheral not present on device libraries : MCP3421 (adc 1ch 18 bit).
    I'm not able to create it
    Is there a simple way to read/write configuration or data bytes (according to MCP3421 data sheet) by step by step ST instructions, without creating the device?
    something like this:
    1) set the device address
    2) set number of bytes to write
    3) write data bytes
    4) set number of bytes to read
    5) read data

    Can you help me?
    Thank you!

     
  • i-campbell

    i-campbell - 2020-01-20

    Hello!
    When you say you can't create it, do you mean you found the documentation for creating I2C devices and weren't able to follow?
    If yes, I would like to fix the documentation so it is easier for you and others to follow. So where are you stuck?
    If not, then just follow the documentation here, and let us know if you get stuck.
    https://forge.codesys.com/drv/io-drivers/doc/I2C/ m

     
  • i-campbell

    i-campbell - 2020-01-20

    It also looks like Fab can give you a heard start..

    l viewtopic.php?t=6174#p12190 l

     
  • dormouse75

    dormouse75 - 2020-01-20

    Thank you for your answer.
    I would use Raspberry for a hobby application, on my (very short) free time.
    I'd like To program It by Codesys (instead of Phyton or something else) because I'm able to program plc's...so my idea is: ''I spend 60 euro (vat included) for Codesys  Runtime licence in order to avoid wasting time to learn...make test....experiment...etc.

    The answer to your question is yes...I'm not able also with correct  instructions...or probably I would be able after a lot of time...and after that I would spend 60 euro for runtime...

    For the same chip I know the Fab work...I installed It...but Codesys gives an error when I add the device and It is build for temperature sensor...I just need to read a voltage value with high resolution...

     
  • dormouse75

    dormouse75 - 2020-01-21

    Following your guide, I modified the Fab library: viewtopic.php?t=6174#p12190 , in order to adapt it to my application.
    It works...very good! (and thanks )

     
  • i-campbell

    i-campbell - 2020-01-21

    Fantastic news! I hope you are seeing interesting things at 15.625 µV resolution

    I would be very pleased were you to release it as open source on the forge. Let me know if I can be of any help in that regard.

     

Log in to post a comment.