Hello, I'm working on a project where I need 16 GPIO pins on the PI. (I'm new to CoDeSys and PLCs in general, but have good programming background and understanding of the PI.) I don't understand how to map and configure the pins under CodeSys 3.5. I'm looking at the GPIO example application and there are only 12 configurable pins in the GPIOs Configuration Tab. How do I add other pins to configure as inputs or outputs?
Next, how do these GPIO pin configurations in the GPIOs Configuration Tab map to the Channel bit under the GPIOs I/O Mapping tab? And, how do the channels/addresses map to the HMI elements?
For example I was able to assign Bit18 to variable gxOut, which I guessed somehow aligned with variable GPIOs_Instance._GPIO.axInputs[18] as defined in the HMI example. Sure enough, the light blinks when I run the simulation. It would seem there would be a link between the channel or the address to the HMI element. But, I don't understand.
Is there reference material that I missed reading? Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
we will extend the GPIO's to B+ model on next version.
you could map variables to the IO's in the mapping tap or use the instance of the IOdriver
GPIOs_Instance ist the instance of the GPIO Iodriver (which is implicite called by the system)
GPIOs_Instance._GPIO.axOutputs
GPIOs_Instance._GPIO.axInputs
You could access the mapped variables in the visualization on different ways:
This example from store use the instance, this is more because it seems the one who did the example was a kind if lazy to map the
variables, therefore he get them from the IOdriver instance.
You could also map your variable like in screenshot GPIOMappin2.jpg and access it that way.
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-08-06
Originally created by: M.Schaber
Hi,
See also here for a mapping of GPIO numbers to the physical pins on the board:
Thanks for the information. I think I understand the mappings. Thanks for the reference diagram, too.
As for the number of GPIO, the GPIO example only has 12 pins defined in the configuration tab, but the B version of the PI has 21 possible GPIOs. Some of the pins can do multiple things like SPI, serial, etc, but I would like to use 16 pins for GPIO. The B+ verson of the PI extends connector P1, as you can see in the reference you provideded. In my example, I'm working with the B version of the PI.
In the GPIO Tab the following pins are defined, with the corresponding physical pinout from the reference you provideded:
Since my project requires 16 GPIO's and the Configuration Tab only has 12 GPIO's defined, is there a way I can ADD configurations for the other missing GPIOs so they are available to use under CoDeSys?
Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yes, this is possible.
We only provide the free GPIOs because we assume that in many cases I²c, SPI and the other options are used, so we reduced the standard IOs.
Please see attached the device description file (devdesc.xml) that contains the description and the parameters of the “GPIO” device in the device tree. Feel free to modify/customize it, but consider to give it a new ID (DeviceIdentification section) and a new name (DeviceInfo section) Snippet from GPIOs.devdesc.xml
can you please give some more infos about how to modify the gpio.devdesc.xml and how to import it into CoDeSys.
I want to make a berryclip plus (http://www.raspberrypi-spy.co.uk/berryc ... tructions/) work with the Raspberry and CoDeSys.
Switch 2 (at GPIO 25), LED 2 (at GPIO 17) and LED 3 (at GPIO 22) are already working, but the others don't.
The python scripts are all working, so it is no hardware problem.
Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks to the 3S-Support i could get all GPIOs working.
Attached is the DevDesc.xml with all Pins.
First of all, you have to install the DevDesc.xml under "Tools" -> "Install Device..." and select the file.
Then, you have to navigate to "Tools" -> "Options...", select "Features" and click on "Predefined Feature Set" and change it to "Professional".
Now you can right-click on the Raspi in the project manager, select "update device..." and there is a new option "display all versions (for experts only)" and select the modified device description file.
Remember to map the Inputs and Outputs to plc-variables and to configure the used pins as input or as output.
Hi everyone! Anyone help me to understand GPIO structure. I talk about pull-up resistors, how configured I/O in Codesys driver, when I select port is input? For example I need use button working on ground.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
alexdrik hat geschrieben:
First of all, you have to install the DevDesc.xml under "Tools" -> "Install Device..." and select the file.
Then, you have to navigate to "Tools" -> "Options...", select "Features" and click on "Predefined Feature Set" and change it to "Professional".
Now you can right-click on the Raspi in the project manager, select "update device..." and there is a new option "display all versions (for experts only)" and select the modified device description file.
Remember to map the Inputs and Outputs to plc-variables and to configure the used pins as input or as output.
Hi, I don't have the "Features" option under the Tools - Options tabs! Am I missing something please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-05-18
Originally created by: M.Schaber
Hi,
in recent CODESYS versions, the "Featureset" functionality was removed, CODESYS now always behaves as "Professional".
HTH,
Markus
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello! I need to set GPIO11 as input. I edit the file GPIOsBplus.devdesc.xml, in the settings this output appeared, but it's not working, can you fix it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
artemka hat geschrieben:
Hello! I need to set GPIO11 as input. I edit the file GPIOsBplus.devdesc.xml, in the settings this output appeared, but it's not working, can you fix it?
Is it possible to implement it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Edwin Schwellinger hat geschrieben:
Hi,
yes, this is possible.
We only provide the free GPIOs because we assume that in many cases I²c, SPI and the other options are used, so we reduced the standard IOs.
Please see attached the device description file (devdesc.xml) that contains the description and the parameters of the “GPIO” device in the device tree. Feel free to modify/customize it, but consider to give it a new ID (DeviceIdentification section) and a new name (DeviceInfo section)
to distinguish it from the standard one. You need to install it in the device repository and update your device.
Please see also the attached library that interprets the configuration and executes it.
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Model: Rpi 3B+
Hi,
I would like to use all GPIO pins, 2 to 27 for digital I/O.
I edited the device description file (devdesc.xml), added in the missing GPIO pins and gave it a new name and loaded it, but it's not enough, it seems apparent you need to update the IoDrvGPIO.library to reference the GPIO numbers to the internal Pi memory address. The GPIOs I/O Mapping table needs to be populated so you can assign variables to the GPIO.
Edwin, would it be possible to provide a library file with mapping for GPIO 2 to 27?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, further to this I see the pattern for I/O Mapping 8 bits per bank. To edit this and add the additional channels, should I download the CSV file edit it and reload?
Then for example, if I create channel Bit2 , %IXO.2, it will be GPIO2 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to get a PWM circuit to work, I only need one channel for lase control and Raspberry Pi has it, GPIO 12 or 13, how do I enable and control it? I do see a function GPIO that has PWMFrequency and duty cycle
Hi
I am about to configure ALL GPIOs on a Raspberry Pi 3 model B V1.2.
It seems that I have limited understanding of why not all the IO’s become available with the corresponding mapped IO’s – the 'dwInUse' contains mapping of the inputs from GPIO0 to GPIO27. But 'dwInputs' are only showing GPIO0 to GPIO8 and GPIO15 as available inputs. These mentioned inputs work fine
Hello, I'm working on a project where I need 16 GPIO pins on the PI. (I'm new to CoDeSys and PLCs in general, but have good programming background and understanding of the PI.) I don't understand how to map and configure the pins under CodeSys 3.5. I'm looking at the GPIO example application and there are only 12 configurable pins in the GPIOs Configuration Tab. How do I add other pins to configure as inputs or outputs?
Next, how do these GPIO pin configurations in the GPIOs Configuration Tab map to the Channel bit under the GPIOs I/O Mapping tab? And, how do the channels/addresses map to the HMI elements?
For example I was able to assign Bit18 to variable gxOut, which I guessed somehow aligned with variable GPIOs_Instance._GPIO.axInputs[18] as defined in the HMI example. Sure enough, the light blinks when I run the simulation. It would seem there would be a link between the channel or the address to the HMI element. But, I don't understand.
Is there reference material that I missed reading? Thanks for your help.
Hi,
we will extend the GPIO's to B+ model on next version.
you could map variables to the IO's in the mapping tap or use the instance of the IOdriver
GPIOs_Instance ist the instance of the GPIO Iodriver (which is implicite called by the system)
GPIOs_Instance._GPIO.axOutputs
GPIOs_Instance._GPIO.axInputs
You could access the mapped variables in the visualization on different ways:
This example from store use the instance, this is more because it seems the one who did the example was a kind if lazy to map the
variables, therefore he get them from the IOdriver instance.
You could also map your variable like in screenshot GPIOMappin2.jpg and access it that way.
BR
Edwin
Originally created by: M.Schaber
Hi,
See also here for a mapping of GPIO numbers to the physical pins on the board:
http://www.raspberrypi-spy.co.uk/2014/0 ... nd-pinout/
http://www.raspberrypi-spy.co.uk/2012/0 ... evision-2/ m
Thanks for the information. I think I understand the mappings. Thanks for the reference diagram, too.
As for the number of GPIO, the GPIO example only has 12 pins defined in the configuration tab, but the B version of the PI has 21 possible GPIOs. Some of the pins can do multiple things like SPI, serial, etc, but I would like to use 16 pins for GPIO. The B+ verson of the PI extends connector P1, as you can see in the reference you provideded. In my example, I'm working with the B version of the PI.
In the GPIO Tab the following pins are defined, with the corresponding physical pinout from the reference you provideded:
GPIO4 P1-7
GPIO17 P1-11
GPIO18 P1-12
GPIO22 P1-15
GPIO23 P1-16
GPIO24 P1-18
GPIO25 P1-22
GPIO27 P1-13
GPIO28 P5-03
GPIO29 P5-04
GPIO30 P5-05
GPIO31 P5-06
The configuration tab in CoDeSys does not have configuration options for (missing GPIOs) these GPIOs (Revision 2):
GPIO02
GPIO03
GPIO07
GPIO08
GPIO09
GPIO10
GPIO11
GPIO14
GPIO15
Since my project requires 16 GPIO's and the Configuration Tab only has 12 GPIO's defined, is there a way I can ADD configurations for the other missing GPIOs so they are available to use under CoDeSys?
Thanks for your help.
Hi,
yes, this is possible.
We only provide the free GPIOs because we assume that in many cases I²c, SPI and the other options are used, so we reduced the standard IOs.
Please see attached the device description file (devdesc.xml) that contains the description and the parameters of the “GPIO” device in the device tree. Feel free to modify/customize it, but consider to give it a new ID (DeviceIdentification section) and a new name (DeviceInfo section)
Snippet from GPIOs.devdesc.xml
to distinguish it from the standard one. You need to install it in the device repository and update your device.
Please see also the attached library that interprets the configuration and executes it.
BR
Edwin
IoDrvGPIO.library [388.32 KiB]
GPIOs.devdesc.xml [9.54 KiB]
Hello,
can you please give some more infos about how to modify the gpio.devdesc.xml and how to import it into CoDeSys.
I want to make a berryclip plus (http://www.raspberrypi-spy.co.uk/berryc ... tructions/) work with the Raspberry and CoDeSys.
Switch 2 (at GPIO 25), LED 2 (at GPIO 17) and LED 3 (at GPIO 22) are already working, but the others don't.
The python scripts are all working, so it is no hardware problem.
Thanks for your help.
Hello,
thanks to the 3S-Support i could get all GPIOs working.
Attached is the DevDesc.xml with all Pins.
First of all, you have to install the DevDesc.xml under "Tools" -> "Install Device..." and select the file.
Then, you have to navigate to "Tools" -> "Options...", select "Features" and click on "Predefined Feature Set" and change it to "Professional".
Now you can right-click on the Raspi in the project manager, select "update device..." and there is a new option "display all versions (for experts only)" and select the modified device description file.
Remember to map the Inputs and Outputs to plc-variables and to configure the used pins as input or as output.
AllGPIOs.devdesc.xml [10.97 KiB]
Hi everyone! Anyone help me to understand GPIO structure. I talk about pull-up resistors, how configured I/O in Codesys driver, when I select port is input? For example I need use button working on ground.
Hi, I don't have the "Features" option under the Tools - Options tabs! Am I missing something please?
Originally created by: M.Schaber
Hi,
in recent CODESYS versions, the "Featureset" functionality was removed, CODESYS now always behaves as "Professional".
HTH,
Markus
Hello! I need to set GPIO11 as input. I edit the file GPIOsBplus.devdesc.xml, in the settings this output appeared, but it's not working, can you fix it?
Is it possible to implement it?
to distinguish it from the standard one. You need to install it in the device repository and update your device.
Please see also the attached library that interprets the configuration and executes it.
BR
Edwin
Model: Rpi 3B+
Hi,
I would like to use all GPIO pins, 2 to 27 for digital I/O.
I edited the device description file (devdesc.xml), added in the missing GPIO pins and gave it a new name and loaded it, but it's not enough, it seems apparent you need to update the IoDrvGPIO.library to reference the GPIO numbers to the internal Pi memory address. The GPIOs I/O Mapping table needs to be populated so you can assign variables to the GPIO.
Edwin, would it be possible to provide a library file with mapping for GPIO 2 to 27?
Hi, further to this I see the pattern for I/O Mapping 8 bits per bank. To edit this and add the additional channels, should I download the CSV file edit it and reload?
Then for example, if I create channel Bit2 , %IXO.2, it will be GPIO2 ?
I am trying to get a PWM circuit to work, I only need one channel for lase control and Raspberry Pi has it, GPIO 12 or 13, how do I enable and control it? I do see a function GPIO that has PWMFrequency and duty cycle
Hi
I am about to configure ALL GPIOs on a Raspberry Pi 3 model B V1.2.
It seems that I have limited understanding of why not all the IO’s become available with the corresponding mapped IO’s – the 'dwInUse' contains mapping of the inputs from GPIO0 to GPIO27. But 'dwInputs' are only showing GPIO0 to GPIO8 and GPIO15 as available inputs. These mentioned inputs work fine
You will be able to watch the limited mapped IO activity here:
https://drive.google.com/file/d/1zz4PBNBfRZBF2YkiJ2VQxw6L9MBVji7R/view?usp=sharing
Can you please bring your best idea on why GPIO09 to GPIO14 and GPIO16 to GPIO27 state are zero in the dwInputs register?
Thanks in advance.
Best regards
Andreas Bahrt