STMicroelectronics UM3230 X-LINUX-SPN1 Software User Manual

May 15, 2024
STMicroelectronics

STMicroelectronics UM3230 X-LINUX-SPN1 Software

STMicroelectronics-UM3230 X-LINUX-SPN1-Software-PRODUCT-
IMAGE

Product Information

Specifications

  • Software Package: X-LINUX-SPN1
  • Platform: STM32MP microprocessor
  • Components: Python APIs, GTK-based UI application
  • Control Method: GPIOs using libgpiod
  • Supported Boards:
    • X-NUCLEO-IHM15A1 board based on STSPIN840 driver
    • X-NUCLEO-IHM12A1 board based on STSPIN240 driver

Product Usage Instructions

  1. Getting Started with X-LINUX-SPN1 Software
    X-LINUX-SPN1 is a software package designed for demonstrating STSPIN family devices on the STM32MP platform.

  2. X-LINUX-SPN1 Software Features
    The software provides drivers and user space applications to control multiple channels of a motor controller.

  3. X-LINUX-SPN1 Architecture
    The software utilizes libgpiod to control motor drivers via GPIOs. It includes Python APIs and a GTK-based UI application for easy interfacing.

  4. X-LINUX-SPN1 Package Structure
    The package contains various components including Python APIs, GTK application source code, and UI resources like pictures and icons.

  5. 5. Hardware Setup
    The software supports X-NUCLEO-IHM15A1 and X-NUCLEO-IHM12A1 boards based on STSPIN840 and STSPIN240 drivers respectively.

Frequently Asked Questions (FAQ)

  1. Q: Can I develop custom applications using the X-LINUX-SPN1 package?
    A: Yes, developers can create their own applications using the provided Python APIs in the package.

  2. Q: What are the main features of the STSPIN840 and STSPIN240 motor drivers?
    A: The STSPIN840 is suitable for compact motor driving applications with parallel operation capabilities, while the STSPIN240 can control two brushed DC motors simultaneously with various protections for industrial use.

User manual
Getting started with X-LINUX-SPN1 software

Introduction

X-LINUX-SPN1 is an OpenSTLinux based software package to demonstrate STSPIN family devices on the STM32MP microprocessor platform. It provides Linux software (drivers, APIs, and applications) to target the expansion boards based on STSPIN family motor drivers. The software can be used as a starting point for developing more complex motor control applications. The included application and drivers run on the Cortex-A core(s) of the MPU.

Figure 1. X-LINUX-SPN1 PackageSTMicroelectronics-UM3230 X-LINUX-
SPN1-Software- \(1\)

Description

X-LINUX-SPN1 software features
The X-LINUX-SPN1 expansion software provides drivers and user space applications running on the STM32MP platform to control multiple channels of a motor controller.
The X-LINUX-SPN1 software package is made up of the following components:

  1. Python APIs
  2. GTK-based UI application

X-LINUX-SPN1 architecture
The software uses libgpiod to control the motor drivers via GPIOs.

STMicroelectronics-UM3230 X-LINUX-SPN1-Software- \(2\)

The provided GTK application is built on top of the Python APIs and provides a ready-to-use interface. Application developers can, however, write their own applications using the Python APIs provided with this package.

STMicroelectronics-UM3230 X-LINUX-SPN1-Software- \(3\)

X-LINUX-SPN1 package structure

The contents of the package are described below.

  •   “application”:
    • “x_linux_spn1”: This folder contains sources for the API and UI App
    • “pictures”: All the picture and icon resources required by the UI App are present in this folder.
    • “ihm12_api.py” & “ihm15_api.py”: These files implement the API used to control the respective motor drivers.
    • “spn1_ui.py”: Contains GTK-based UI application source code.
    • “spn1_ui.glade”: This file is generated by “Glade” tool and contains widgets configuration used in UI App.
    • “spn1_ui.css”: Contains visual styles used by the widgets in UI App.
  • “080-x-linux-spn1.yaml”: This file adds a menu entry to the default demo application that comes with the STM32MP1 evaluation/discovery boards
  • “deploy.sh” : This is the deployment script used to deploy files from the host computer to the MPU board. It copies the files to the correct location in the MPU filesystem, such that the demo launcher recognizes and loads the new application at startup.

Hardware setup

The current package provides software support for the following boards

  • X-NUCLEO-IHM15A1 board based on the STSPIN840 driver. The STSPIN840 is an affordable and easy-to-use solution for the implementation of compact motor driving applications such as thermal printers, robotics, and toys. It also supports parallel operation, where it acts as a single brush DC driver with double the current capability. The current limiters and complete set of protection features make it suitable for reliable applications.
  • X-NUCLEO-IHM12A1 board based on the STSPIN240 driver. The STSPIN240 can control two brushed DC motors at the same time. It comes in a very small 4×4 QFN package and a low resistance power stage. It can also work in parallel mode as a single full-bridge driver with higher current capability. It has two PWM current controllers that can be set by the user. It has a low power mode and several protections for the power stage. It is suitable for demanding industrial applications.

Subsequent versions of the package will add support for more motor drivers.

Figure 6. X-NUCLEO-IHM12A1

The board plugs into the Arduino connectors available on the back of STM32MP157F-DK2 discovery boards, as shown below.
Figure 7. X-NUCLEO-IHM15A1 mounted on STM32MP157F-DK2

Software setup

The section describes the software setup that is required for building, flashing, deploying, and running the application.

  1. Recommended PC prerequisites
    A Linux® PC running under Ubuntu® 20.04 or 22.04 must be used. The developer can follow the below link. https://wiki.st.com/stm32mpu/wiki/PC_prerequisites
    Follow the instructions on the ST wiki page Image flashing to prepare a bootable SD card with the starter package. Alternatively, a Windows/Mac computer can also be used, in which case, the following tools will be useful:

    • STM32CubeProgrammer to flash the OpenSTLinux started package image onto the SD card

    • TeraTerm or PuTTY to access the console interface via USB

    • winscp to copy the application to the MPU board
      The following conventions are used when referring to the code instructions.

    • Comments: Comment describing steps

    • PC >$ : Development or Host PC/machine command prompt. Text after $ is a command Board>$ : STM32MP1 command prompt. Text after $ is a command

  2. STMPU Software prerequisites
    Python package “gpiod” is a prerequisite for the X-LINUX-SPN1 software and must be installed onto the STM32MP1 board.

    • Install Python pip if not already installed Board>$ apt-get install python3-pip

      Install gpiod

      Board>$ python3 -m pip install gpiod

  3. Deploying the files to the MPU board
    It is required to transfer the built binaries, Python scripts, and application resources to the STM32MP board from the development PC.
    The resources can be transferred via any of the following methods:

    • Using a network connection
    • Refer to How to Transfer a File Over a Network to connect the MPU board to a network, you may connect it to a wired network via the Ethernet jack on the MPU board
    • Alternatively, to connect to a WLAN, refer to How to Setup a WLAN Connection
    • Using a serial protocol (like zmodem from Teraterm or kermit)
    • For Linux hosts, refer to How to transfer a file over a serial console
    • For Windows hosts, refer to How to transfer files to Discovery kit using Tera Term
      To evaluate the X-LINUX-SPN1 package quickly, developers may copy the contents of the “application” folder contained in the package to /usr/local/demo/application folder on the STM32MP board using any of the above methods. To facilitate this task, the deployment script in the “application” folder of X-LINUX-SPN1 package may be used (only if using a network connection).
      After the files have been copied to the MPU board, reboot the board. After reboot, the demo menu will have an option added for X-LINUX-SPN1

Figure 8. X-LINUX-SPN1 menu icon

STMicroelectronics-UM3230 X-LINUX-SPN1-Software- \(8\)

Using the GTK Application
On opening the application, the user is presented with the option to select the motor driver board to be used. The interface is depicted below.
Figure 9. Board selection STMicroelectronics-UM3230 X-LINUX-SPN1-Software-
\(9\)

Using the GTK application

The application interface contains a start/stop button and four direction buttons. The application is designed for two channels that control the left and right side motors:

  • On tapping the On/Off button, both motors start moving in the forward direction
  • On clicking the back button, both motors start moving in the reverse direction
  •  On tapping the left and right buttons, both motors move in opposite directions to turn left or right as per the user action.

The interface is depicted below.

Figure 10. Application interface

STMicroelectronics-UM3230 X-LINUX-SPN1-Software-
\(10\)

Revision history

Table 1. Document revision history

Date Version Changes
04-Dec-2023 1 Initial release.

IMPORTANT NOTICE – READ CAREFULLY

  • STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.
  • Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’ products.
  • No license, express or implied, to any intellectual property right is granted by ST herein.
  • Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
  • ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners.
  • Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
  • © 2023 STMicroelectronics – All rights reserved

UM3230 – Rev 1

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

STMicroelectronics User Manuals

Related Manuals