Encapsulated Functions
- 1 Overview
- 2 Prerequisites
- 3 Automatic Operation Sequence
- 4 Encapsulated vs. Sequential Functions
- 5 Multiple Programming Adapters
- 6 Important Notes
- 7 1. F_AutoProgram
- 8 2. F_Verify_Access_to_MCU
- 9 3. F_Memory_Erase
- 10 4. F_Memory_Blank_Check
- 11 5. F_Memory_Write
- 12 6. F_Memory_Verify
- 13 7. F_Memory_Read
- 14 8. F_Lock_MCU
- 15 9. F_Clear_Locked_Device
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:
Open Programming Adapter Instances – Use
F_OpenInstancesAndFPAs()to open the required FPAs and create their API-DLL instances.Initialize the API-DLL Instances – Use the appropriate Generic Functions to initialize each instance.
Configure the Target MCU – Select the correct microcontroller and configure the required programming, communication, power, and reset options.
Prepare Programming Data – If firmware data is not already specified in the configuration settings, load or prepare it using Data Buffer Functions.
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:
Open Target Device
Prepares the target device according to the configured power source, supply voltage, reset behavior, and other connection settings.
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.
Execute the Requested Operation
Performs the selected operation, such as programming, erasing, reading, or verifying target memory.
Terminate Target Communication
Terminates the communication session with the target MCU after completing the requested operation.
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 |
|---|---|---|
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 |
|---|---|
| Execute the selected operation using an individual FPA. |