Pin multiplexing for drivers
Pin Multiplexing
On i.MX6 BSP the multiplexing of IO pins is configured to match the standard pinout for Colibri and Apalis. For additional devices like extra UARTs not part of the standard pinout, to match the pinout described in the datasheet.
A different multiplexing can be configured in the registry. Registry entries override multiplexing for a specific driver instance or set some multiplexing options as soon as the registry is loaded.
Multiplexing registry entries
It's possible to specify a generic pinout, that applies to all the modules, or a pinout specific for a module form factor (Apalis/Colibri), a specific module (ex: iMX6S256IT) or even a specific version of a specific module.
Pinouts are defined using registry keys. All the keys defining a pinout are named "Pinout_" suffix.
The "Pinout_Default" entry is used to specify a pinout that applies to each module.
Each module type and revision is identified by a 8 digits code that is build in the following way:
- 4 decimal digits for the product type (product number). Currently the following codes are defined:
Module type | Code |
---|---|
Colibir iMX6S 256MB | 0014 |
Colibri iMX6DL 512MB | 0015 |
Colibri iMX6S 256MB IT | 0016 |
Colibri iMX6DL 512MB IT | 0017 |
Apalis iMX6Q 1GB | 0027 |
Apalis iMX6Q 2GB IT | 0028 |
Apalis iMX6D 512MB | 0029 |
- 1 decimal digit for major version
- 1 decimal digit for minor version
- 2 decimal digit for variant with 'A' being 0, 'B' being 1 etc.
For example code for an Apalis iMX6Q 1GB V1.1A is 00271100.
It's possible to specify a multiplexing for a specific module (including version) using the Pinout_XXXXXXXX format, using the full 8 digits code. To specify more generic pinout for just a specific module type or for a major-minor combination you can use just the first 4 or 6 digits of the code. You can also create a key for different modules by separating the codes with a comma.
For example:
Key | Modules |
---|---|
Pinout_00271100 | Applies only to IMX6AQ1024 1.1A modules |
Pinout_002711 | Applies only to IMX6AQ1024 1.1 modules, any variant |
Pinout_0027,0028,0029 | Applies to all Apalis modules (Q1025,D512 and Q2048IT) in all versions and variants |
The system takes the registry key which matches the the module more precisely. For example if you have a generic entry for Apalis iMX6Q 1GB and a specific one for version 1.1C and your module is Apalis iMX6Q 1GB V1.1C then the specific key is used and the more generic one (any Apalis iMX6Q 1GB module) is ignored. Values are taken from a single key, so if you need to override only a specific pin for a new version you have to copy all the settings from the more generic key to your new entry.
Inside the key it's possible to specify settings for different pins. It's possible to identify a pin using different notations:
Name | Description |
---|---|
gpio_XXX | Reference a GPIO number, SOC specific |
colibripin_XXX | Reference a Colibri SO-DIMM connector pin number |
apalispin_XXX | References and Apalis MXM connector pin number |
The registry entries must be configured as strings and they can contain the following values:
Parameter | Values | Description |
---|---|---|
altfn | -1 | This is the compatible value to define a GPIO. In the SoC datasheet, there is no AltFn with value -1. |
0 to 7 | Alternate Function 0 to 7. The precise meaning depends on the actual IO. | |
dir | in | IO direction is input |
out | IO direction is output. The real level of the pin cannot be read back. | |
sion | auto | Configure SION bit in the input multiplexer automatically (suggested option for most of the pins) |
normal | Don't force the input path enabling | |
force | Force input path enabling | |
lvl | 0 | Set IO level to Logic low (if AltFn=GPIO, and Dir=out or outonly) |
1 | Set IO level to Logic high (if AltFn=GPIO, and Dir=out or outonly) | |
pull | none | This is the compatible value to remove all software pullup/down resistors or bus keepers. |
up | This is the compatible value to configure a software pullup. | |
down | This is the compatible value to configure a software pulldown. | |
up22k | 22k pull up | |
up47k | 47k pull up | |
up100k | 100k pull up. "pull=up" and "pull=up100k" are identical. | |
down100k | 100k pull down. "pull=down" and "pull=down100k" are identical. | |
buskeep | Instead of a pullup/down resistor, a bus keeper gets enabled | |
strength | 0 | Output driver and pull up/down disabled |
1 | 260 Ohm output impedance. This is the reset default value. | |
2 | 130 Ohm output impedance | |
3 | 90 Ohm output impedance | |
4 | 60 Ohm output impedance | |
5 | 50 Ohm output impedance | |
6 | 40 Ohm output impedance | |
7 | 33 Ohm output impedance | |
outmode | std | Standard output. This is the reset default value |
od | Open drain | |
inmode | std | Normal input. This is the reset default value. |
schmitt | Schmitt trigger input | |
slew | slow | Slow rising and falling edge. This is the reset default value. |
fast | Fast rising and falling edge. | |
speed | low | IO bandwidth = 50 MHz (low). This is the reset default value |
medium | IO bandwidth = 100-150 MHz (medium) | |
high | IO bandwidth = 100-150-200 MHz (high) |
For example to configure SODIMM pin 17 of the Colibri module as a GPIO output set to high state you can specify:
"colibripin_17"="altfn=-1 dir=out lvl=1"
Multiplexing for a specific driver
To configure multiplexing for a specific driver you have to put the "Pinout_*" entries under its configuration key.
For example to change multiplexing of UART for all modules you can add:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\COM2\Pinout_Default]
entry in the registry and configure the corresponding pins.
Adding a Pinout entry will prevent the driver from applying the default pin multiplexing configuration so even if you just need to change the multiplexing of a single pin you'll have to specify the multiplexing for all the other pins managed by the driver.
Setting the wrong multiplexing may prevent the driver from working and may lead to issues.
The new multiplexing will be applied only after you reboot your device.
Multiplexing at boot
Sometimes you may need to configure pins that are not related to a specific driver or you prefer to keep all your multiplexing settings in a single entry.
You can add the Pinout_* keys described above under the:
[HKEY_LOCAL_MACHINE\Drivers\Builtin\GPIOMux]
registry key.
This key is processed very early during the OS boot (as soon as registry has been loaded from filesystem). This means a few seconds after power-up but earlier than any driver or application added to the system.
If you override pinout for a device that is controlled by a driver and don't want that the driver applies its default multiplexing you can add a DWORD entry named "DoMultiplexing" under the driver's main configuration key. Setting the "DoMultiplexing" value to 0 will prevent any pin-multipleying configuration from the driver (both default pinout and customized multiplexing using the keys described above).
An issue in version 1.0 of the release image affects the GPIOmux driver and prevents it from being loaded, this is going to be fixed in release 1.1 of the image.
Multiplexing at boot does not work in version 1.0.