If an assigned hardware resource changes either during application development or after development is finished (for example, the GPIO of a push button or the availability of a PWM) and the resources are hardcoded in your source code, you must edit the files and rebuild your applications for changes to take effect.

You can avoid this by using libdigiapix to define aliases for your interfaces in a configuration file. In your application, you can then refer to the alias "USER_BUTTON" instead of controller label 'mca-gpio' and line number 5 when requesting a GPIO. If the hardware changes, the application code is still valid; when you change the value of the alias in the configuration file, it points to the new kernel number value.

Define your libdigiapix configuration file

The configuration file is called libdigiapix.conf. You can define your aliases:

  • At runtime, by modifying the /etc/libdigiapix.conf file in the root file system of your device.

  • At build time, by appending your own configuration files to the libdigiapix package. The recipe that builds this package is located inside the meta-digi layer, meta-digi/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix_git.bb.

Follow the format defined in [libdigiapix-conf-syntax] to create your configuration file.

To create images that include your own configuration file, follow these steps:

  1. Write the configuration file, board.conf, for your hardware.

  2. Locate it in your layer inside the directory recipes-digi/libdigiapix/libdigiapix-git.

  3. Create a libdigiapix_git.bbappend file inside the directory recipes-digi/libdigiapix of your layer to extend the existing recipe file with new files:

    libdigiapix_git.bbappend file
    FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
  4. Build Digi Embedded Yocto as usual.

Example libdigiapix.conf
[board]
model = Digi International ConnectCore 6ULSBC.

[GPIO]

# USER LED
USER_LED = gpio1,23

# USER BUTTON
USER_BUTTON = mca-gpio,1

[I2C]

# I2C-1 on I2C board connector.
DEFAULT_I2C_BUS = 0

[SPI]

# SPI-1 on SPI board connector, slave 0.
DEFAULT_SPI = 0,0

[PWM]

# PWM4 on GPIO board connector (pin 11).
DEFAULT_PWM = 0,0

Board section

This is a mandatory section to identify your board. It must contain the following properties:

Name Mandatory Description

dtfile

-

Contains the absolute path to the file that contains the model of your board in its file system.

Specify its value if it is different from the default value, /proc/device-tree/model.

model

✔

The model to identify your hardware. It should match the model in the configured dtfile property.

  • For ConnectCore 6 Plus SBC:

    Digi International ConnectCore 6 QuadPlus Single Board Computer.

The final dot is part of the model property value.
Example board section
[board]
model = Digi International ConnectCore 6ULSBC.

GPIO section

Optional section to identify GPIOs. The following two formats are valid:

Aliases for GPIO using controller label and line

It contains a list of the human-readable names associated with their corresponding GPIO controller name or label and line number. They must follow the format:

<alias> = <controller>,<line>

Where:

  • <alias> is the human-readable name for the GPIO

  • <controller> is the GPIO controller name or label

  • <line> is the GPIO line number

Example GPIO section
[GPIO]

# USER LED
USER_LED = gpio1,23

# USER BUTTON
USER_BUTTON = mca-gpio,1

Aliases for GPIO using Linux IDs.

It contains a list of the human-readable names associated with their corresponding GPIO Linux IDs. They must follow the format:

<alias> = <kernel_number>

Where:

  • <alias> is the human-readable name for the GPIO

  • <kernel_number> is the GPIO Linux ID

Example GPIO section
[GPIO]

# USER LED - I/O Expander IO23
USER_LED = 488

# USER BUTTON - MCA_IO1
USER_BUTTON = 505

PWM section

This is an optional section to identify PWMs. It contains a list of the human-readable names associated with their corresponding PWM identifiers. They must follow the format:

<alias> = <pwm_chip>,<pwm_channel>

Where:

  • <alias> is the human-readable name for the PWM.

  • <pwm_chip> is the PWM chip.

  • <pwm_channel> is the PWM channel used by that PWM chip.

Example PWM section
[PWM]

# PWM1 on Expansion connector (pin 27).
DEFAULT_PWM = 0,0

I2C section

This is an optional section to identify I2C buses. It contains a list of the readable names associated with their corresponding I2C bus number. They must follow the format:

<alias> = <i2c_bus>

Where:

  • <alias> is the human-readable name for the I2C.

  • <i2c_bus> is the I2C bus.

Example I2C section
[I2C]

# I2C-1 on I2C board connector.
DEFAULT_I2C_BUS = 0

SPI section

This is an optional section to identify SPI buses. It contains a list of the human-readable names associated with their corresponding SPI number and slave. They must follow the format:

<alias> = <spi_device>,<spi_slave>

Where:

  • <alias> is the human-readable name for the SPI.

  • <spi_device> is the SPI device number.

  • <spi_slave> is the SPI slave index to communicate with (SS).

Example SPI section
[SPI]

# SPI-1 on SPI board connector, slave 0.
DEFAULT_SPI = 0,0

ADC section

This is an optional section to identify ADC buses. It contains a list of the human-readable names associated with their corresponding ADC identifiers. They must follow the format:

<alias> = <adc_chip>,<adc_channel>

Where:

  • <alias> is the human-readable name for the ADC.

  • <adc_chip> is the ADC chip.

  • <adc_channel> is the ADC channel used by that ADC chip.

Example ADC section
[ADC]

# ADC1_IN2 on GPIO board connector (pin 13)
DEFAULT_ADC = 0,2