Notes on the Variscite DART-MX6 GPIO Interface22 Apr 2016
Because of reasons, I have a Variscite VAR-DTK-MX6 evaluation kit for the DART-MX6 system on module (SOM) sitting on my desk at home. It’s a neat little board. The DART-MX6 is small, measuring 20mm by 50mm and runs a dual-core ARM Cortex-9 processor. This makes it a bit more powerful than, for instance, a Raspberry Pi, but it is only $27. The SOM is meant to be used as a component in an embedded application when some device or another that needs a 32-bit microprocessor.
The evaluation kit is about the size of two Raspberry Pi boards and mounts the SOM. It provides HDMI, several USB ports, Ethernet, PCI Express, and more pins than I can count. It also comes with a touchscreen that connects to the board.
The DART-MX6 provides a crazy number of GPIO pins. The kernel reports 224:
In particular, the documentation states there are two LEDs (D1 and D2) and three physical buttons on the evaluation board that can be read and set via GPIO. However, figuring out which button is which GPIO pin is kind of opaque. The schematics provided by Variscite provide some insight, but not enough.
The schematics state that the following are labels equivalent:
- D1 = GP_LED1 = DISP0_DAT6 = GPIO4
- D2 = GP_LED2 = DISP0_DAT7 = GPIO4
- SW1 = USR_BTN1 = DISP0_DAT5 = GPIO4
- SW2 = USR_BTN2 = DISP0_DAT17 = GPIO5
- SW3 = USR_BTN3 = DISP0_DAT4 = GPIO4
The other buttons are hardwired to reset and on/off so the don’t matter much from this perspective. Of course, those GPIO identifiers are still insufficient to determine what pin number Linux uses to identify the port. Given an label of the form GPIOm[n], the pin will be internally identified as number (m - 1) * 32 + n. So, for instance, D1 is GPIO pin (4 - 1) * 32 + 27 = 123.
So, the final mapping is:
- D1 = gpio123
- D2 = gpio124
- SW1 = gpio122
- SW2 = gpio139
- SW3 = gpio121
Despite this complexity, you can access and manipulate the GPIO using a simple shell script. This one, written for the Raspberry Pi, will work just fine on any Linux system that exports the GPIO pins via sysfs, which Yocto does on the DART-MX6.