Engee documentation

Arduino Support Package

Before you start, do the general preparation and setup from the article Running models on target hardware. It describes the general steps for running models on target hardware: environment preparation, connection, generation/assembly, and basic startup verification.

To work with Arduino-compatible boards in this mode, the block is used EDM-Target-Arduino, which sets up interaction with the equipment.

Before starting work, you must install arduino-cli is a toolchain for compiling and firmware of Arduino hardware. After installation, copy the full path to the executable file arduino-cli[.exe] and specify it in the corresponding parameter of the EDM-Target-Arduino block.

To automatically search for arduino-cli in the EDM-Target-Arduino block for the parameter Путь к ArduinoCLI: specify the value auto in this case, the program will search for the executable file .:

  • In the directories of the system environment variable PATH;

  • In the standard program installation directories (C:\Program Files, C:\Program Files (x86) for Windows);

  • In the startup directory of the Engee client program.Integration.

If the arduino-cli is not found automatically, then specify the full path manually, for example:

  • Windows: C:\Program Files\arduino-cli\arduino-cli.exe;

  • Linux: /usr/local/bin/arduino-cli.

To work with Arduino-compatible clones, you may need to install an additional driver. For example, the Arduino Mega 2560 clone board for Windows requires a CH340 driver.

Preparation

Make sure that the hardware support package is installed and configured. Its installation is described in detail in the section Hardware connection.

Checking the arduino-cli installation

After installing the arduino-cli, it is recommended to check its performance before starting work with the Arduino support package.

Step 1. Checking the arduino-cli version

Open a terminal (command prompt) and run:

arduino-cli version

Expected result: The arduino-cli version should be displayed, for example:

arduino-cli  Version: 0.35.3 Commit: 7a72ce6 Date: 2023-11-15T12:30:00Z

If the command is not found:

  • Windows: Make sure that the arduino-cli is added to the environment variable PATH (recommended) or specify the full path:

      "C:\Program Files\arduino-cli\arduino-cli.exe" version
  • Linux: Check the installation through the package manager or install manually.

Step 2. Initialize the configuration

Create an arduino-cli configuration file:

arduino-cli config init

Expected result: A configuration file will be created:

  • Windows: %USERPROFILE%\.arduino15\arduino-cli.yaml

  • Linux: ~/.arduino15/arduino-cli.yaml

Step 3. Updating the Platform Index

Update the indexes of available platforms:

arduino-cli core update-index

Expected result: A message about a successful index update.

Step 4. Install the platform for your board

Determine the FQBN (Fully Qualified Board Name) of your board:

arduino-cli board listall

Find your board in the list and install the appropriate platform.:

  • For Arduino Uno/Nano/Mega (AVR):

    arduino-cli core install arduino:avr
  • For ESP8266:

    arduino-cli core install esp8266:esp8266 --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json
  • For ESP32:

    arduino-cli core install esp32:esp32 --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json
  • For STM32:

    arduino-cli core install STMicroelectronics:stm32 --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

Expected result: A message about the successful installation of the platform.

Step 5. Installing drivers (if necessary)

Windows

Some clone boards (such as the Arduino Mega 2560) may require a CH340 driver.:

  1. Download the driver from the manufacturer’s official website.

  2. Install the driver.

  3. Reconnect the board.

  4. Check if the new COM port appears in the Device Manager.

The STM32 ST-LINK/V2 on Windows requires installation drivers.

Linux

Usually, Serial controller drivers are built into the kernel. If the fee is not determined:

lsusb

Check the availability of your card in the list. Add udev rules if necessary.:

# Пример для Arduino
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", MODE="0666"' | sudo tee /etc/udev/rules.d/50-arduino.rules
sudo udevadm control --reload-rules
sudo udevadm trigger

To install programmer drivers, use the package manager, for example:

sudo apt install stlink-tools

Step 6. Checking the connection of the board

Connect the board to the computer via USB and run:

arduino-cli board list

Expected result: A list of connected cards should be displayed, indicating the port.:

Port         Protocol Type              Board Name  FQBN                          Core
/dev/ttyUSB0 serial   Serial Port (USB) Arduino Uno arduino:avr:uno               arduino:avr

Remember the port address (for example, /dev/ttyUSB0 for Linux or COM3 for Windows).

Step 7. Create and compile a test sketch

Create a test project or create a file test_blink/test_blink.ino with content:

void setup() {
    pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
    digitalWrite(LED_BUILTIN, HIGH);
    delay(1000);
    digitalWrite(LED_BUILTIN, LOW);
    delay(1000);
}
  • Arduino UNO

    Perform the compilation:

    arduino-cli compile --fqbn "arduino:avr:uno" test_blink

    Complete the download:

    arduino-cli upload --fqbn "arduino:avr:uno" test_blink
  • STM32

    For example, take the STM32F411CEU6 "Black pill" debugging board.

    To get all the available Board part number (pnum) and additional information about your board, use the command:

    arduino-cli board details -b STMicroelectronics:stm32:GenF4

    Specify the Board part number in the line fqbn. Perform the compilation:

    arduino-cli compile --fqbn "STMicroelectronics:stm32:GenF4:pnum=BLACKPILL_F411CE" test_blink

    Complete the download, specify upload_method depending on the one you use:

    arduino-cli upload --fqbn "STMicroelectronics:stm32:GenF4:pnum=BLACKPILL_F411CE,upload_method=OpenOCDSTLink" test_blink

Expected result: Successful compilation and download without errors. The LED on the board is blinking.

Troubleshooting issues

Problem Decision

arduino-cli: command not found

Add the arduino-cli to PATH or specify the full path.

No boards found

Check the USB cable and install the drivers.

Permission denied (Linux)

Add the user to the dialout group: sudo usermod -a -G dialout $USER.

Platform not found

Execute arduino-cli core update-index and install the platform.

Compilation failed

Check the correctness of the FQBN and the availability of installed libraries.

Setting up and launching the model

  1. Open the model Engee.

  2. Click on the target platform selection button and select Target Hardware:

    target hardware 1

  3. Add the EDM-Target-Arduino block from block libraries on canvas Engee and assemble the model or run the command engee.package.getdemos("Engee-Device-Manager") and open the demo model example_arduino-monitor-and-tune.engee.

    arduino model engee hardware 1

  4. Select and run one of the model execution modes:

    • Run the model on hardware target hardware 4 — interactive execution on the target platform with management and supervision from Engee.

    • Run in independent mode target hardware 3 — offline execution on the target platform without control from Engee.

Execution modes

For more information about the operating modes of Target Hardware, see the article Running models on target hardware.

When running the model interactively with configurable parameters, it is necessary in the model settings panel on the tab "Code generation" set for the parameter Default parameter behaviour meaning Tunable.

When running the model in interactive mode, there must be recorded at least one model signal.