Engee documentation

Artery 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 launching models on the target hardware: environment preparation, connection, generation and assembly, as well as basic startup verification.

This article describes the features of running models on Artery AT32 microcontrollers in the mode Target Hardware.

To work with Artery AT32 cards in the mode Target Hardware The block is being used EDM-Target-Artery. It provides code generation, firmware assembly and download, as well as running the model on a microcontroller.

edm target artery

Peripheral configuration (timers, USART, DMA, GPIO, ADC) is performed in the AT32 Workbench environment, the official Artery tool for project generation.

Parameters of the EDM-Target-Artery block

Block EDM-Target-Artery configures interaction with the microcontroller through the following parameters:

  • Модель МК: — the microcontroller model (for example, AT32F435ZMT7). When specifying auto It is detected automatically from the AT32 Workbench project.

  • Путь к проекту AT Workbench: — the full path to the folder of the generated AT32 Workbench project (contains CMakeLists.txt and the file .ATWP).

  • Путь к тулчейну для сборки: — full path to arm-none-eabi-gcc. When specifying auto The search is performed automatically: first, by environment variables (ARM_NONE_EABI_PATH, ARM_GCC_TOOLCHAIN_PATH, GCC_ARM_NONE_EABI_PATH), then in the AT32 IDE paths, then in PATH.

  • Программатор: — type of programmer: openocd or at-link-console.

  • Путь к утилите для прошивки: — full path to ATLink_Console.exe (AT-Link Console) or openocd.exe (OpenOCD). When specifying auto The search is performed automatically: first, by environment variables (ATLINK_CONSOLE_PATH, AT_LINK_CONSOLE_PATH), then in the AT32 IDE paths, then in PATH.

  • COM порт: — serial port for interactive mode (for example, COM3 or /dev/ttyACM0).

  • Резервируемый модуль USART: — the USART number used for the interactive mode. Must match the USART module (USART1–USART6, UART4–UART8) configured in AT32 Workbench.

Required Software

To work with Artery AT32, you need to install the following tools:

  • AT32 Workbench — for configuring the microcontroller peripherals and generating a project with the CMake build system. You can download it from official Artery website.

  • The compiler arm-none-eabi-gcc — It is recommended to use the AT32 IDE version or install it separately.

  • Programmer — OpenOCD with AT32 or AT-Link Console support.

It is allowed to work without the AT32 IDE. In this case, it must be installed separately.:

  • The compiler arm-none-eabi-gcc.

  • OpenOCD or AT-Link Console for firmware.

There are two ways to use utilities.:

  • Specifying utilities manually — specify the full path to the compiler and programmer in the block parameters EDM-Target-Artery.

  • Mode autoEngee it will search for utilities automatically. In this case, the environment variable is used. PATH, and utilities should be available through it.

Preparation Engee

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

If the support package is already installed, you can proceed to launch the client program and connect using the provided URL.

Preparation of the AT32 Workbench project

  1. Install and configure AT32 Workbench.

  2. Create a project for your microcontroller AT32:

    • Select the target microcontroller (for example, AT32F435ZMT7).

    • Set up the necessary peripherals.

  3. In the project settings, select the CMake build system and click Generate Code:

    at32 workbench cmake

  4. Save the project to a convenient directory. Make sure that there are files in the root of the project.:

    • CMakeLists.txt — the CMake build root file;

    • <ProjectName>.ATWP — configuration file AT32 Workbench;

    • cmake/at32_workbench/CMakeLists.txt — CMake toolchain file.

  5. Make sure that main.c contains custom AT32 Workbench sections (added automatically during generation):

    /* add user code begin private includes */
    /* add user code end private includes */
    
    /* add user code begin 0 */
    /* add user code end 0 */
    
    /* add user code begin 2 */
    /* add user code end 2 */
    
    /* add user code begin 3 */
    /* add user code end 3 */

Setting up and launching the model

  1. Open the model Engee.

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

    target hardware 1

  3. Add a block EDM-Target-Artery from the library of blocks to the canvas Engee. If the block is missing, update the support package with the command:

    engee.package.start("Engee-Device-Manager")
  4. Configure the block EDM-Target-Artery:

    • Модель МК: — specify the model of your MK or auto for automatic detection;

    • Путь к проекту AT Workbench: — specify the path to the project folder;

    • Путь к тулчейну для сборки:auto or the full path to arm-none-eabi-gcc;

    • Путь к утилите для прошивки:auto or the full path to the programmer.

      edm target artery params

  5. Select the model execution mode:

    • Run the model on hardware target hardware 4 — interactive execution with control from Engee.

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

  6. Click the start button.

If the block EDM-Target-Artery not added to the model, an error will appear at startup: ErrorException("EDM-Target-Artery block not found. To start model in Target Hardware mode, the model must include an EDM-Target-Artery block.")

Interactive mode

Interactive mode uses a USART with DMA to communicate with Engee.

Model Execution Scheduler (timer) it is configured automatically. Engee He reserves a free timer, calculates the time limit and period, and adds a call. model_tick() — Manual timer setting in AT32 Workbench is not required.

  1. In the AT32 Workbench, select the free USART module (USART1–USART6 or UART4–UART8). Turn it on:

    usart interactive enable

  2. Configure the USART settings:

    • ModeAsynchronous;

    • Baud Rate115200 Bit/s;

    • Word Length8 Bits;

    • Stop Bits1;

    • ParityNone.

    usart interactive params

  3. Enable DMA for the selected USART:

    • Go to the DMA tab.

    • Click Add and add DMA RequestUSARTx_RX, where x — the number of the reserved USART module.

    • In the Priority field, specify High. In the DMA Request Settings, set Mode to Circular.

      dma usart rx circular

    • Add a second DMA RequestUSARTx_TX. In the Priority field, specify High. In the DMA Request Settings, set Mode to Normal.

      dma usart tx normal

  4. Generate the project again (Generate Code).

  5. In the block parameters EDM-Target-Artery specify:

    • Redundant USART module — USART number (for example, 1 for USART1);

    • COM port is the device port.

      edm target artery comport

Examples of COM ports:

  • Linux — /dev/ttyACM0;

  • Windows — COM1.

Checking available ports:

  • Linux: ls /dev | grep ttyACM;

  • Windows: open «Device Manager» → «Ports (COM and LPT)» — the port number is specified in the device name (for example, COM3).

Solving possible problems

Problems of tulchain detection

If an error appears stating that the compiler or programmer has not been found:

  • Specify the path manually in the block parameters EDM-Target-Artery Instead of auto.

  • Check that the utilities are available via a variable PATH.

  • Make sure that the AT32 IDE is installed (contains arm-none-eabi-gcc and ATLink_Console.exe).

Assembly problems

  • Check that CMake is selected as the build system in AT32 Workbench.

  • Make sure that the root of the project has CMakeLists.txt.

  • Build errors are displayed in the interface of the client program with full output.

Firmware issues

  • Check the connection of the programmer (AT-Link or compatible).

  • Make sure that the microcontroller is powered and in debugging mode.

  • For OpenOCD, check for configuration files interface/atlink.cfg and target/at32f435xx.cfg.

Problems with the USART connection

When reporting Unable connect to target:

  • Check the reliability of the USB connection.

  • Make sure that the TX/RX connection is correct.

  • On Linux, add a user to a group that has access to serial devices (for example, dialout or uucp — depending on your distribution).

Damage to user sections

If the markers were deleted /* add user code begin …​ */ in main.c or CMakeLists.txt:

  • Delete the corrupted files.

  • Generate the project again in the AT32 Workbench (using the Generate Code button).