2397314_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2397314_en-US

2397314_en-US

Using FreeMASTER block in Simulink


1

Table of Contents




2

Overview


This article introduces the FreeMASTER blocks available in NXP Model-Based Design Toolbox (MBDT) and explains how they are used within a Simulink model to prepare an application for FreeMASTER integration.

The primary focus is the FreeMASTER Config block, which enables the FreeMASTER Driver in the generated application and allows users to configure the communication interface and runtime parameters required by FreeMASTER. The article also introduces the FreeMASTER Recorder block, which can be used to add data-recording capabilities to the application.

Why is this Important?

Before FreeMASTER can communicate with an embedded application, the FreeMASTER Driver should be enabled and configured in the embedded application. The FreeMASTER blocks provided by MBDT simplify this integration process by allowing all required settings to be configured directly within the Simulink environment.

This article is intended for:

  • Simulink users working with NXP Model-Based Design Toolbox
  • Developers integrating FreeMASTER into embedded applications
  • Engineers interested in runtime monitoring and debugging
  • Users preparing an application for future interaction with FreeMASTER

By reading this article, you will understand how FreeMASTER support is enabled within a Simulink model and how the generated application is prepared for runtime communication and data access. You will also learn how the code-generation process produces an ELF file containing symbolic information corresponding to application variables, which is later used by FreeMASTER to access, monitor, and visualize application data.



3

Context


Dedicated Simulink blocks integrate FreeMASTER into a Model-Based Design Toolbox project by automatically generating the software infrastructure required by the application.

The overall workflow is illustrated below:

dragostoma_0-1784636089488.png

Figure 1. FreeMASTER workflow

In this workflow, the FreeMASTER blocks serve as the interface between the Simulink model and the FreeMASTER Driver that will be included in the generated application.



4

FreeMASTER Blocks


FreeMASTER blocks can be found in the MBDT library under:

S32K3xx Core, System, Peripherals and Utilities → Utility Blocks

dragostoma_1-1784636129421.png

Figure 2. FreeMASTER Simulink Library

Three blocks are available for FreeMASTER integration:

  • FreeMASTER Config block
  • FreeMASTER Poll block
  • FreeMASTER Recorder block

4.1 FreeMASTER Config Block

The FreeMASTER Config block is responsible for enabling and configuring the FreeMASTER Driver within the generated application. It inserts the software infrastructure required for communication between the embedded target and the FreeMASTER desktop tool and serves as the foundation for integrating FreeMASTER functionality into a Simulink model.

dragostoma_2-1784636149271.png

Figure 3. FreeMASTER Config block

This block provides a configuration interface divided into two sections: communication settings and runtime settings.

4.1.1 General Tab

The General tab contains communication-related parameters:

  • Connection Type – selects the communication interface used by FreeMASTER.
  • Instance – specifies the peripheral instance assigned to FreeMASTER communication.
  • Baudrate – defines the communication speed.
  • ISR Priority – sets the interrupt priority associated with FreeMASTER communication.
dragostoma_3-1784636164202.png

Figure 4. FreeMASTER General tab

During configuration, a dedicated communication peripheral is assigned to the FreeMASTER Driver. In the example shown, communication is performed through LPUART6 operating at 115200 bps.

Note: The peripheral assigned to FreeMASTER should not be reused simultaneously for other communication purposes. During initialization, the FreeMASTER Driver assumes control of the communication resources associated with the selected peripheral.

4.1.2 FreeMASTER Configuration Tab

The FreeMASTER Configuration tab contains runtime-related settings:

  • Mode – defines the FreeMASTER operating mode.
  • Number of Scopes – specifies the number of available scope instances.
  • Max Variables – defines the maximum number of variables handled by a scope.
  • Automatic Buffer Size – automatically calculates communication buffer size.
  • FIFO Receiver Queue Size – configures the receive queue used by the communication driver.
dragostoma_4-1784636183944.png

Figure 5. FreeMASTER Configuration tab

Together, these settings determine how the FreeMASTER Driver operates within the generated application.

4.2 FreeMASTER Recorder Block

In addition to the configuration block, MBDT provides a FreeMASTER Recorder block that enables support for FreeMASTER recording functionality.

dragostoma_5-1784636199716.png

Figure 6. FreeMASTER Recorder block

Unlike the Config block, which is primarily focused on communication setup and driver integration, the Recorder block is designed for high-speed monitoring and visualization of application variables. It configures data acquisition resources that can be accessed later through the FreeMASTER desktop application, enabling detailed analysis of system behavior.

The Recorder block is typically placed in application execution paths where rapidly changing signals need to be captured periodically. To support this, it uses an on-board memory buffer to store acquired samples, allowing high-frequency data to be recorded without requiring immediate transfer to the host PC. The buffered data can then be retrieved and displayed in FreeMASTER for waveform visualization, performance evaluation, and post-run analysis.

The block provides the following configuration parameters:

  • Id – unique identifier of the recorder instance.
  • Name – user-defined recorder name.
  • Buffer Size – amount of memory allocated for storing captured samples.
  • Timebase – time reference used during recording operations.
dragostoma_6-1784636215463.png

Figure 7. FreeMASTER Recorder block parameters

The Recorder block is optional and can be used whenever runtime data recording capabilities are required.

4.3 FreeMASTER Poll Block

MBDT also provides a FreeMASTER Poll block, which allows the application to explicitly call the FreeMASTER polling function within the Simulink model.

dragostoma_7-1784636229746.png

Figure 8. FreeMASTER Poll block

The Poll block does not require any configuration parameters. Its purpose is to provide a configurable location within the application where FreeMASTER communication handling and command processing can be executed.

dragostoma_8-1784636242667.png

Figure 9. FreeMASTER Poll block mask

The role of the Poll block depends on the operating mode selected in the FreeMASTER Config block. When the FreeMASTER Driver is configured in Poll Mode, the Poll block is responsible for both communication handling and command processing. When the Driver operates in Short Interrupt Mode, communication is handled by interrupts, while command processing is performed through the Poll block.

Note: For both Poll Mode and Short Interrupt Mode, the Poll block is required and should be placed in an execution path that runs periodically, such as the application's main step function, to ensure timely processing of FreeMASTER requests.

When the FreeMASTER Driver is configured in Long Interrupt Mode, communication handling and command processing are performed entirely by the driver interrupt routines. In this configuration, the Poll block is not required, and its execution has no effect on FreeMASTER operation.

The Poll block complements the FreeMASTER Config and FreeMASTER Recorder blocks by providing a configurable mechanism for communication processing when required by the selected FreeMASTER operating mode.



5

Generated ELF File


Once the FreeMASTER blocks have been added and configured, the model can be built using the standard code-generation workflow provided by Embedded Coder and MBDT.

In addition to the application code generated from the Simulink model, the build process also produces an ELF (Executable and Linkable Format) file. When debug information is enabled during the build process, the ELF file contains symbolic information about application variables, functions, and memory locations stored in the DWARF debug sections. Otherwise, this information may be removed, preventing the FreeMASTER desktop tool from extracting the symbols required for variable access and monitoring.

The ELF file is later loaded by the FreeMASTER desktop tool, allowing variables to be identified automatically without requiring manual memory address entry. This enables features such as variable monitoring, runtime configuration, data visualization, and recording.

Note: Generating a valid ELF file with debug information is an important preparation step before attempting to establish communication with the target application.


6

References


  • Introduction to FreeMASTER
  • FreeMASTER Driver and Documentation Package – The FreeMASTER Driver and its accompanying documentation are delivered as part of the MBDT installation. After installing the toolbox, they can be found in the root installation directory:
    NXP_MBDToolbox_S32K3\FreeMASTER\


7

Conclusion


This article introduced the FreeMASTER Configuration blocks provided by NXP Model-Based Design Toolbox and explained their role in preparing a Simulink model for FreeMASTER integration. By configuring the block appropriately, developers can include the required FreeMASTER support in the generated application and produce an ELF file suitable for runtime access to application data.

The next article in this series will demonstrate how to use the generated application and ELF file to establish a connection between the target device and the FreeMASTER desktop application.

Tags (1)
No ratings
Version history
Last update:
7 hours ago
Updated by: