Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Help setting up GPIO inputs

ZorAxe
2016-08-31
2016-11-28
  • ZorAxe - 2016-08-31

    Hi there,

    I'm new to CodeSys. Used TwinCAT alot, but now I'm trying out CodeSys with a Raspberry Pi for a small project. I've managed to get my code to switch different GPIO outputs, and it works 100%. The problem I'm having is on input side. I cant seem to get any signal coming through. Please help me with the correct setup.

    I have a limit switch connected between GPIO24 and GND, when I make the limit switch I dont see the GPIO mapping going TRUE.

    What am I doing wrong?

    Thanks in advance

     
  • eschwellinger

    eschwellinger - 2016-09-01

    Hi,

    this should work,
    which Debian are you using (is this Jessi & in current/latest version)?
    Which Pi? PiB+ PI2 or Pi3?
    Anything installed additional beside CODESYS using he GPIO's by commandline?
    CODESYS and Raspi in current Version?
    And finally have you set the Inputs as Inputs in the configuration ....? See screenshot

    BR
    Edwin

    IMG: Input.jpg

     
  • ZorAxe - 2016-09-04

    Edwin Schwellinger hat geschrieben:
    Hi,
    this should work,
    which Debian are you using (is this Jessi & in current/latest version)?
    Which Pi? PiB+ PI2 or Pi3?
    Anything installed additional beside CODESYS using he GPIO's by commandline?
    CODESYS and Raspi in current Version?
    And finally have you set the Inputs as Inputs in the configuration ....? See screenshot
    BR
    Edwin

    Thanks for the reply.

    I downloaded the latest NOOBS and setup Raspbian like that. Is that compatible?
    It's a PiB
    No. Only installed the OS to use specifically with CodeSys
    CodeSys version is the latest available. v3.5-SP9 Patch 1. Raspbian is the latest. Also ran "sudo apt-get update"
    Yes I set the corresponding GPIO's to Input like in your screenshot.

    I'm thinking 1 of 2 things. Either my OS on the Pi is not compatible, or I need some kind of a pull-up or pull-down resistor wired with my inputs(not 100% sure though)

     
  • eschwellinger

    eschwellinger - 2016-09-05

    Hi
    for PIB (not PIB+)
    you need to add this connector like in my screenshot right?

    BR
    Edwin

    IMG: PIB.jpg

     
  • ZorAxe - 2016-09-07

    I will give that a try and let you know. The problem might have be my own fault. I discovered that the input switch I was using was wired on the "normally-closed" pin and not the "normally-open". I will change that as well and try again.

     
  • ZorAxe - 2016-09-10

    I changed the wiring on my switch and I still cant seem to get the inputs to work. Please help

     
  • ZorAxe - 2016-09-12

    Can anyone help me with the physical connection of the input pins and setting them up in CodeSys. I cant seem to figure it out.

     
  • allen00se - 2016-10-06

    ZorAxe hat geschrieben:
    Can anyone help me with the physical connection of the input pins and setting them up in CodeSys. I cant seem to figure it out.

    Did you ever figure this out? I am having the same issue and was wondering if I needed some resistors somewhere and whether I should connect the GPIO to GND or to 3.3V.

    Anyone have a physical wiring diagram that works with CodeSys?

     
  • allen00se - 2016-10-07

    allen00se hat geschrieben:
    Did you ever figure this out? I am having the same issue and was wondering if I needed some resistors somewhere and whether I should connect the GPIO to GND or to 3.3V.
    Anyone have a physical wiring diagram that works with CodeSys?

    finally got my inputs working last night... here is the wiring diagram that worked for me.

    IMG: Bild

     
  • ZorAxe - 2016-10-25

    Thanks for that. I managed to get it to work once, but its not consistent so I will try your wiring diagram.

    ###EDIT###

    So after a bit of fault finding it seems I cant use GPIO25 as an Input. I was using GPIO4 as Output and GPIO25 as Input. The Output was fine but I had a problem with the input. When I swap them over it works 100%

    Any ideas why GPIO25 doesn't register when I use it as an Input?

     
  • allen00se - 2016-10-28

    ZorAxe hat geschrieben:
    Thanks for that. I managed to get it to work once, but its not consistent so I will try your wiring diagram.
    ###EDIT###
    So after a bit of fault finding it seems I cant use GPIO25 as an Input. I was using GPIO4 as Output and GPIO25 as Input. The Output was fine but I had a problem with the input. When I swap them over it works 100%
    Any ideas why GPIO25 doesn't register when I use it as an Input?

    Honestly I am just pretty frustrated at this point with CodeSys' lack of support regarding the Raspberry PI's GPIO's. I can't believe how hard it seems to be to get a clear answer on why they dont work right, and why not all of them show up. I have a PI3 with GPIO's that I can't even use because they wont show up in the GUI. I have paid for multiple licenses and still have not got a clear answer other than "Go build a new library yourself".

     
  • aso3964 - 2016-11-20

    Hi,
    I would like to know if this problem with GPIOs for PI3B+ has been solved, since I will need to use all 26 entries available in Raspberry.

     
  • allen00se - 2016-11-21

    aso3964 hat geschrieben:
    Hi,
    I would like to know if this problem with GPIOs for PI3B+ has been solved, since I will need to use all 26 entries available in Raspberry.

    No it has not been solved, and so far it has barely even been acknowledged.

     
  • eschwellinger

    eschwellinger - 2016-11-26

    Hi,
    we really thought one the community could help to implement this.
    At the moment it is more or less a problem on the high workload that it is not easy to bring this into the product.
    Let me check what we could do. (Have you already tried it?)
    Fro my Point of view the bigger problem would be: How to get rid of the predefined functions you have as default on the GPIO's
    like I2C / SPI whatever there is mapped to these GPIO's which you want to see additional in CODESYS.
    So These are the additional things to do outside CODESYS, do you agree?

    BR
    Edwin

     
  • allen00se - 2016-11-28

    Edwin Schwellinger hat geschrieben:
    Hi,
    we really thought one the community could help to implement this.
    At the moment it is more or less a problem on the high workload that it is not easy to bring this into the product.
    Let me check what we could do. (Have you already tried it?)
    Fro my Point of view the bigger problem would be: How to get rid of the predefined functions you have as default on the GPIO's
    like I2C / SPI whatever there is mapped to these GPIO's which you want to see additional in CODESYS.
    So These are the additional things to do outside CODESYS, do you agree?
    BR
    Edwin

    I don't really see how a basic functionality of the device should be something for the community to implement, especially for those of us who are paying for licenses. Yes I have actually tried to do this myself but sadly I can not figure it out. I would assume that whoever wrote the code to begin with could probably implement the changes in a few hours vs some random person like me struggling for weeks to figure it out.

    On top of all of that I still don't feel like you really understand what we are asking for, we are not talking about the I2C/SPI pins, we are talking about the PINS that don't even show up for use, I thought I made this pretty clear in one of my earlier posts.

    EDIT ***
    The previous post I was referring to is in this thread

    l viewtopic.php?f=21&t=7053 l

     

Log in to post a comment.