Encapsulated Functions

Encapsulated Functions

Overview

Encapsulated Functions provide a convenient way to execute complete programming operations with minimal application-level control.

Each function automatically manages the entire operation, including target initialization, communication setup, execution of the requested action, and target disconnection.

Unlike Sequential Functions, which allow individual programming steps to be controlled separately, Encapsulated Functions handle the complete operation in a single API call.

This makes them particularly suitable for automated production programming, firmware updates, device verification, and applications where a simplified programming workflow is preferred.

Prerequisites

Before calling an Encapsulated Function, the programming environment must be properly configured:

  1. Open Programming Adapter Instances – Use F_OpenInstancesAndFPAs() to open the required FPAs and create their API-DLL instances.

  2. Initialize the API-DLL Instances – Use the appropriate Generic Functions to initialize each instance.

  3. Configure the Target MCU – Select the correct microcontroller and configure the required programming, communication, power, and reset options.

  4. Prepare Programming Data – If firmware data is not already specified in the configuration settings, load or prepare it using Data Buffer Functions.

  5. Select the FPA – Use F_Set_FPA_index() to select an individual adapter or all opened and enabled FPAs.

Once these steps are completed, an Encapsulated Function can perform the requested operation automatically.

Automatic Operation Sequence

When an Encapsulated Function is called, the API-DLL automatically executes the following sequence:

  1. Open Target Device

    • Prepares the target device according to the configured power source, supply voltage, reset behavior, and other connection settings.

  2. Establish Target Communication

    • Establishes communication using the configured programming interface, such as JTAG or SWD.

    • Performs device identification and clock calibration, as applicable to the selected MCU.

  3. Execute the Requested Operation

    • Performs the selected operation, such as programming, erasing, reading, or verifying target memory.

  4. Terminate Target Communication

    • Terminates the communication session with the target MCU after completing the requested operation.

  5. Close Target Device

    • Applies the configured final target states, including power control, reset, and programming interface signal states.

    • For F_AutoProgram(), optionally starts the target application if enabled in the configuration.

The entire sequence is handled internally by the API-DLL. The calling application does not need to execute individual target connection or disconnection functions.

Encapsulated vs. Sequential Functions

Feature

Encapsulated Functions

Sequential Functions

Feature

Encapsulated Functions

Sequential Functions

Target connection

Automatic

Controlled by the application

Target communication setup

Automatic

Controlled by the application

Programming operations

Complete operation in a single API call

Individual operations executed separately

Target disconnection

Automatic

Controlled by the application

Application-level control

Simplified

More granular

Typical use

Automated production and standard programming

Custom programming sequences and specialized operations

Multiple Programming Adapters

Encapsulated Functions are compatible with the Multi API-DLL architecture.

Use F_Set_FPA_index() to select the programming adapters involved in the operation.

FPA index

Operation

FPA index

Operation

1–64

Execute the selected operation using an individual FPA.