Getting Started With the FRDM-A-MOTABS2 Board

Contents of this document

  • 1

    Out of the Box
  • 2

    Get Hardware
  • 3

    Install Software
  • 4

    Configure Hardware

1. Out of the Box

The NXP analog product development boards provides an easy-to-use platform for evaluating NXP products. The boards support a range of analog, mixed-signal and power solutions. They incorporate monolithic integrated circuits (ICs) and system-in-package (SiP) devices that use proven high-volume technologies. NXP products offer longer battery life, a smaller form factor, reduced component counts, lower cost and improved performance in powering state-of-the-art systems.

This guide walks you through the process of setting up and using the FRDM-A-MOTABS2 board.

1.1 Kit Contents

The FRDM-A-MOTABS2 kit contents include:

  • FRDM-A-MOTABS2 board
  • 12 V DC, 5 A power supply with adapters

1.2 Additional Hardware

In addition to the kit contents, the following hardware provides further support when using this board:

1.3 Software

Before working with the evaluation board, software will need to be installed. All listed software is available on the FRDM-A-MOTABS2 evaluation board's information page.

2. Get Hardware

2.1 Board Features

The FRDM-A-MOTABS2 kit includes the following:

  • Evaluation board for the SB04 antilock braking system (ABS) chip
  • Compact size
  • FRDM shield for attaching an NXP microcontroller (MCU) evaluation board

2.2 Board Description

The jumper block on the FRDM‑A-MOTABS2 provides a way to configure the board for use with additional MCUs. Jumper J16 (DOSV) allows you to select between 3.3 V and 5.0 V, depending on the requirement of the MCU being used. Be sure to set jumper J16 to the proper voltage level (for S32K144 and KEAZ128, set DOSV to 5 V).

2.3 Board Components

See the diagram below for an overview of the FRDM-A-MOTABS2 board.

Figure 1. FRDM-A-MOTABS2 Board

3. Install Software

S32 Design Studio is a software driver built on an NXP software development kits (SDKs). This section describes how to install S32 Design Studio and use it for application development.

3.1 Installing S32 Design Studio

The following procedure explains how to obtain and install the latest version of S32 Design Studio and supported ABS controller models in the guide.

  1. Obtain the latest S32 Design Studio installer from the NXP website
  2. Run the executable file and follow the onscreen instructions

For S32 Design Studio, the SDK library is distributed with the IDE and does not require manual addition or linking.

3.2 Get the Software Driver and Example Projects

This procedure explains how to obtain the latest version of the software driver and the example projects.

  1. Download the ZIP file containing the driver and example projects from the link
  2. Unzip the downloaded file and check the folder contents listed in Table 1
Folder Name Folder Content
S32DS_Examples Example project folder for S32 Design Studio 1.2 or newer.
ABS_S32K144_BM14 The example shows how to monitor the status of the ABS controller using the ABS controller software driver. The example covers reading measurements and status information and performing actions such as clearing faults to ensure proper driver operation.

The purpose of this example project is to show how to implement pulse-width modulation (PWM) for the Pump Motor Predriver.

This project demonstrates two ways:

  1. Serial Peripheral Interface (SPI) control: Output state of pump motor predriver is driven by SPI commands (the advantage of this solution is that there is no required additional MCU pin for direct control of Pump Motor Predriver)
  2. Timer-generated PWM: PWM signal is generated on the MCU side by the Timer/PWM Module (TPM) peripheral (this solution consumes less CPU time)
The example project demonstrates how to work with the wheel speed sensor interface. The example does not cover calculation of the final wheel speed, which requires additional hardware equipment such as a wheel. The example focuses on counting the number of edges within a given time period.
Programmer_Guide This folder contains detailed API documentation for this software driver.

3.3 Import an Example Project into S32 Design Studio

The following steps show how to import an example from the downloaded zip file into S32 Design Studio.

  1. In the S32 Design Studio menu bar, click "File" → "Import", select "General" → "Existing Projects into workspace" in the pop-up window and select "Next", as shown in Figure 2
  2. Figure 2. Importing an Example Project (a)

    Figure 2. Importing an Example Project (a)
  3. Click "Browse", locate the folder containing the unzipped example files, find the ABS_S32K144_BM14 folder, select a project to import as shown in Figure 3, and select "OK"
  4. Figure 3. Importing an Example Project (b)

    Figure 3. Importing an Example Project (b)
  5. With the project loaded in the "Select root directory" box, select the "Copy projects into workspace" checkbox and select "Finish". The project appears in the S32 Design Studio workspace, where you build and run it, as shown in Figure 4
  6. Figure 4. Importing an Example Project (c)

    Figure 4. Importing an Example Project (c)

3.4 Create a New Project with ABS Controller SDK Software Driver

If you do not use the example projects, the following instructions describe how to create and set up a new project that uses the ABS controller SDK software driver.

To create a project, follow the steps below:

  1. In the S32 Design Studio menu bar, select "File" → "New" → "New S32DS Project", as shown in Figure 5
  2. Figure 5. New S32DS Project Wizard

    Figure 5. New S32DS Project Wizard
  3. When the "New S32DS Project" dialog box opens, enter a project name into the text box, select the MCU for your project (S32K144 that is used in this tutorial) and then select "Next", as shown in Figure 6
  4. Figure 6. S32DS Project Name and MCU Board Selection

    Figure 6. S32DS Project Name and MCU Board Selection
  5. In the next step, set the required project settings, such as the SDK and frameworks used, as shown in Figure 7, and then select "Finish"
  6. Figure 7. S32DS Project Settings and SDK Selection

    Figure 7. S32DS Project Settings and SDK Selection
  7. Figure 8 shows the Project Explorer panel and main.c content after creating a new project
  8. Figure 8. Created S32DS Project in S32DS Project Explorer and main.c Template

    Figure 8. Created S32DS Project in S32DS Project Explorer and main.c Template

Setting Up the Processor Expert Components

This section describes how to configure an MCU using Processor Expert components, which facilitate the whole setup process by providing a user-friendly graphical user interface (GUI) for configuration of common functions such as clocks, pin muxing and peripherals.

  1. First, ensure the workspace is set to Processor Expert view by selecting "Processor Expert" → "Show Views" in the S32DS menu, as shown in Figure 9. This action adds tabs to the workspace, including Components, Component Inspector and Component Library
  2. Figure 9. Processor Expert Show View

    Figure 9. Processor Expert Show View
  3. To run the software driver on the selected MCU, configure the SPI and general-purpose input/output (GPIO) pins used. Select the correct pins in the PinMux component for the used MCU according to the supported MCUs list, as shown in Figure 10. Use one of the example projects as a template for this step
  4. Figure 10. PinMux Component in S32DS Project

    Figure 10. PinMux Component in S32DS Project
  5. Add components for the required MCU peripherals from the S32 SDK repository, including low-power SPI (LPSPI) (spi_pal). If you use a debug console, add Low-Power Universal Asynchronous Receiver/Transmitter (LPUART) (lpuart) components, as shown in Figure 11
  6. Figure 11. Add Components from S32 SDK Repository

    Figure 11. Add Components from S32 SDK Repository
  7. All added components now appear in the Components tree, as shown in Figure 12. The S32 SDK and Processor Expert interface are closely connected. The project SDK folder includes only the peripheral drivers that correspond to the components used in the project. In S32DS, the Processor Expert serves as a graphical interface for configuring S32 SDK driver structures. The code then passes these structures to initialization functions
  8. Figure 12. Used Components in S32DS Project

    Figure 12. Used Components in S32DS Project
  9. The next step configures the added components in the Processor Expert Component Inspector. A common set of configuration steps applies to all projects. If required options are unclear, refer to the data sheets of the used MCU and MC33SB0400/401, or to existing examples
    1. Clock configuration should be done using clock_manager. There, you can select clock sources, frequencies, prescalers and clock gates for the MCU and its peripheral
    2. Perform pin muxing (as explained in previous steps) in Pin_Settings and for each MCU peripheral that uses input/output (I/O) pins, select the proper routing (muxing)
    3. Configure peripheral components such as spi_pal, lpspi and lpuart in dedicated components (see the configuration of the LPSPI component in Figure 13 as an example)
  10. Figure 13. Configuration of spi_pal Component Using Processor Expert Inspector

    Figure 13. Configuration of spi_pal Component Using Processor Expert Inspector
  11. The configuration of the MCU and the used peripherals is complete, the next step is to generate code for the components using Processor Expert:
    1. Select the icon shown in Figure 14
    2. Figure 14. Generate Processor Expert Code

      Figure 14. Generate Processor Expert Code
    3. Locate the Generated_Code folder in the project folder that contains the generated files
    4. Inspect these files to identify the names of configuration structures passed to the SDK driver initialization functions

Add the ABS Software Driver to the Project

This section describes how to add the ABS controller software driver to the project.

  1. Copy the content of the "ABS_S32K144_BM14" driver folder to the "Sources" folder in the newly created project (Figure 15 shows the list of copied files)
  2. Figure 15. Add the ABS Controller SW Driver to the Project

    Figure 15. Add the ABS Controller SW Driver to the Project
  3. Add the line highlighted in Figure 16 to main.c to access the ABS controller software driver in user code
  4. Figure 16. Link ABS Controller SW Driver

    Figure 16. Link ABS Controller SW Driver

Setting Up the ABS Software Driver

After creating the new project and adding the ABS controller software driver, set it up and associate it with the preconfigured MCU peripherals. Read the Embedded SDK software driver for ABS controller, which describes driver capabilities and the required configuration steps.

  1. Change the ABS controller model in abs/abs_model.h accordingly
  2. Create a variable of type abs_drv_data_t and pass it to all used functions (the variable stores configuration of MCU peripherals and internal data of the ABS controller software driver)
  3. Ensures that the software driver remains independent of the number of used instances by controlling the variable (the number of instances is limited only by MCU resources)
  4. Ensure that the variable remains accessible during runtime
  5. Declare the variable in the function main() or as a global variable
  6. As shown in Figure 17, configure the ABS software driver by starting with ABS_GetDefaultUserConfig(), then modifying individual settings as needed; the resulting configuration structure maps internally to the device register array for the selected model
  7. Associate the SPI and GPIO interfaces used with the ABS software driver runtime data, which provides the driver core with access to reset and software-controlled chip select via GPIOs and to SPI for communication (this enables extended functions such as PWM and wheel speed sensor (WSS) processing through additional peripherals including FTM, PIT and GPIOs for signals such as PDI, WSOx, VSO_IN and WSAI)
  8. Use the ABS_SetupSPI() function optionally to initialize the SPI peripheral with the configuration generated by the Processor Expert component named fsl_lpspi
  9. In S32DS, the ABS_SetupSPI() function passes the configuration structure to the SDK SPI driver initialization function (The ABS_SetupGPIOs() function is not used in S32 SDK)
  10. Initialize pins using the Pins_DRV_Init() function with the configuration structure generated by the PinMux component
  11. Finally, call the ABS software driver initialization function where you must pass a reference to the configured MCU peripherals, which are part of the driver data structure, and include the user configuration of the device (the approach separates responsibilities between configuration of MCU peripherals and their usage)
  12. Figure 17. Setup Function for ABS Software Driver

    Figure 17. Setup Function for ABS Software Driver

Writing Your Application Code

All application code resides in the "Sources" folder in the project directory. You can modify the code in main.c while retaining the original usage-related comments.

Follow the steps below to initialize the code with the ABS controller:

  1. Call initialization functions for all used MCU peripherals, except SPI when ABS_SetupSPI() is used earlier. Pass pointers to the generated configuration structures found in .h files in the Generated_Code folder. Figure 18 shows an example of the initialization. The code reuses all previously described steps and assumes that the user has configured clocks, pin muxing, peripherals, generated code, and implemented the ABS SW driver setup function. Refer to the code commentary to understand the implementation
  2. Figure 18. Initialization of MCU and Used Peripherals

    Figure 18. Initialization of MCU and Used Peripherals
  3. Call the setup function for the ABS SW driver (in this tutorial called SetupABSDriver()), see Figure 19
  4. After the SW driver configuration is complete, use the available functions to build the application (refer to the Programmer's Guide for function signatures and required parameters and also review the sources/abs/abs.h header file, which contains prototypes for all available functions)
  5. To keep the ABS controller operating, call ABS_FeedWatchdog() approximately every 50 ms, whether through periodic interrupts or an infinite loop with nested delays (the delay prevents excessive SPI communication overhead and avoids overloading the MCU)
  6. Figure 19. User Application Using ABS SW Driver

    Figure 19. User Application Using ABS SW Driver

Writing the user application follows the same approach as shown in the previous steps. For more complex ABS controller use cases, refer to the example projects included.

Compiling, Downloading and Debugging

To compile a project, select the "Compile" icon in the toolbar, as shown in Figure 20.

Figure 20. Compiling the Project

Figure 20. Compiling the Project

The process for downloading an application on the board in S32 Design Studio varies according to the respective MCU board. For further assistance, refer to the S32 Design Studio user guide. To download and debug on the S32K144 MCU board, follow the steps below:

  1. Select the arrow next to the debug icon in the toolbar and select "Debug Configurations", as shown in Figure 21
  2. Figure 21. Downloading the Application (a)

    Figure 21. Downloading the Application (a)
  3. In the "Debug Configurations" dialog box, select S32K144_SDK_Project_Debug under "GDB PEMicro Interface Debugging"
  4. Ensure that "C/C++ Application" contains path to.elf file of the project, see Figure 22
  5. Figure 22. Downloading the Application (b)

    Figure 22. Downloading the Application (b)
  6. Select the "Debugger" tab and set the "Interface" option to "OpenSDA Embedded Debug - USB Port". Then, select the "Refresh" button next to the Port setting to update the list of available USB ports (see Figure 23)
  7. Confirm that the "Target" is set to "S32K144F512M15". (If not, change the target with use of the "Select Device" button. Click the button, in "Select Target Device" dialog box go to "NXP" → "S32K1xx" → "S32K144F512M15" and confirm with "Select" button)
  8. Then select "Debug" and S32 Design Studio will download and launch the program on board
  9. Figure 23. Downloading the Application (c)

    Figure 23. Downloading the Application (c)

4. Configure Hardware

4.1 Driver User Configuration

The driver is static and uses a single-entry point defined by its user configuration structure. You will fill the structure with values according to your device setup. The initialization function receives this configuration directly.

Configuration options (depending on the selected model):

  1. Clock settings and monitoring: Internal clock monitoring function, oscillator clock frequency and modulation band
  2. Low-side drivers for inductive load: High-side fail-safe switch, output PWM frequency and sink current for open load detection
  3. Pump motor predriver: Control for SPI/external, overcurrent masking/filter time, slew rate and load dump
  4. Wheel speed sensor interfaces: Sensor types, I/O signal muxing, OC filter time, digital filter time, internal counter and leakage current tracking
  5. Auxiliary drivers: Warning lamp functionality, enabled/disabled
  6. Watchdog: Linear feedback shift register (LFSR) seed

For a more detailed description of the user configuration structure, refer to the programmer's guide.

4.2 Utilized Low-Level Drivers

The software driver uses low-level MCU peripheral drivers for communication, control and related functions. The software driver functionality depends on these low-level drivers.

The latest software driver is built with the NXP SDK using GNU Compiler Collection (GCC)-6.3. The software driver remains compatible with an older AML-based software driver built using GCC 4.9. To support portability across different SDKs, the analog middleware layer (AML) layer unifies the API for selected low-level drivers.

Reusing existing AML-based low-level drivers accelerates development and provides verified solutions for common tasks.

Figure 24 illustrates the software driver architecture for communication and control.

Figure 24. SW Driver Architecture

Figure 24. SW Driver Architecture

Support

Forums

Connect with other engineers and get expert advice on designing with the FRDM-A-MOTABS2 on one of our community sites.