The MCA has several pads that work as GPIOs. The number of GPIO pins depends on the firmware programmed on the MCA.

Kernel configuration

You can manage the MCA GPIO driver support through the following kernel configuration option:

  • Digi ConnectCore SOMs Micro Controller Assist GPIO support (CONFIG_GPIO_MCA)

This option is enabled as built-in on the default ConnectCore 8X kernel configuration file.

Kernel driver

The MCA GPIO driver is located at:

File Description

drivers/gpio/gpio-mca.c

ConnectCore 8X MCA GPIO driver

Device tree bindings and customization

The MCA GPIO device tree binding is documented at Documentation/devicetree/bindings/gpio/digi,gpio-mca.txt.

GPIO controller inside the MCA

ConnectCore 8X device tree
mca_cc8x: mca@63 {

	...

	mca_gpio: gpio {
		compatible = "digi,mca-cc8x-gpio";
		gpio-controller;
		#gpio-cells = <2>;

		interrupt-parent = <&mca_cc8x>;
		interrupt-controller;
		#interrupt-cells = <2>;
	};
};

Using the MCA GPIOs

The MCA GPIO driver works as any other GPIO driver of the kernel. You can access the MCA GPIOs from the sysfs. Refer to the Linux kernel documentation at Documentation/gpio/sysfs.txt.

The following table lists all available MCA IOs and their capabilities:

MCA IO PAD LGA/CS* Digital I/O IRQ-capable Debounce-capable ADC PWM

SWD_DIO/MCA_IO0

AN26/57

image

image

image

image

MCA_IO1

AN21/52

image

image

image

image

MCA_IO2

AN22/53

image

image

image

image

MCA_IO3

AN23/54

image

image

image

image

MCA_IO4

AL27/61

image

image

image

image

MCA_IO5

AL28/62

image

image

image

image

image

MCA_IO6

AK29/63

image

image

image

image

image

MCA_IO7

AJ29/64

image

image

image

image

image

MCA_IO8

AH29/65

image

image

image

image

image

MCA_IO9

AG29/66

image

image

image

image

MCA_IO10

AF29/67

image

image

image

image

MCA_IO11

AM26

image

image

image

MCA_IO12

AM25

image

image

image

image

MCA_IO13

AL22

image

image

image

MCA_IO14

AL26

image

image

image

image

image

MCA_IO15

AL25

image

image

image

image

MCA_IO16

AL24

image

image

image

image

MCA_IO17

AL23

image

image

image

image

MCA_IO18

AM23

image

image

image

image

* CS = castellated pads

Some of the MCA GPIO pins can be configured as ADC channels. When configured as ADC channel, a GPIO cannot be requested through the sysfs to be used as a standard GPIO.

For information about configuring an MCA pin as ADC channel, see Analog-to-Digital Converter (ADC).

Determine the GPIO controller

The system creates a sysfs entry for the MCA GPIO controller and assigns it a GPIO base number.

You can determine the MCA GPIO controller by reading the label for the different controller entries in /sys/class/gpio/.

~# ls /sys/class/gpio/
export       gpio211      gpiochip205  gpiochip224  gpiochip256  gpiochip288  gpiochip320
gpiochip352  gpiochip384  gpiochip416  gpiochip448  gpiochip480  unexport
~# cat /sys/class/gpio/gpiochip205/label
mca-gpio

In this example, the MCA GPIO controller is /sys/class/gpio/gpiochip205.

Determine the number of GPIOs of the MCA

To determine the number of GPIO pins of the controller:

~# cat /sys/class/gpio/gpiochip205/ngpio
19

In this example, the MCA GPIO controller manages 19 GPIOs.

MCA GPIO indexes

The number of the gpiochip controller shows Linux base number for the MCA GPIOs (205 in the example). You can also determine the base number with:

~# cat /sys/class/gpio/gpiochip205/base
205

This means that the MCA_IO0 pin corresponds to GPIO index 205 in Linux, MCA_IO1 corresponds to 206, and so on.

Sample application

The GPIO Sample Application demonstrates the usage of the GPIO API. In this example, one GPIO is configured as input and another as output. You can press the virtual button to switch on and off the User 0 LED corresponding to the output GPIO.

Go to GitHub to see the application instructions and source code.

See GPIO API for more information about the GPIO APIx.

See General Purpose Input/Output (GPIO) for additional information on CPU GPIOs.