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 kernel number 505 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.

libdigiapix.conf syntax

This configuration file consist of several sections. Each section contains its own properties.

Lines starting with # are ignored.

Name Mandatory Description

[board]

yes

Section for your board details. See Board section.

[GPIO]

-

Section for GPIO aliases. See GPIO section.

Only required if GPIO aliases are going to be used.

[PWM]

-

Section for PWM aliases. See PWM section.

Only required if PWM aliases are going to be used.

[I2C]

-

Section for I2C aliases. See I2C section.

Only required if I2C aliases are going to be used.

[SPI]

-

Section for SPI aliases. See SPI section.

Only required if SPI aliases are going to be used.

[ADC]

-

Section for ADC aliases. See ADC section.

Only required if ADC aliases are going to be used.

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

[GPIO]

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

# USER BUTTON - MCA_IO1
USER_BUTTON = 505

[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

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

yes

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

  • For ConnectCore 8X SBC Express:

    Digi International ConnectCore 8X SBC Express.

  • For ConnectCore 8X SBC Pro:

    Digi International ConnectCore 8X SBC Pro.

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. 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

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

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

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

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