getting started with the fp-ind-plcwifi1 function pack for ... › resource › en › user_manual...

18
September 2017 DocID030955 Rev 1 1/18 www.st.com UM2281 User manual Getting started with the FP-IND-PLCWIFI1 function pack for PLC management via Wi-Fi Introduction FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build a mini PLC and interact with it using the ST-PLC App for mobile devices or desktops. Thanks to the provided APIs and the app available for different operating systems, the package allows managing the system and implementing several ladder logic circuits with different hardware setup. The software runs on the STM32 microcontroller and includes drivers for the SPWF01SA Wi-Fi module, the VNI8200XP and ISO8200BQ digital output ICs, and the CTL01-38SQ7 digital input IC. It also includes middleware layers for Wi-Fi communication and ladder logic programming.

Upload: others

Post on 07-Jun-2020

42 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

September 2017 DocID030955 Rev 1 1/18

www.st.com

UM2281 User manual

Getting started with the FP-IND-PLCWIFI1 function pack for PLC management via Wi-Fi

Introduction FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build a mini PLC and interact with it using the ST-PLC App for mobile devices or desktops.

Thanks to the provided APIs and the app available for different operating systems, the package allows managing the system and implementing several ladder logic circuits with different hardware setup.

The software runs on the STM32 microcontroller and includes drivers for the SPWF01SA Wi-Fi module, the VNI8200XP and ISO8200BQ digital output ICs, and the CTL01-38SQ7 digital input IC.

It also includes middleware layers for Wi-Fi communication and ladder logic programming.

Page 2: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

Contents UM2281

2/18 DocID030955 Rev 1

Contents

1 Acronyms and abbreviations ......................................................... 5

2 FP-IND-PLCWIFI1 software description ......................................... 6

2.1 Overview ........................................................................................... 6

2.2 Architecture ....................................................................................... 6

2.3 Folder structure ................................................................................. 7

2.4 APIs .................................................................................................. 7

3 System overview ............................................................................. 8

4 Firmware description ...................................................................... 9

4.1 Firmware examples ........................................................................... 9

5 System setup guide ....................................................................... 11

5.1 Hardware description ...................................................................... 11

5.1.1 STM32 Nucleo platform .................................................................... 11

5.1.2 X-NUCLEO-IDW01M1 expansion board .......................................... 12

5.1.3 X-NUCLEO-OUT01A1 expansion board .......................................... 13

5.1.4 X-NUCLEO-PLC01A1 expansion board........................................... 14

5.2 Software description ........................................................................ 14

5.3 STM32 Nucleo and expansion board setup .................................... 15

6 References ..................................................................................... 16

7 Revision history ............................................................................ 17

Page 3: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 List of tables

DocID030955 Rev 1 3/18

List of tables

Table 1: Acronyms and abbreviations ........................................................................................................ 5 Table 2: Document revision history .......................................................................................................... 17

Page 4: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

List of figures UM2281

4/18 DocID030955 Rev 1

List of figures

Figure 1: FP-IND-PLCWIFI1 firmware architecture .................................................................................... 7 Figure 2: FP-IND-PLCWIFI1 package folder structure ............................................................................... 7 Figure 3: FP-IND-PLCWIFI1 system overview ........................................................................................... 8 Figure 4: FP-IND-PLCWIFI1 firmware configuration example ................................................................... 9 Figure 5: FP-IND-PLCWIFI1 firmware connection settings ...................................................................... 10 Figure 6: STM32 Nucleo board ................................................................................................................. 11 Figure 7: X-NUCLEO-IDW01M1 Wi-Fi expansion board .......................................................................... 12 Figure 8: X-NUCLEO-OUT01A1 expansion board ................................................................................... 13 Figure 9: X-NUCLEO-PLC01A1 expansion board .................................................................................... 14 Figure 10: STM32 Nucleo development board plus X-NUCLEO-PLC01A1, X-NUCLEO-OUT01A1 and X-NUCLEO-IDW01M1 expansion boards (configuration with 8 inputs and 16 outputs) .......................... 15

Page 5: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 Acronyms and abbreviations

DocID030955 Rev 1 5/18

1 Acronyms and abbreviations Table 1: Acronyms and abbreviations

Acronym Description

IPS Intelligent power switch

GPIO General purpose input output

Page 6: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

FP-IND-PLCWIFI1 software description UM2281

6/18 DocID030955 Rev 1

2 FP-IND-PLCWIFI1 software description

2.1 Overview

The key features of the FP-IND-PLCWIFI1 package are:

Software package to build an industrial PLC with Wi-Fi connectivity based on industrial digital input/output ICs and Wi-Fi IC

Middleware libraries for Wi-Fi management and ladder logic programming

User friendly app for Android and iOS mobile devices.

Available Windows desktop version

Sample implementation for X-NUCLEO-PLC01A1, X-NUCLEO-OUT01A1 (connected to a NUCLEO-F401RE board) and X-NUCLEO-IDW01M1

Easy portability across different MCU families, thanks to STM32Cube

Free, user-friendly license terms

2.2 Architecture

The firmware has been developed to fully comply with the STM32Cube architecture and to enable application development using industrial automation drivers.

It is based on the STM32CubeHAL, the hardware abstraction layer for the STM32 microcontroller, and extends STM32Cube by providing a Board Support Package (BSP).

The firmware layers used by the application to access and use the drivers are:

STM32Cube HAL driver layer: provides a simple, generic, multi-instance set of APIs(application programming interfaces) to interact with the upper layers (application,libraries and stacks). It is composed of generic and extension APIs and is directly builtaround a generic architecture and allows the layers built on top of it, such as themiddleware layer, to implement their functions without dependending on the specifichardware configuration for a given microcontroller unit (MCU). This structure improveslibrary code reusability and guarantees an easy portability across other devices.

Board Support Package (BSP) layer: provides support for the peripherals (excludingthe MCU) on the STM32 Nucleo board through the board support package (BSP). TheBSP is a limited set of APIs which provides a programming interface for certain board-specific peripherals like the LED, the user button, etc.

Middleware Layer: Wi-Fi module and ladder libraries.

The figure below outlines the firmware architecture.

Page 7: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 FP-IND-PLCWIFI1 software description

DocID030955 Rev 1 7/18

Figure 1: FP-IND-PLCWIFI1 firmware architecture

2.3 Folder structure

Figure 2: FP-IND-PLCWIFI1 package folder structure

The following folders are included in the software package:

Documentation: contains a compiled HTML file generated from the source code, detailing the software components and APIs.

Drivers: contains the HAL drivers, the board specific drivers for each supported board or hardware platform, including the on-board components and the CMSIS vendor-independent hardware abstraction layer for the ARM Cortex-M processor series.

Middlewares: contains all the routines useful for Wi-Fi connection handling and a library to implement the Ladder Logic decoding procedure with the related circuit implementation.

Projects: contains the application level to handle the module when plugged to NUCLEO-F401RE.

Utilities: contains the boot loader binary ready to be flashed for the STM32F401RE and STM32L476RG Nucleo boards.

2.4 APIs

Detailed technical information regarding the APIs available to the user can be found in a compiled HTML file located inside the “Documentation” folder of the software package, where all the functions and parameters are fully described.

Page 8: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

System overview UM2281

8/18 DocID030955 Rev 1

3 System overview

To manage the system, the developer simply must:

1. Connect the boards to each other on the basis of the required configuration (see the figure below)

2. Connect different loads to the output (i.e., a fan, a light, a ring bell) 3. Use a mobile device to start a Wi-Fi communication

Figure 3: FP-IND-PLCWIFI1 system overview

Page 9: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 Firmware description

DocID030955 Rev 1 9/18

4 Firmware description

The firmware on the STM32 Nucleo is based on the interaction of:

the PLC and digital output codes, to directly drive the output driver stage;

the Wi-Fi code, to handle the Wi-Fi IC to create a server socket connection;

a decoding library, to analyze the programming PLC sequence sent to the system via Wi-Fi.

4.1

The firmware has been compiled with three different development tools (IAR Embedded Workbench, Keil , System Workbench for STM32).

Firmware examples

The developer can run different examples through the GUI interface for Android and iOS mobile devices and desktop version.

Once the expansion boards are plugged on top of a NUCLEO-F401RE development board, it is necessary to compile the code and flash it, using a different configuration for each expansion board.

1. If the configuration is X-NUCLEO-IDW01M1 + X-NUCLEO-PLC01A1, select PLC01A1

2. If the configuration is X-NUCLEO-IDW01M1 + X-NUCLEO-PLC01A1+X-NUCLEO-OUT01A1, select PLC01A1_OUT01A1

3. If the configuration is X-NUCLEO-IDW01M1 + X-NUCLEO-OUT01A1, select OUT01A1

Figure 4: FP-IND-PLCWIFI1 firmware configuration example

Page 10: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

Firmware description UM2281

10/18 DocID030955 Rev 1

4. After the selection and code download, run the application.

5. Once the firmware is running, connect your tablet , mobile or PC to the LadderDemo Board network

6. Run the ST-PLC App available on Google Play and Apple Store.

To enable the communication between the app and the PLC system, it is necessary to insert the following connection settings:

a. the Wi-Fi node IP address, available in your device Wi-Fi settings, to becopied and pasted by replacing the last digit with the number “1” to correctlyaddress the Wi-Fi node;

b. port number 32000.

Figure 5: FP-IND-PLCWIFI1 firmware connection settings

7. Once the Wi-Fi parameters are set, click the Test Connection button to verify the network

8. If the connection is successfully established, start drawing the circuit and program it on the PLC.

Other prototype customized firmware configurations can be built very easily starting from the package functions and exploiting the STM32Cube ecosystem.

Page 11: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 System setup guide

DocID030955 Rev 1 11/18

5 System setup guide

5.1 Hardware description

This section describes the hardware components needed for developing an industrial application based on intelligent power switch.

5.1.1 STM32 Nucleo platform

STM32 Nucleo development boards provide an affordable and flexible way for users to test solutions and build prototypes with any STM32 microcontroller line.

The Arduino™ connectivity support and ST morpho connectors make it easy to expand the functionality of the STM32 Nucleo open development platform with a wide range of specialized expansion boards to choose from.

The STM32 Nucleo board does not require separate probes as it integrates the ST-LINK/V2-1 debugger/programmer.

The STM32 Nucleo board comes with the comprehensive STM32 software HAL library together with various packaged software examples.

Figure 6: STM32 Nucleo board

Information regarding the STM32 Nucleo board is available at www.st.com/stm32nucleo

Page 12: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

System setup guide UM2281

12/18 DocID030955 Rev 1

5.1.2 X-NUCLEO-IDW01M1 expansion board

The X-NUCLEO-IDW01M1 is a Wi-Fi evaluation board based on the SPWF01SA module, which expands the STM32 Nucleo boards. The CE, IC and FCC certified SPWF01SA module has an embedded STM32 MCU, a low-power Wi-Fi b/g/n SoC with integrated power amplifier and power management and an SMD antenna. The SPWF01SA module is also equipped with 1 MByte of external FLASH for firmware update over-the-air (FOTA). The firmware features a complete software IP stack to open up to 8 TCP/UDP sockets, as well as dynamic web pages with SSI to interact with the module and a REST API (get & post) for conveniently transferring files to/from servers in the cloud. The module can simultaneously behave as a socket server and socket client. The firmware supports secure sockets with TLS/SSL encryption, ensuring secure end-to-end communications with the cloud, with or without authentication. The module operates as a client STA, IBSS, or miniAP (with up to 5 client STAs). The X-NUCLEO-IDW01M1 interfaces with the MCU on the STM32 Nucleo board via the UART serial port; the user can easily access the stack functions using the AT command. X-NUCLEO-IDW01M1 is compatible with both the ST morpho and Arduino UNO R3 connector layout.

Figure 7: X-NUCLEO-IDW01M1 Wi-Fi expansion board

Information regarding the expansion board is available on www.st.com at http://www.st.com/x-nucleo.

Page 13: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 System setup guide

DocID030955 Rev 1 13/18

5.1.3 X-NUCLEO-OUT01A1 expansion board

The X-NUCLEO-OUT01A1 is an Industrial Digital output expansion board based on ISO8200BQ for STM32 Nucleo boards.

It provides an affordable and easy-to-use solution involving galvanic insulation embedded in industrial power switch driver applications.

The Arduino™ UNO R3 connector compatibility allows to connect the following STM32 Nucleo development boards: NUCLEO-F103RB, NUCLEO-F302R8 and NUCLEO-F401RE.

The X-NUCLEO-OUT01A1 can be connected to the X-NUCLEO-PLC01A1 to form a powerful industrial PLC with 8 inputs and 16 outputs.

Wireless communication capabilities can be added with the X-NUCLEO-IDW01M1, which establishes communication on a smart device to manage the PLC remotely. A dedicated ST-PLC app is available for Android™ and iOS™ systems for this purpose.

This evaluation board is designed to meet industrial standard requirements.

Figure 8: X-NUCLEO-OUT01A1 expansion board

Page 14: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

System setup guide UM2281

14/18 DocID030955 Rev 1

5.1.4 X-NUCLEO-PLC01A1 expansion board

The X-NUCLEO-PLC01A1 is an industrial input/output evaluation board which expands the STM32 Nucleo board functionality with a PLC (programmable logic controller) function subset.

It is compatible with the Arduino UNO R3 connector layout and is designed around VNI8200XP (solid state relay) and CLT01-38SQ7 (octal digital termination array) devices.

The X-NUCLEO-PLC01A1 interfaces with the STM32 MCU via the SPI peripheral. Moreover, it is equipped with a set of diagnostics and activity LEDs to facilitate application debugging. It can use other STM32 plug-on expansion boards to further extend the STM32 Nucleo board functionality.

It results in a compact industrial PLC capable of managing eight analog inputs and eight outputs through the SPI peripheral. The 24 V power supply makes it possible to manage industrial range inputs (i.e. sensors, valves) and outputs (i.e. lamps, alarms). The board is not intended to use all of the features of the CLT01-38SQ7 and the VNI8200XP devices.

Figure 9: X-NUCLEO-PLC01A1 expansion board

Information about the X-NUCLEO-PLC01A1 expansion board is available on http://www.st.com/x-nucleo

5.2 Software description

The following software components are required to establish a suitable development environment for creating applications for the STM32 Nucleo equipped with the digital output expansion board:

FP-IND-PLCWIFI1: an STM32 ODE function pack which lets you build a mini PLC. The FP-IND-PLCWIFI1 firmware and related documentation is available onwww.st.com.

Development tool-chain and Compiler. The STM32Cube expansion software supports the three following environments:

IAR Embedded Workbench for ARM® (EWARM) toolchain + ST-LINK

Keil uVision5 Development Tool (MDK-ARM) toolchain + ST-LINK

Page 15: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 System setup guide

DocID030955 Rev 1 15/18

SW4STM32 Development Tool + ST-LINK

5.3 STM32 Nucleo and expansion board setup

The function pack is made by the NUCLEO-F401RE development board (based on the STM32F401RE microcontroller), the X-NUCLEO-IDW01M1 expansion board (based on the SPWF01SA Wi-Fi module), the X-NUCLEO-PLC01A1 expansion board (based on the CLT01-38SQ7 digital input IC and the VNI8200XP digital output IC) and the X-NUCLEO-OUT01A1 expansion board (based on the ISO8200BQ digital output IC).

Before building a stack connecting the boards, the user has to to take into account the schematic to verify whether all the connections and drop jumpers available by default on the NUCLEO boards and the expansion boards used are in line with the purpose; after this check, by keeping the two main boards, the NUCLEO-F401RE development board and the X-NUCLEO-IDW01M1 expansion board, it is possible to build different PLC configurations, based on the number of inputs and outputs the user wants to manage with the PLC.

The following configurations are possible:

8 inputs and 8 outputs, by adding the X-NUCLEO-PLC01A1 expansion board only;

8 inputs and 16 outputs, by adding the X-NUCLEO-PLC01A1 andX­NUCLEO­OUT01A1 expansion boards;

8 outputs, by adding the X-NUCLEO-OUT01A1 expansion board only.

Once the system is built:

provide 24 V to the screw connector

manage the inputs

set the switch to VCC or ground, depending on the circuit to be implemented

connect the outputs to a load to be driven

program the required circuit via the ST-PLC App

Figure 10: STM32 Nucleo development board plus X-NUCLEO-PLC01A1, X-NUCLEO-OUT01A1 and X-NUCLEO-IDW01M1 expansion boards (configuration with 8 inputs and 16 outputs)

Page 16: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

References UM2281

16/18 DocID030955 Rev 1

6 References

All of the following resources are freely available on www.st.com.

1. ISO8200BQ datasheet (DS10781)2. VNI8200XP datasheet (DS5996)3. CLT01-38SQ7 datasheet (DS11183)4. SPWF01SA, SPWF01SC datasheet (DS10078)5. UM1918: Getting started with the X-NUCLEO-PLC01A1 industrial input/output

expansion board for STM32 Nucleo6. UM2209: Getting Started with X-NUCLEO-OUT01A1 industrial digital output

expansion board for STM32 Nucleo7. UM1975: Getting started with X-NUCLEO-IDW01M1 Wi-Fi expansion board based on

SPWF01SA module for STM32 Nucleo8. UM2284: Getting started with the ST-PLC App for ladder logic programming

Page 17: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281 Revision history

DocID030955 Rev 1 17/18

7 Revision history Table 2: Document revision history

Date Version Changes

15-Sep-2017 1 Initial release.

Page 18: Getting started with the FP-IND-PLCWIFI1 function pack for ... › resource › en › user_manual › dm... · FP-IND-PLCWIFI1 is an STM32 ODE function pack which lets you build

UM2281

18/18 DocID030955 Rev 1

IMPORTANT NOTICE – PLEASE 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 acknowledgement.

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. 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.

© 2017 STMicroelectronics – All rights reserved