Firmware plugin for STSW-ESC001V1 board with ST Motor Control FOC SDK

Similar documents
EVAL6235N. Demonstration board for L6235 DMOS driver for 3-phase brushless DC motor. Description. Features

AN4507 Application note

UM0791 User manual. Demonstration firmware for the DMX-512 communication protocol receiver based on the STM32F103Zx. Introduction

AN4999 Application note

Overview of the STM32F103xx ACIM and PMSM motor control software libraries release 2.0

UM1478 User manual. STEVAL-IFN003V1: DC PMSM FOC motor driver based on the L6230 and STM32. Introduction

AN3332 Application note

AN4379 Application note

UM1746 User manual. 500 W fully digital AC-DC power supply based on the STM32F334 microcontroller. Introduction

STEVAL-ISA192V1. 7 W dual output flyback converter with standby managed by capacitive touch using VIPer0P and STM32L. Description.

Description. Table 1: Device summary Order code Package Packing STWLC33JR CSP (3.97x2.67 mm) 400 μm pitch 52 balls Tape and reel

STEVALIPMnM2N. 100 W motor control power board based on STIPN2M50T-H SLLIMM nano IPM MOSFET. Data brief. Features. Description

AN3134 Application note

STEVAL-IFN003V1. DC PMSM FOC motor drive. Description. Features

EVAL6472H-DISC. L6472 Discovery: development tool to explore L6472 motor driver. Description. Features

Getting started with the STSW-SPIN3202 firmware package

UM1763 User manual. Description of STLUX385A examples kit. Introduction. Reference documents

AN5058 Application note

AN2979 Application note

AN4014 Application Note Adjustable LED blinking frequency using a potentiometer and STM8SVLDISCOVERY Application overview

AN4564 Application note

76-81GHz MMIC transceiver (4 RX / 3 TX) for automotive radar applications. Table 1. Device summary. Order code Package Packing

Features. Description. AM15572v1_no_tab. Table 1: Device summary Order code Marking Package Packing STWA48N60DM2 48N60DM2 TO-247 long leads Tube

AN5008 Application note

Features. Description. Table 1: Device summary Order code Marking Package Packing STF5N60M2 5N60M2 TO-220FP Tube

STEVAL-IPM08B. 800 W motor control power board based on STGIB8CH60TS-L SLLIMM 2nd series IPM. Data brief. Features. Description

Sub-1GHz transceiver development kit based on S2-LP. Description

N-channel 650 V, 0.37 Ω typ., 10 A MDmesh M2 Power MOSFET in a TO-220FP ultra narrow leads package. Features. Description.

AN2581 Application note

Features. Description. Table 1: Device summary Order code Marking Package Packaging STW56N60M2-4 56N60M2 TO247-4 Tube

AN4112 Application note

Features. Description. Table 1: Device summary Order code Marking Package Packing STW48N60M2-4 48N60M2 TO247-4 Tube

STEVAL-IPM15B W motor control power board based on STGIB15CH60TS-L SLLIMM 2nd. series IPM. Data brief. Features. Description

UM2068 User manual. Examples kit for STLUX and STNRG digital controllers. Introduction

N-channel 30 V, 2.8 mω typ., 80 A STripFET H7 Power MOSFET plus monolithic Schottky in a DPAK package. Features. Description

AN4277 Application note

UM1491 User manual. 100 W 3-phase inverter demonstration board using the L6390 and STD5N52U for vector control. Introduction

Features. Description. AM15572v1_no_tab. Table 1: Device summary Order code Marking Package Packing STFH18N60M2 18N60M2 TO-220FP wide creepage Tube

ALTAIR05T W wide range CV-CC optoless adapter evaluation board

N-channel 600 V, 0.55 Ω typ., 7.5 A MDmesh M2 Power MOSFET in a TO-220FP wide creepage package. Features. Description.

Motor control power board based on the SLLIMM-nano 2nd series. Description

Features. Description. Table 1: Device summary Order code Marking Package Packing STF24N60DM2 24N60DM2 TO-220FP Tube

High voltage high- and low-side driver for automotive applications. Description. Figure 1. Block diagram BOOTSTRAP DRIVER 8 R S LEVEL SHIFTER

Features. Description. AM15572v1_tab. Table 1: Device summary Order code Marking Package Packing STP18N60DM2 18N60DM2 TO-220 Tube

Features. Description. Table 1: Device summary Order code Marking Package Packing STW56N65DM2 56N65DM2 TO-247 Tube

STEVAL-SMACH15V1. 15 W 5 V output USB adapter evaluation board with STCH03 CC-mode primary sensing switching controller. Data brief.

Features. Applications. Table 1: Device summary Order code Marking Package Packing STWA70N60DM2 70N60DM2 TO-247 long leads Tube

Automotive-grade N-channel 400 V, Ω typ., 38 A MDmesh DM2 Power MOSFET in a TO-220 package. Features. Description. Table 1: Device summary

ULN2801A, ULN2802A, ULN2803A, ULN2804A

Features. Description. Table 1: Device summary Order code Marking Package Packing STW70N60DM2 70N60DM2 TO-247 Tube

Features. Description. Table 1: Device summary Order code Marking Package Packing STL10N65M2 10N65M2 PowerFLAT 5x6 HV Tape and reel

AN4392 Application note

L6399. High voltage high and low-side driver. Applications. Features. Description

1 Electrical ratings Electrical characteristics Electrical characteristics (curves)... 6

STM32 PMSM FOC SDK v3.2. 蒋建国 MCU Application Great China

N-channel 600 V, 0.68 Ω typ., 10 A, SuperMESH Power MOSFET in a TO-220FP ultra narrow leads package. Features. Description

AN3258 Application note

ULQ2801, ULQ2802, ULQ2803, ULQ2804

P-channel -30 V, 0.01 Ω typ., A, STripFET H6 Power MOSFET in an SO-8 package. Features. Description

STEVAL-IDB008V1. Evaluation platform based on the BlueNRG-2. Description. Features

Features. Order code. Description. Table 1: Device summary Order code Marking Package Packing STL28N60DM2 28N60DM2 PowerFLAT 8x8 HV Tape and reel

N-channel 30 V, Ω typ., 23 A STripFET H7 Power MOSFET plus monolithic Schottky in a PowerFLAT 3.3 x 3.3. Features.

N-channel 30 V, 2.5 mω typ., 120 A STripFET H6 Power MOSFET in a TO-220 package. Features. Description

Automotive N-channel 60 V, 0.9 mω max., 300 A STripFET F7 Power MOSFET in a TO-LL package. Features. Description G1DTABS

N-channel 600 V, 0.35 Ω typ., 11 A MDmesh M2 Power MOSFET in a TO-220FP ultra narrow leads package. Features. Description.

AN4781 Application note

Electric Bike BLDC Hub Motor Control Using the Z8FMC1600 MCU

Features. AM15572v1_no_tab. Table 1: Device summary Order code Marking Package Packing STF27N60M2-EP 27N60M2EP TO-220FP Tube

Features. Description. AM15572v1_no_tab. Table 1: Device summary Order code Marking Package Packing STF10N60M2 10N60M2 TO-220FP Tube

STEVAL-ISA005V1. 1.8W buck topology power supply evaluation board with VIPer12AS. Features. Description. ST Components

Features. Description. Table 1: Device summary Order code Marking Package Packing STF23N80K5 23N80K5 TO-220FP Tube

N-channel 30 V, Ω typ., 160 A STripFET H7 Power MOSFET plus monolithic Schottky in a PowerFLAT 5x6. Features. Description.

Wide input and wide output voltage LED driver with high power factor and low THD based on HVLED001A

Automotive-grade N-channel 40 V, 2.9 mω typ., 55 A STripFET F6 Power MOSFET in a PowerFLAT 5x6 package. Features. Description

Motor control power board based on the SLLIMM 2nd series of IGBT IPMs. Description

STEVAL-ISA174V1. Data brief. Features. Description

UM1082 User manual. The STPM10 single-phase meter evaluation boards. Introduction

Features. Description. Table 1: Device summary. Order code Marking Package Packing STW75N60M6 75N60M6 TO-247 Tube

UM2231 User manual. Teseo-LIV3F GNSS Module - Hardware Manual. Introduction

N-channel 650 V, 0.15 Ω typ., 20 A MDmesh M2 Power MOSFET in a TO-220FP ultra narrow leads package. Features. Description.

L6398. High voltage high and low-side driver. Applications. Description. Features

N-channel 30 V, 2.15 mω typ., 120 A Power MOSFET in a TO-220 package. Features. Order code. Description. AM01475v1_Tab

Features. Description. AM01476v1. Table 1: Device summary Order code Marking Package Packaging STWA40N95K5 40N95K5 TO-247 Tube

L6494. High voltage high and low-side 2 A gate driver. Description. Features. Applications

Prerelease Product(s) - Prerelease Product(s)

Features. Description. Table 1: Device summary Order code Marking Package Packing STF140N6F7 140N6F7 TO-220FP Tube

Features. Description. Table 1: Device summary Order code Marking Package Packaging SCT50N120 SCT50N120 HiP247 Tube

RX23T inverter ref. kit

Features. Description. AM15572v1. Table 1. Device summary. Order codes Marking Package Packaging. STD13N65M2 13N65M2 DPAK Tape and reel

AN1441 Application note

Features. AM15572v1_no_tab. Table 1: Device summary Order code Marking Package Packing STFI10LN80K5 10LN80K5 I²PAKFP Tube

EVALSTPM32. Single-phase energy metering evaluation board with shunt current sensor based on the STPM32. Description. Features

AN3252 Application note

ULN2001, ULN2002 ULN2003, ULN2004

L6498. High voltage high and low-side 2 A gate driver. Description. Features. Applications

AN3248 Application note

AN4062 Application note

L6385E. High voltage high and low-side driver. Description. Features. Applications

EVAL6470H-DISC. dspin Discovery: development tool to explore dspin (L6470) motor driver. Description. Features

STM32 motor control firmware library. STM32 FOC PMSM SDK v3.0.

Transcription:

User manual Firmware plugin for STSW-ESC001V1 board with ST Motor Control FOC SDK Introduction The STSW-ESC001V1 firmware package for the STEVAL-ESC001V1 board includes the application code to support the electronic speed controller (ESC). It embeds a sensorless FOC algorithm with speed regulation and an active braking function. It also performs a PWM detection routine capable of accepting command signals from external units for driving flight control boards (FCU) or equivalent. In case of stalling, a dedicated function manages motor restart. For safety reasons, the ESC implements the arming/disarming feature. April 2017 DocID030514 Rev 1 1/22 www.st.com

Contents UM2200 Contents 1 Getting started... 4 1.1 Hardware overview... 4 1.1.1 STEVAL-ESC001V1 architecture... 5 1.2 Installing the software... 5 1.2.1 Motor Profiler update with STEVAL-ESC001V1 support... 6 1.3 Firmware package overview... 6 2 Configuring the firmware example... 8 2.1 ST Workbench tool with STEVAL-ESC001V1... 8 2.2 ST Motor profiler tool with STEVAL-ESC001V1... 10 3 STSW-ESC001V1 firmware package... 15 3.1 Application code for STEVAL-ESC001V1... 15 3.1.1 ESCboot()... 19 3.1.2 TIM2_IRQHandler( )... 19 3.1.3 PWM_FC_control()... 20 3.2 Configuration for ST Workbench tool usage... 20 4 Revision history... 21 2/22 DocID030514 Rev 1

List of figures List of figures Figure 1: STEVAL-ESC001V1 evaluation board... 5 Figure 2: STEVAL-ESC001V1 block diagram... 5 Figure 3: ST Motor Profiler tool... 6 Figure 4: SWD configuration on IAR tool... 7 Figure 5: ST Motor control workbench motor section... 8 Figure 6: ST Motor control workbench motor parameters... 9 Figure 7: ST Workbench tool... 10 Figure 8: ST Motor Profiler in Start menu... 10 Figure 9: ST Motor Profiler... 11 Figure 10: ST Motor Profiler list of boards... 11 Figure 11: ST Motor Profiler parameters... 12 Figure 12: ST Motor Profiler firmware upgrade... 13 Figure 13: ST Motor Profiler firmware upgrade status... 13 Figure 14: ST Motor Profiler profiling the motor... 14 Figure 15: ST MC Workbench motor parameters... 14 Figure 16: IAR workspace for STSW-ESC001V1 firmware... 15 Figure 17: IAR User project for STEVAL-ESC001V1 application file... 16 Figure 18: IAR User project header included... 17 Figure 19: IAR User project ESCboot function call... 18 Figure 20: IAR User project PWM decoding function... 19 Figure 21: PWM input signal for the ESC control... 19 DocID030514 Rev 1 3/22

Getting started UM2200 1 Getting started 1.1 Hardware overview The STEVAL-ESC001V1 evaluation board is based on the STM32F303 microcontroller, L6398 driver and STL160NS3LLH7 power MOSFETs. It is an electronic speed controller (ESC) designed to drive a single three phase brushless motor (BLDC/PMSM), performing a sensorless FOC algorithm with speed regulation and active braking function. This unit can accept commands from an external unit for driving and monitoring a flight control board, for instance. For this purpose, several communication bus interfaces (UART, CAN, I²C) are available. The board includes a BEC 5 V circuit and embeds an overcurrent/overvoltage and thermal protection circuit. Its form factor renders it suitable for small and light R/C vehicles and its motor current capability meets the power requirements of larger vehicles like professional drones. The STM32F303 microcontroller powering the digital section is an ARM Cortex -M4 32- bit RISC core with FPU operating at a frequency of up to 72 MHz, and embedded floating point unit (FPU) and memory protection unit (MPU). It has high-speed embedded memories with 128 Kbytes of Flash and 32 Kbytes of SRAM and an extensive range of enhanced I/Os and peripherals connected to two APB buses. The devices offer up to four fast 12-bit ADCs (5 Msps), seven comparators, four operational amplifiers, up to two DAC channels, a low-power RTC, up to five general-purpose 16-bit timers, one general-purpose 32-bit timer and two timers for motor control. They also feature standard and advanced communication interfaces: up to two I2Cs, up to three SPIs, three USARTs, up to two UARTs, CAN and USB. A dedicated port is included for microcontroller programming. The power section is based on STL160NS3LLH7 Power MOSFETs and the L6398 driver. The STL160NS3LLH7 exhibits low on-state resistance and capacitance for improved conduction and switching performance (very low on-resistance, very low Qg, high avalanche ruggedness and embedded Schottky diode) The L6398 is a high voltage device manufactured with the BCD "offline" technology. It is a single-chip half bridge gate driver for N-channel power MOSFETs or IGBTs. The highside (floating) section is designed to withstand a voltage rail up to 600 V. The logic inputs are CMOS/TTL compatible down to 3.3 V for easy microcontroller/dsp interfacing. 4/22 DocID030514 Rev 1

Figure 1: STEVAL-ESC001V1 evaluation board Getting started 1.1.1 STEVAL-ESC001V1 architecture The STEVAL-ESC001V1 power and control platform is based on the ST componentry illustrated below. Figure 2: STEVAL-ESC001V1 block diagram 1.2 Installing the software Visit www.st.com to download and install: 1. STSW-STM32100: STM32 PMSM FOC Software Development Kit v4.3 (STSW- STM32100) with the MC FW library, the Motor Control Workbench GUI and the Motor Profiler Tool. 2. STSW-ESC001V1: ESC_STM32_FOC_FW dedicated FW example based on MC FW library ESC_STMCWB_prj project for the Motor Control Workbench ESC_STMotorProfiler_addon addon to upload the STEVAL-ESC001V1 board on the current Motor Profiler version DocID030514 Rev 1 5/22

Getting started The ESC board is not provided with the firmware preloaded. UM2200 1.2.1 Motor Profiler update with STEVAL-ESC001V1 support To upgrade your Motor Profiler to version 1.1.0, paste the contents of the ESC_STMotorProfiler_addon\resources folder into the ST SDK FOC library installation folder: e.g., C:\Program Files (x86)\stmicroelectronics\foc SDK\v4.3.0\STMotorProfiler\ Replace any duplicate files. Figure 3: ST Motor Profiler tool 1.3 Firmware package overview The STSW-ESC001V1 firmware enables field oriented control (FOC) and connection with the ST MC Workbench and ST Motor profiler tools. It is based on ST PMSM FOC SDK (STSW-STM32100) and includes an FOC FW example for ESC management. The changes to the user project and MC library project include: User project space a. Main.c - modified b. STEVAL_ESC001V1.c added c. CrossCheck.h modified MC Library project space a. PWMnCurrFdbkPrivate.h - modified b. PWMnCurrFdbkClass.h - modified c. R3_1_F30X_PWMnCurrFdbkClass.h - modified d. R3_1_F30X_PWMnCurrFdbkClass.c - modified e. NTC_TemperatureSensorClass.c - modified f. PWMnCurrFdbkClass.c - modified 6/22 DocID030514 Rev 1

g. Control stage parameters.h - modified Getting started You can compile the source code by selecting STM32303C-EVAL_SINGLEDRIVE in the IAR Workbench project settings and upload the firmware to the microcontroller. For hardware connection details, refer to user manual UM2197 Electronic speed controller for BLDC and PMSM three phase brushless motor on www.st.com. Before uploading the firmware, set the SWD interface in the IDE tool. Figure 4: SWD configuration on IAR tool DocID030514 Rev 1 7/22

Configuring the firmware example UM2200 2 Configuring the firmware example 2.1 ST Workbench tool with STEVAL-ESC001V1 1 Open the SDK43x-STM32F303-STEVAL_ESC001V1.stmcx workbench project from the ESC_STMCWB_prj folder. Figure 5: ST Motor control workbench motor section 8/22 DocID030514 Rev 1

Configuring the firmware example 2 You can enter the motor parameters manually if you know them. If you do not know the motor parameters, you can use the Motor Profiler tool to calculate them. All the other parameters, power stage, control stage and driver management are already prefilled for STEVAL-ESC001V1 Figure 6: ST Motor control workbench motor parameters 3 Click on the generation button. The header files are built in the FW FOC library package of at:..\stsw-esc001v1\esc_stm32_foc_fw\web\systemdriveparams 4 Compile the workspace for STM32303C-EVAL_SINGLEDRIVE with IAR workbench tool. You should now be able to work with ST MC SDK. DocID030514 Rev 1 9/22

Configuring the firmware example UM2200 5 Use the ST Workbench tool to monitor the main FOC algorithm variables, motor speed, applied bus voltage and board temperature. The STEVAL-ESC001V1 board communicates with ST MC Workbench through a typical USB/RS232 converter connected to the UART port on the board. Figure 7: ST Workbench tool 2.2 ST Motor profiler tool with STEVAL-ESC001V1 The Motor Profiler tool can determine unknown motor parameters 1 Launch ST Motor Profiler from the start menu. Figure 8: ST Motor Profiler in Start menu 10/22 DocID030514 Rev 1

Configuring the firmware example 2 The start screen of the Motor Profiler tool appears. Figure 9: ST Motor Profiler 3 Click the Select Boards button in the Motor Profiler to open a list of supported boards. The Motor Profiler feature can only be used on the systems listed there. 4 Select the STEVAL-ESC001V1 board Figure 10: ST Motor Profiler list of boards DocID030514 Rev 1 11/22

Configuring the firmware example UM2200 5 Fill in the required fields i.e., Pole Pairs, Max Speed, Max Current, Vbus and Magnetic Figure 11: ST Motor Profiler parameters 6 Check the boards are correctly configured for motor control, supplied with an appropriate input voltage and connected with the serial communication cable and JTAG/SWD programming cable. 7 Click on the Connect button. a. If the programming procedure can t be executed, check the JTAG/SWD programming cable. a. If the programming procedure is executed but Motor Profiler still can t communicate with the board, check the serial communication connections. 12/22 DocID030514 Rev 1

Configuring the firmware example 8 If the board is new or the flash on the microcontroller has been erased, click Upgrade Firmware to automatically load the correct firmware onto the microcontroller. Figure 12: ST Motor Profiler firmware upgrade 9 You can monitor the progress of the firmware update. Figure 13: ST Motor Profiler firmware upgrade status DocID030514 Rev 1 13/22

Configuring the firmware example UM2200 10 Once connection is established, press Start Profile At the end of the procedure, all measured parameters will appear. Figure 14: ST Motor Profiler profiling the motor 11 Note the parameters (Rs, Ls, B-Emf constant, friction and inertia) and use them in the MC Workbench motor parameters table Figure 15: ST MC Workbench motor parameters 14/22 DocID030514 Rev 1

STSW-ESC001V1 firmware package 3 STSW-ESC001V1 firmware package 3.1 Application code for STEVAL-ESC001V1 The STSW-ESC001V1 firmware is configurable with the IAR tool. You can open STM32F30x_Workspace in the location shown below. Figure 16: IAR workspace for STSW-ESC001V1 firmware The user project appears as shown below; the application file with the source code for ESC functions is highlighted in red. DocID030514 Rev 1 15/22

STSW-ESC001V1 firmware package Figure 17: IAR User project for STEVAL-ESC001V1 application file UM2200 The main.c file has the following extra lines of code: 16/22 DocID030514 Rev 1

#include "STEVAL_ESC001V1.h" Figure 18: IAR User project header included STSW-ESC001V1 firmware package DocID030514 Rev 1 17/22

STSW-ESC001V1 firmware package ESCboot() Figure 19: IAR User project ESCboot function call UM2200 18/22 DocID030514 Rev 1

PWM_FC_control() Figure 20: IAR User project PWM decoding function STSW-ESC001V1 firmware package These functions form the core of the ESC management. 3.1.1 ESCboot() This function initializes the main peripheral to configure the input capture PWM. It contains an PWM_FC_Init() that configures GPIO pin PA15 to receive the PWM signal and is connected internally with TIM2 peripheral (Input Capture mode). It also configures an additional ADC (ADC3) peripheral for regular conversion by two different ADCs. 3.1.2 TIM2_IRQHandler( ) This function implements the decoding function of the input PWM. The TIM2_IRQHandler interrupt handler detects the rising and falling edge of the external PWM signal connected on INPUT channel (PA15) of the STEVAL-ESC001V1 board. A digital filter returns the average value. Figure 21: PWM input signal for the ESC control DocID030514 Rev 1 19/22

STSW-ESC001V1 firmware package 3.1.3 PWM_FC_control() UM2200 This function implements the state machine to control the motor speed based on the PWM input signal. It restarts the motor if a fault (e.g., propeller stopping suddenly) occurs. An internal time scheduler at fixed frequency regulates the change of the following states: SM_ARMING: controls the arming of the ESC (command motor start) according to the duty cycle value received. It also ensures that Ton (PWM) remains stable for a time (changeable in the FW) before changing step. SM_ARMED: the ESC calls the API function of the MC SDK to run the motor SM_POSITIVE_RUN: If no fault occurs, this state regulates the motor speed according to the Ton value and checks whether this value is above the minimum threshold.otherwise it requests a step change and stops the motor. The minimum and maximum threshold are changeable by firmware (Ton_min and Ton_max). It also manages the interruption of the PWM signal: a time delay (changeable in the firmware) is set before the motor is stopped due to ongoing failure of the PWM signal. SM_STOP: sends a stop command to the MC library and disarms the ESC. The PWM_FC_control() function also implements PWM signal stability control so that a brief (less than 1500 ms) signal interruption does not trigger a motor stoppage event. 3.2 Configuration for ST Workbench tool usage The STEVAL board can communicate with ST MC Workbench to monitor the variables and the state of the motor. Start, stop and speed regulation are managed normally by the application code, but you can disable the application functions and activate manual mode. To do so, comment the following line in STEVAL-ESC001V1.c, recompile and upload the firmware to the MCU: // #define PWM_ESC <- comment this line to enable the manual mode (ST WB mode) After selecting the COM port and setting the correct UART speed (115200), the green LED on ST Workbench signals a correct connection. 20/22 DocID030514 Rev 1

Revision history 4 Revision history Table 1: Document revision history Date Version Changes 10-Apr-2017 1 Initial release. DocID030514 Rev 1 21/22

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 22/22 DocID030514 Rev 1