GPIO/GDIN
- All here listed variables are located in folder
/common
. - This description is general for all siliXcon ESC devices (motor controllers). This means some variables may not be present in your device.
The GPIO stands for General Purpose Input Output. The GPIOs provide high precision, noise-free analog reading. Usual reading voltage range is 0-10V. They can also read negative voltages in some cases. They can be individually configured with pull-up or pull-down resistors, can be used for precise timing pulse measurement (PAS, speed sensor), and are typically isolated from the power stage. In the default variants of our controllers, the GPIOs have only input functionality.
States
gpioX
[mV]
The voltage on individual GPIO pins in [mV], where X is the GPIO number. The GPIO readings are also available as the gpio
array.
If corresponding ioconf..
is set for reading pulses and device have isolated GPIO (expander). It shows pulse duration.
gdin
Digital representation of voltage on GPIO. This state is an array. This is often used for interfacing buttons and switches. Note that each GPIO can serve as a multiplexed input of up to 4 buttons.
GDIN value | voltage range on GPIO | note |
---|---|---|
-1 | <0.5V | Only with ioconf = 1. GPIO connected to GND |
0 | 0V (0.5V) - 2.5V | GPIO is floating, not connected |
1 | 2.6V - 4.1V | GPIO is connected to 3.3V |
2 | 4.2V - 7V | GPIO is connected to 5V |
3 | >7.1V | GPIO is connected to 10V |
There is a built-in hysteretic debounce mechanism on this reading.
Parameters
ioconfX
This parameter changes the GPIO input configuration, where X is the GPIO number.
ioconf value | Description |
---|---|
0 | no pull-up or pull-down in processor. But there is always some pull-dn, because of the input divider. |
1 | pull-up connected to 3.3V |
2 | pull-down |
The pull-up or pull-dn are built-in weak resistors. With pull-up enable, you will usually shift the offset of up to 2V and also extend measurements slightly into negative range.
If you enable pull-dn resistor, you can increase maximum input voltage. Usually from 0-10V -> 0-12V. For more info, check the hardware documentation of your device.
If you want to use the GPIO for analog reading, always use the ioconf
value 0. The built-in resistor adds inaccuracy.
Post-processing - edge measuring
This is only for devices with an expander (SC, SL, SX).
The measured frequency can be up to 100Hz. This is used for PAS sensor or speed sensor.
ioconf value | Description | Usage |
---|---|---|
72 | period measurement with GDIN as edge counter, GPIO value in [ms] | Speed sensor |
104 | period measurement with GDIN as full period counter, GPIO value in [ms] | Speed sensor with non-symmetrical signal |
80 | duty cycle measurement with GDIN as edge counter, GPIO value in 0-1000 -> 0-100% | |
88 | abs(GPIO) = period measurement, GPIO in [ms] with GDIN as edge counter, sign is duty cycle 0-50 / 50-100% | PAS input |
You can combine input settings and post-processing: 89 (88 + 1) PAS input + pull-up
pulsethr
[mv]
When you are reading pulses using GPIO (PAS sensor, speed sensor), this is used as the threshold for detecting pulse.
Some older devices use value
gpiothr
[lsb]. There 0lsb = 0V. 4000 ~ 10V