To make them versatile control and monitoring devices, all ARTIK modules provide many programmable signal pins.
You've seen in the Tutorials how to program General Purpose Input/Output (GPIO) pins. General Purpose pins are just one type of the many programmable pins that ARTIK provides, for:
- Analog Input (ADC) – reading a varying signal level and processing through an analog-to-digital converter
- Digital Input (GPIO) – sensing a DC signal level at low (GND) or high (Vcc)
- Digital Output (GPIO) – driving a DC level (GND or Vcc) that can be controlled dynamically
- Waveform Output (PWM) – switching DC levels by a Pulse Width Modulation circuit with frequency and duty cycle that can be programmed dynamically.
- Serial Ports (I2C and UART) – sending and receiving data according to industry-standard protocols.
These pins directly handle tasks like controlling relays, generating analog voltages, and monitoring analog sensors, as well as complex tasks involving parallel and serial communication with more sophisticated control and sensor devices.
The GPIO type can be dynamically switched (by programming) between input and output. The serial type handles this transmit versus receive switching automatically. The other programmable pins are dedicated to either input or output only.
Below, we provide an overview of how to map and code for each programmable pin type.
ARTIK 0 Modules
Devices in the ARTIK 0 family have a vast array of programmable functions that can be assigned to each GPIO pin. For complete details, refer to the ARTIK 020 ARTIK 030, and ARTIK 053 Hardware Datasheets.
Additionally for the ARTIK 053, you'll file some helpful GPIO mapping information here.
ARTIK 5/7/10 Modules
Configuring and using programmable pins is probably something you've done with other devices. Pin reference numbering in the code is one aspect of using a programmable pin that can be tricky. Here's why.
The schematics show header position numbers.
The ARTIK 520 and 1020 have connectors J26 and J27, with pin numbers 0-13 extending across both. The same numbers are referenced by the Arduino IDE.
The ARTIK 530 and 710 use a numbering scheme that changes according to the board attached. On the Interface board, those numbers are shifted by 2 from the Arduino IDE numbers.
Moreover, these numbering schemes are used differently in the various programming environments.
- The Arduino development environment simplifies programming by internally mapping pin position number to the right I/O port address.
- The ARTIK IDE and Linux®
sysfsenvironment map these pin locations to GPIO "export" numbers, which are usually not the same across ARTIK boards.
- The kernel code itself assigns the pins by signal name to internal I/O port addresses (not export number); these port addresses again differ across ARTIK module types.
It can seem confusing. Luckily, the configuration of any ARTIK programmable pin is actually pretty straightforward. Just follow the two links indicated below.
- If coding in the Arduino IDE environment:
- Identify the pin by header, and note the position number.
- That's all you need – go straight to coding.
- If coding in a native environment and using the gcc compiler, for example:
- You'll want to see the GPIO export numbers alongside signal names and kernel-level I/O port addresses. Look at the programming tables for the pin.
- Code per
sysfsor kernel methods as described on that same page, using the GPIO 'export' number for
sysfsor the port address for kernel code.
Looking for programmable pin header locations? Go to GPIO Header Maps.