Technical Application Note 0011

Configure Digital IO for the Carrida Server on an embedded board

Revision: 4.6.0
Date: 2021-05-16
Contact: support@carrida-technologies.com
Copyright: 1996-2021 Carrida Technologies GmbH, Ettlingen, Germany
Author: Carrida Support

Home page

Table of Contents

1   Linux IO Configuration - Introduction

A new feature in release 4.6.0 of the Carrida Cam Server is better support of Linux Digital IO. This technical application note explains how to setup Linux board level IO for the Carrida ALPR Server on an embedded system.

Note

Note Sign Note: This TAN covers only device specific IO, which is supported by the Linux /sys/class/gpio system.

In order to define digital IO lines for the Carrida server using the Linux gpio class, two configuration files need to be prepared:

  1. The configuration file config.json for the embedded system.
  2. The ANPR server configuration file anpr.ini.

The details are explained in the following Sections.

1.1   Define Linux IO lines in the platform configuration file

From version 4.6.0 on, the Carrida server uses a platform configuration file to define and specifiy hardware specific features, which may be used by the Carrida server. This file is named

/srv/carrida/anprServer/config.json

Typically each supported embedded platform will have such a configuration file provided by Carrida.

For the control and readout of IO lines, Carrida uses the Linux GPIO capabilities provided by

/sys/class/gpio

whenever possible.

The Carrida platform defintion uses the available Linux GPIO lines as physical lines, which are mapped to logical lines #1 .. #N for use in the Carrida server.

Note the following conventions:

  • The platform configuration is a JSON formatted text file.
  • You only need to define those IO lines, which you actually want to use in the Carrida server.
  • The logical line numbers are derived from the position inthe platform file by counting form 1. E.g. the second input line in order can be accessed as IO #2 in the anpr.ini file, it will also show up as Input line #2 in the web GUI.
  • Upon startup, the server tries to initialise all IO lines defined in the platform file. Lines which cannot be initialised will be ignored, but logged in svlog.log.
  • Default values for output lines need to be provided. These values define the O line status directly after the start of the anpr Server.

Each JSON object defines a single GPIO line. A GPIO line is defined by following three entries:

  • gpio_nr - GPIO BCM number of line
  • direction - direction of the line [in/out]
  • default_value - is relevant for output only and defines if output line should be set active/inactive upon server start.

The following is an example for the definition of IO lines on a Raspberry module in the config.json file:

{
   "io":
   {
       "lines":
       [
           {
               "gpio_nr": 79,
               "direction": "in",
               "default_value": false
           },
           {
               "gpio_nr": 89,
               "direction": "out",
               "default_value": false
           },
           {
               "gpio_nr": 75,
               "direction": "out",
               "default_value": false
           },
           {
               "gpio_nr": 81,
               "direction": "in",
               "default_value": false
           }
       ]
   }
}

By parsing platform configuration file from the listing above, the server creates two inputs and two outputs:

Maps device IO numbers (22, 23) to logical IO numbers - the order of these entries defines the logical IO numbers.

  • outputs:
    • logical index 1 for the gpio_nr 89
    • logical index 2 for the gpio_nr 75
  • inputs:
    • logical index 1 for the gpio_nr 79
    • logical index 2 for the gpio_nr 81

2   Set correct IO type in ANPR Server configuration file

After the platform configuration has been setup. the ANPR server needs to be instructed that the LINUX gpio drivers should be used for IO.

Note

Note Sign Only the configuration as LINUX IO type is required here. The remaining entries are usually defined from the WebGUI only, and should not be touched in the anpr.ini file.

The anpr.ini configuration can be found in srv/carrida/anprServer/anpr.ini.

Linux IO is choosen by adding an entry IO_Type to the CAMERA section. The value for the entry must be LINUX. The IO_ID should be set to '0'.

[CAMERA]
  IO_type = LINUX
  IO_ID=0

2.1   Restart the ANPR server

After completion of the IO setup, perform a restart of the ANPR server using the following terminal command:

sudo systemctl restart anprServer

If configuration is done correctly, the just defined IO lines should be displayed in the System tab of the Configuration site as shown below:


./images/imageTan11_3.png