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

Raspberry Compute Module access to all GPIOs

  • DawidS

    DawidS - 2017-07-19

    Since version 3.5 SP11 Codesys supports all Raspberry versions including Compute Module 3. Thanks for adding this feature.

    There is one problem, Compute Module have GPIOs form GPIO0 to GPIO47 available. Codesys support only up to GPIO31. This is the big limitation in this case. For example, I'm using all GPIOs up to GPIO47 on my board and I don't have access to GPIOs from 32 to 47.

    I have experience in embedded systems programming, so I made a decision to write my own library for that. It's the third day of my tests and I'm stuck. I think that without any documentation it is impossible.
    This is what I did:
    1) I create my own GPIOs.devdesc.xml with all GPIO, install device and update device in the project. It works well. I can see all GPIO in "GPIOs Parameters" and "GPIOs I/O Mapping"
    2) I modified IoDrvGPIO.library to get access to GPIO32..53 (all GPIOs available in processor). GPIO32..53 uses different processor registers that GPIO0..31. This I have done in "internal" section of the library. I also modified all arrays in "GPIO" and appropriate loops. I don't know how can I update IoDrvGPIO (FB) section of the library. There is no documentation.

    The first issue is that in GPIOs.devdesc.xml is

    <BitfieldType name="BITFIELD_GPIO" basetype="std:DWORD">

    so it limits bits to 31. I tried change DWORD to LWORD. I see all GPIOs and their values during run program in "GPIOs I/O Mapping" but on Raspberry, GPIO does not change. I use GPIO.project for testing. I tried different changes of IoDrvGPIO (FB) section of the library, without success.

    I need help. How is the best way to mapping GPIO32..53? Do I have to change DWORD to LWORD in GPIOs.devdesc.xml and modify IoDrvGPIO.library or is possible to add the second section in GPIOs.devdesc.xml with basetype="std:DWORD". How can I do it?

    My controller has 8 binary outputs (GPIO35..42) and 12 inputs. Maybe is possible to create two mapping sections with basetype="std:DWORD" - Inputs and Outputs with appropriately assigned GPIO (O1 -GPIO35, O2- GPIO36 etc.)?

  • sscreve

    sscreve - 2021-09-17

    Hello DawidS,
    there is no answer, have you any solution for that?
    I have the same problem.


Log in to post a comment.