UM1945 User Manual STM32 Nucleo Pack FOC and 6-step motor control platform for 3-phase low voltage motor Introduction The NUCLEO Pack (P-NUCLEO-IHM001) is a motor control kit based on X-NUCLEOIHM07M1 and NUCLEO-F302R8 boards. The power board with ST L6230 DMOS driver, belonging to STPIN family, provides a motor control solution for low voltage 3-phase DC brushless motor with the addition of STM32 NUCLEO board through the ST morpho connector. The driver used on power board is the L6230, a DMOS fully integrated driver for 3-phase brushless PMSM motor, assembled in PowerSO36 package, with overcurrent and thermal protection. The NUCLEO-F302R8 provides an affordable and flexible way for users to try out new ideas and build prototypes with STM32 MCU. It does not require any separate probe as it integrates the ST-LINK/V2-1 debugger and programmer. This document describes the procedure to configure this P-NUCLEO-IHM001 kit to run the low voltage motor included in the package. The evaluation board is fully configurable and ready, to support different closed loop controls based on sensorless or sensored mode, and it is compatible with 3-shunt or 1-shunt current sense measuring. The Figure 1 shows the motor control kit assembled. Figure 1. P-NUCLEO-IHM001 Pack 1. Picture not contractual September 2015 DocID028309 Rev 1 1/27 www.st.com 1 Contents UM1945 Contents 1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 Ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3 Basic user - Getting started 4 3.1 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 Building and run the motor control Nucleo Pack . . . . . . . . . . . . . . . . . . . . 6 3.3 Hardware settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Upload the firmware example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.4.1 Drag & drop procedure: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.4.2 ST-LINK tool: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Advanced user - 6-step and FOC control algorithm settings . . . . . . . 16 4.1 4.2 5 .................................. 6 6-step firmware based on X-CUBE-SPN7 . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.1 Firmware architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.1.2 Firmware parameter settings to spin different BLDC motors . . . . . . . . . 19 4.1.3 Inside the 6-step firmware 4.1.4 DAC settings for debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 ST FOC SDK – Configuration guide for P-NUCLEO-IHM001 . . . . . . . . . 20 Electrical schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Appendix A Federal Communications Commission (FCC) and Industry Canada (IC) Compliance Statements25 A.1 A.2 6 2/27 FCC Compliance Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.1.1 Part 15.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.1.2 Part 15.105 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.1.3 Part 15.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 IC Compliance Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.2.1 Compliance Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 A.2.2 Déclaration de conformité. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 DocID028309 Rev 1 UM1945 List of tables List of tables Table 1. Table 2. Table 3. Table 4. Jumper settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Screw terminal table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Connectors description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Document Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 DocID028309 Rev 1 3/27 3 List of figures UM1945 List of figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. Figure 11. Figure 12. Figure 13. Figure 14. Figure 15. Figure 16. 4/27 P-NUCLEO-IHM001 Pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 X-NUCLEO-IHM07M1 and NUCLEO-F302R8 assembled . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Motor connection with X-NUCLEO-IHM07M1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Power supply connection for X-NUCLEO-IHM07M1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 X-NUCLEO-IHM07M1 – top layer with silk-screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 X-NUCLEO-IHM07M1 connectors view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 ST-LINK utility tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 ST-LINK utility tool programming environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6-step firmware – Project workspace on IAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Generic firmware architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 X-CUBE-SPN7 software architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Current sense conditioning circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Sensors and shunt resistor circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 L6230 driver and BEMF detection circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 STM32 MCU pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 DocID028309 Rev 1 UM1945 1 Features Features The information listed below shows the main board specification data and parameters set for the X-NUCLEO-IHM07M1 expansion board included in the P-NUCLEO-IHM001 kit: 3-phase driver board for BLDC/PMSM Motors Nominal operating voltage range from 8 V to 48 V DC 2.8 A output peak current (1.4 A RMS)(a) Operating frequency up to 100 kHz Non dissipative overcurrent detection and protection Cross conduction protection Thermal measuring and overheating protection Full compatible with ST 6-Step or ST FOC control algorithm Full support for sensorless and sensor mode 3-shunt and 1-shunt configurable jumpers for motor current sensing Hall / encoder motor sensor connector and circuit Debug connector for DAC, GPIOs, etc. Potentiometer available for speed regulation Fully populated board conception with test points User LED Compatible with STM32 Nucleo boards Equipped with ST morpho connector PCB type and size: – Material of PCB - FR-4 – 4 layers layout – Copper thickness: 70 μm (external layer), 35 μm (internal layer) – Total dimensions of the expansion board: 70 mm x 66 mm a. Device characteristic DocID028309 Rev 1 5/27 26 Ordering information 2 UM1945 Ordering information To order the motor control kit based on X-NUCLEO-IHM07M1 and NUCLEO-F302R8, use the order code: P-NUCLEO-IHM001. 3 Basic user - Getting started 3.1 System architecture A generic motor control system can be basically schematized as the arrangement of three main blocks (see Figure 2): Control block: its main task is to accept user commands and configuration parameters to drive a motor. The P-NUCLEO-IHM001 is based on NUCLEO-F302R8 board that provides all digital signals to perform the proper motor driving control algorithm (for instance 6-step or FOC). Power block: the X-NUCLEO-IHM07M1 is based on 3-phase inverter topology. The core of the power block embedded on board is the driver STSPIN L6230, which contains all the necessary active power and analog components to perform a low voltage PMSM motor control. PMSM Motor: low voltage 3-phase brushless motor. Figure 2. System architecture 3.2 Building and run the motor control Nucleo Pack The P-NUCLEO-IHM001 is a complete hardware development platform (Power & Control block + Motor) for STM32 Nucleo ecosystem to evaluate a motor control solution for single motor. For a regular board operating, follow the hardware configuration shown below: 6/27 DocID028309 Rev 1 UM1945 Basic user - Getting started 1. The X-NUCLEO-IHM07M1 must be stacked on a NUCLEO-F302R8 board through the ST morpho connector. There is only one position allowed for this connection, in particular the two buttons on NUCLEO-F302R8 board (blue B1 and black B2) must be kept out, as shown in Figure 3. Figure 3. X-NUCLEO-IHM07M1 and NUCLEO-F302R8 assembled 1. The interconnection between the X-NUCLEO-IHM07M1 with STM32 NUCLEO board has been designed for a full-compatibility with a lot of control board and no modification of solder bridges is required. DocID028309 Rev 1 7/27 26 Basic user - Getting started 2. UM1945 Connect the three motor wires U,V,W at J2 connector as shown in the Figure 4: Motor connection with X-NUCLEO-IHM07M1: it is mandatory to connect the white or yellow wire to OUT1, the black one to OUT2 and the red one to OUT3, to respect clockwise and counterclockwise motor rotation, according to the firmware implementation. Figure 4. Motor connection with X-NUCLEO-IHM07M1 1. The three motor wires are identified by a colored line, marked on them. The line marked on OUT1 (refer to the white arrow in the above figure) can be white or yellow. 3. Select the jumper configuration on the power board to choose the desired control algorithm (6-step or FOC) as described below: a) On NUCLEO-F302R8 board, check jumper setting: JP1 open, JP5 (PWR) on E5V side, JP6 (IDD) closed. b) On X-NUCLEO-IHM07M1 expansion board: – Check jumper settings: J9(b) closed, JP3 closed – For 6-step control set jumper settings as: JP1 and JP2 open, J5&J6 on 1Sh side(b) – For FOC control set jumper settings as: JP1 and JP2 closed, J5&J6 on 3Sh side b. It is important that supply voltage is powered off before control mode changing 8/27 DocID028309 Rev 1 UM1945 Basic user - Getting started 4. Connect DC supply voltage on J1(c) connector and power-on (up to 12 V DC for BR2804 motor included in the Pack, as shown in Figure 5: Power supply connection for X-NUCLEO-IHM07M1). Figure 5. Power supply connection for X-NUCLEO-IHM07M1 5. At power-on (or reset) led D11 on X-NUCLEO-IHM07M1 board starts to blink according to the control algorithm choice: – 2 times for FOC mode control – 4 times for 6-step mode control After the confirmation of control algorithm selected, the system is ready to start. 3.3 6. Push the blue button on NUCLEO-F302R8 (B1) and the motor starts to spin. 7. Rotate the potentiometer on X-NUCLEO-IHM07M1 board in order to regulate the motor speed. Hardware settings TheTable 1 shows the jumper configuration on X-NUCLEO-IHM07M1 board (see also Figure 6: X-NUCLEO-IHM07M1 – top layer with silk-screen and Figure 7: X-NUCLEOIHM07M1 connectors view). According to the jumpers selection, it is possible to choose the c. For a different motor (>12V) it is mandatory to remove the jumper J9 on power board, before the power-on, to avoid to damage the NUCLEO-F302R8 board. To supply the STM32-NUCLEO from USB, the jumper JP5 must be connected between PIN 1 and PIN2. For further details on Nucleo settings refer to UM1724 available from ST web site www.st.com. DocID028309 Rev 1 9/27 26 Basic user - Getting started UM1945 1-shunt or 3-shunt mode, the current sensing circuit offset level, the hall/encoder with pullup or the external supply for NUCLEO-F302R8 board. Table 1. Jumper settings Jumper Permitted configurations Default condition JP1(1) Selection for FOC current sensing circuit. The default condition is for 6-Step control algorithm OPEN JP2(1) Selection for FOC current sensing circuit. The default condition is for 6-Step control algorithm OPEN JP3 Selection for pull-up enabling in hall/encoder detection circuit CLOSED (2) Selection to supply the Nucleo board through the X-NUCLEO-IHM07M1 * CLOSED J5(3) Selection for 1-shunt or 3-shunt configuration (single shunt by default) 2-3 CLOSED J6(3) Selection for 1-shunt or 3-shunt configuration (single shunt by default) 2-3 CLOSED J9 J7 Debug connector for DAC OPEN 1. JP1 and JP2 selection between FOC or 6-step current sensing circuit. It must be both closed (FOC selection) or both open (6-step selection - default setting) 2. It is recommended to verify that power supply voltage is not higher than 12V dc, in order to avoid damaging on NUCLEO-F302R8 board. For further details on Nucleo settings refer to UM1724 available from ST web site www.st.com. 3. J5 and J6 must have both the same configuration. Both 1-2 for three shunt configuration. Both 2-3 for single shunt configuration. On the silkscreen the correct position for three and for single shunt is indicated. Also the default position is indicated. The Table 2 shows the main connector on X-NUCLEO-IHM07M1 board. Table 2. Screw terminal table Screw terminal Function J1 Motor power supply input (8V÷48V) J2 3-phase motor connector (U,V,W) The X-NUCLEO-IHM07M1 is based on ST morpho connector, male pin headers (CN7 and CN10) accessible on both sides of the board. They can be used to connect this power board to NUCLEO-F302R8 board. All signals and power pins for MCU are available on ST morpho connector. For further details refer to UM1724 document (section 5.12 ST morpho connector) available on website www.st.com. 10/27 DocID028309 Rev 1 UM1945 Basic user - Getting started Figure 6. X-NUCLEO-IHM07M1 – top layer with silk-screen Table 3. Connectors description Part reference Description CN7 ST morpho connector CN6 Arduino UNO connector CN8 Arduino UNO connector U11 L6230 driver U10 TSV994IPT op. amp. J1 Power supply connector DocID028309 Rev 1 11/27 26 Basic user - Getting started UM1945 Table 3. Connectors description (continued) Part reference Description J9 Enable VIN supply voltage JP1, JP2 Jumpers for FOC SPEED Potentiometer CN10 ST morpho connector CN5 Arduino UNO connector CN9 Arduino UNO connector J2 Motor connector J3 Hall/Encoder sensor connector J7 Debug connector JP3 External pull-up for sensors J5, J6 Current measure mode (1Sh/3Sh) D11 LED status indicator Figure 7. X-NUCLEO-IHM07M1 connectors view 12/27 DocID028309 Rev 1 UM1945 3.4 Basic user - Getting started Upload the firmware example The motor control Nucleo Pack example firmware is pre-loaded in NUCLEO-F302R8 board. As described in the previous section, it performs two different algorithms to run the motor, 6step (trapezoidal control) or FOC (Field Oriented Control). This chapter describes the procedure to reload the firmware demonstration inside the NUCLEO-F302R8 board, in order to restart by default condition. There are two ways to do it: one is through ST-LINK tool (free download available from ST web site: www.st.com), and one with drag & drop function (suggested). 3.4.1 3.4.2 Drag & drop procedure: 1. Install ST-LINK drivers from www.st.com website. 2. On the NUCLEO-F302R8 board put JP5 jumper in U5V position. 3. Plug the NUCLEO-F302R8 Board to the host PC using a micro USB cable. If the STLINK driver is correctly installed, it will be recognized as an external memory device called "NUCLEO" or similar. 4. Take the binary file of the firmware demonstration (P-NUCLEO-IHM001.bin) and drag and drop the file into the "NUCLEO" device listed inside the disk drives list (this is showed by clicking the Start button of Windows OS interface), contained into X-CUBESPN7 firmware pack. 5. Wait until flashing is complete. ST-LINK tool: 1. Open "ST-LINK tool". 2. Connect NUCLEO-F302R8 board to PC with a USB type A to Mini-B cable through USB connector (CN1) on NUCLEO-F302R8 board. 3. Make sure that the embedded ST-LINK/V2 is configured for in-system programming on NUCLEO-F302R8 board (both CN2 jumpers ON). 4. Use “P-NUCLEO-IHM001.bin“ binary file to upload the code inside STM32, the window will appear as shown in Figure 8. DocID028309 Rev 1 13/27 26 Basic user - Getting started UM1945 Figure 8. ST-LINK utility tool 5. 14/27 Click on Target and Program buttons (see Figure 9: ST-LINK utility tool programming environment). DocID028309 Rev 1 UM1945 Basic user - Getting started Figure 9. ST-LINK utility tool programming environment 6. Click on Start and the firmware will be uploaded successfully. DocID028309 Rev 1 15/27 26 Advanced user - 6-step and FOC control algorithm settings UM1945 4 Advanced user - 6-step and FOC control algorithm settings 4.1 6-step firmware based on X-CUBE-SPN7 4.1.1 Firmware architecture overview The firmware example in X-CUBE-SPN7 is provided for three different IDE tools, in this case the IAR™ IDE workspace appears as shown in Figure 10. Figure 10. 6-step firmware – Project workspace on IAR The firmware solution is built around three independent levels that can easily interact with each others as described in the below Figure 11: Generic firmware architecture: 16/27 DocID028309 Rev 1 UM1945 Advanced user - 6-step and FOC control algorithm settings Figure 11. Generic firmware architecture Level 0: This level is divided into three sub-layers: Board Support Package (BSP): this layer offers a set of APIs relative to the hardware components in the hardware boards (Audio codec, IO expander, Touchscreen, SRAM driver, LCD drivers. etc…) and composed of two parts: – Component: is the driver relative to the external device on the board and not related to the STM32. The component driver provides specific APIs to the BSP driver external components and could be portable on any other board. In this case (X-NUCLEO-IHM07M1) the ST L6230 driver has been provided inside the firmware package. – BSP driver: it allows to link the component driver to a specific board and provides a set of friendly used APIs. The APIs naming rule is BSP_FUNCT_Action(): ex. BSP_LED_Init(),BSP_LED_On(). It is based on modular architecture, allowing to port it easily on any hardware by just implementing the low level routines. Hardware Abstraction Layer (HAL): this layer provides the low level drivers and the hardware interfacing methods to interact with the upper layers (application, libraries and stacks). It provides a generic, multi instance and functionalities oriented APIs which permit to offload the user application implementation, by providing ready to use process. For example, for the communication peripherals (I2S, UART…) it provides APIs allowing to initialize and configure the peripheral, manage data transfer based on polling, interrupt or DMA process, and manage communication errors that may raise during communication. The HAL drivers APIs are splitted in two categories: generic APIs which provides common and generic functions to all the STM32 series and DocID028309 Rev 1 17/27 26 Advanced user - 6-step and FOC control algorithm settings UM1945 extension APIs, which provides specific and customized functions for a specific family or a specific part number. Basic peripheral usage examples: this layer encloses the examples built over the STM32 peripheral using only the HAL and BSP resources. Level 1: This level is divided into two sub-layers: Middleware components: set of Libraries covering USB Host and device libraries, STemWin, FreeRTOS, FatFS, LwIP, and PolarSSL. Horizontal interactions between the components of this layer is done directly by calling the feature APIs, while the vertical interaction with the low level drivers is done through specific callbacks and static macros, implemented in the library system call interface. For example, the FatFs implements the disk I/O driver to access microSD drive or the USB Mass Storage Class.The middleware components provided with the X-CUBE-SPN7 package contain the core of the motor control algorithm: 6-step library (6Step_Lib.c/h) and interface files (stm32f302_ihm07m1.c/h). The interface file includes the map of STM32 MCU peripherals used (for instance, advanced TIMx, general TIMx, ADCx, DACx, UART etc.) to operate with the MC SixStep library. This file must be updated according with the modification done by the user through STM32CubeMX software, if channels or peripherals will be modified respect to the default configuration. At middleware level a serial communication based on UART with external PC terminal emulator has been included in X-CUBE-SPN7 package (see the UART_UI.c/h). Examples based on the middleware components: each middleware component comes with one or more examples (called also Applications), showing how to use it. Integration examples that use several middleware components are provided as well. This folder is created with STM32CubeMX software and it contains the main file for firmware initialization (peripherals, MC_6Step and UART communication). In addition a specific file (MC_SixStep_param.h) has been added to provide the complete list of parameters for MC-6Step library at application level. Inside the stm32fxxx_it.c file all interrupt handlers are defined and in particular it contains the starting point for UART communication. Level 2: This level is composed of a single layer which is global real-time and graphical demonstration based on the middleware service layer, the low level abstraction layer and the basic peripheral usage applications for board based functionalities. The Figure 12: X-CUBE-SPN7 software architecture shows the firmware architecture of XCUBE-SPN7 package, including also the HW components level. 18/27 DocID028309 Rev 1 UM1945 Advanced user - 6-step and FOC control algorithm settings Figure 12. X-CUBE-SPN7 software architecture 4.1.2 Firmware parameter settings to spin different BLDC motors The firmware example provided for P-NUCLEO-IHM001 kit is tuned for low inductance/high speed motor (reference part: Bull-Running model BR2804-1700kV, 11.1Vdc, 5A, 7 pole pairs, 19000 MaxRPM speed). The X-CUBE-SPN7 firmware package is developed to simplify the way to spin a different kind of motors with only few changes. In this case, a header file (MC_SixStep_param.h) contained inside X-CUBE-SPN7, includes several parameters organized in two sections: basic and advanced. In the first section it is possible to change the main parameters: for instance, motor pole pairs, clockwise or counter clockwise motor direction, target speed or potentiometer selection. In the advanced section, it is possible to set the PI parameters, define the alignment time or the acceleration rate during startup, change the zero crossing threshold and a lot of parameters usefully for system fine tuning. In case of different motor connected or different load condition, after the reset or power-on, the firmware is able to reduce the acceleration rate if startup fails and, at the next push button event (on NUCLEO-F302R8 board), a new value speed profile will be generated. After this changes the firmware is ready to be recompiled with IDE tool and uploaded in NUCLEO-F302R8 board. 4.1.3 Inside the 6-step firmware The main.c file contains the starting point of 6-step library for motor control, in particular the MC_SixStep_INIT() configures the basic structure of MC driver based on 6-step control algorithm and the header file (6Step_Lib.h) provides the connection between the application layer with this driver. The stm32f3xx_it.c file includes the entry point for UART communication and the handling code for BKIN interrupt. Inside the example folder the stm32F302_nucleo_ihm07m1.c contains all the MCU related functions, header files and the complete list of the peripherals used. DocID028309 Rev 1 19/27 26 Advanced user - 6-step and FOC control algorithm settings UM1945 The core of 6-step algorithm is contained inside the middleware folder (6Step_Lib.c) and its header file has the complete list of API functions available for the user at application level, for instance MC_StartMotor(),MC_StopMotor() or MC_SetSpeed(value). At the base of MC driver three main tasks run at different frequency and with different priority level, according to the specific function to cover, in particular: 4.1.4 1. High frequency task: it is dedicated for the high frequency function (advanced TIMx PWM generation, ADC reading) and it is managed at highest priority. This frequency is changeable through the STM32CubeMX software, i.e. TIM1_ARR. 2. Medium frequency task: it is dedicated for the medium frequency function (general TIMx for step timing) and it is managed at medium priority. This frequency is changeable through the STM32CubeMX software, i.e. TIM6_ARR (for NUCLEOF302R8 board). 3. Low frequency task: it is dedicated for the low frequency function (SysTick timer for Speed Loop timing) and it is managed at lowest priority. The MC_SysTick_SixStep_MediumFrequencyTask() is called at SysTick frequency (1msec), while the speed loop function is managed by SPEED_LOOP_TIME (msec) defined in MC_SixStep_param.h file. DAC settings for debug For debug purpose it is possible to use the DAC peripheral and configure the 6-step library, in order to drive the signal. The function SET_DAC_value(dac_value) allows to convert the variable “dac_value” in 16-bit format (with no sign) in analog signal so it is possible to monitor for instance the motor speed (set by default) or the potentiometer value through an external oscilloscope attached at configured pin. By default PA4 pin is configured and it is accessible through the ST morpho connector and it is typically connected to DAC_CH1 (NUCLEO-F302R8 board). Other pin are available at J7 connector according with the NUCLEO-F302R8 board used. For pin modification remember to modify also the stm32F302_nucleo_ihm07m1.h file. The DAC peripheral is on by default but it is possible to disable it through the MC_SixStep_param.h. 4.2 ST FOC SDK – Configuration guide for P-NUCLEO-IHM001 The demonstration board supports also the ST FOC library and no hardware modification is needed to run the motor with this control algorithm. In this case it is only needed to configure the board for current sensing (1-shunt or 3-shunt mode) and select the JP1, JP2 jumpers, according to the jumper settings shown on Table 1: Jumper settings. It is also available the support of MC Workbench software through the USB cable used for the NUCLEO programming. In this case it is recommended to configure the FOC SDK for USART2 on PA2 and PA3 pin. For further information about ST FOC SDK library refer to STSW-STM32100 document on ST website: www.st.com. 20/27 DocID028309 Rev 1 Electrical schematics UM1945 5 Figure 13. Current sense conditioning circuit 3V3 3V3 C1 C2 100nF10V C3 Vshunt_1 4.7uF 10V 4 R1 2.2k 680pF 10V R2 680 3 2 U10A 1 + Curr_f dbk1 - TSV994IPT 0 R3 11 R4 2.2k 3V3 4 3V3 R5 12 2.2k 13 C4 N.M. 100pF/6.3V - 11 680pF 10V Vshunt_2 U10D 14 + TSV994IPT C5 3V3 CP+ 4 R6 2.2k 5 R7 680 6 U10B 7 + R8 0 - Curr_f dbk2 TSV994IPT R9 2.2k 11 DocID028309 Rev 1 JP1 FOC R10 JP2 FOC 2.2k R11 2.2k 3V3 C6 N.M. 100pF/6.3V C7 R13 680 3V3 10 9 U10C 8 + - TSV994IPT 11 R15 2.2k R16 2.2k C8 N.M. 100pF/6.3V R14 0 Curr_f dbk3 21/27 Electrical schematics Vshunt_3 R12 2.2k 4 680pF 10V Electrical schematics 22/27 Figure 14. Sensors and shunt resistor circuit VIN+ R17 169K 1% VBUS SENSOR VBUS_SENS VBUS Temperature f eedback R18 C14 4.7nF/10V HALL/ENCODER SENSOR C10 3V3 9.31K 1% 10nF 10V 1 R19 2 3V3 JP3 R20 4K7 3V3 JUMPER NTC 10K D2 R31 1k8 C21 10pF 10V J4 C20 5V 10pF 10V R32 1k8 C19 100n D4 A+/H1 B+/H2 Z+/H3 10pF 10V Stripline m. 1x5 R30 1k8 D3 BAT30KFILM 1 2 3 4 5 R29 10k BAT30KFILM DocID028309 Rev 1 J3 A+/H1 B+/H2 Z+/H3 5V GND R28 10k BAT30KFILM R27 10k R33 R34 R35 C22 4K7 N.M. 4K7 N.M. 4K7 N.M. 1 RING SPEED REGULATION 3V3 SHUNT RESISTOR Vshunt_1 R42 100K SPEED SPEED Vshunt_2 R43 0.33 1W Vshunt_3 R44 0.33 1W R45 0.33 1W UM1945 J1 100nF/100V 3 C12 10n 100V 1 1 D1 SMBD 7000 J16 RING CP+ CPCPOUT CP+ R21 33K 3V3 C16 100n,6.3V IN1 EN1 IN1 EN1 13 28 24 9 10 GND GND GND GND EN3 IN3 EN2 IN2 CP+ CPCPOUT IN1 EN1 R24 39k R23 10K SENS1 SENS2 SENS3 VSB VSA VBOOT VCP DIAG/EN CPOUT SENS1 SENS2 SENS3 1 36 19 18 29 11 27 26 Vshunt_2 3V3 EN3 IN3 EN2 IN2 EN3 IN3 EN2 IN2 22 R22 10K DIAG/EN R26 39k C17 1nF/6.3V 3 2 1 DocID028309 Rev 1 C18 10n-N.M. 12 8 25 R25 39k OUT1 15 OUT2 5 OUT3 32 CURRENT REF L6230 DMOS driver for three-phase brushless DC motor 33 4 30 7 2 C11 100nF/100V OUT1 OUT2 OUT3 U11 L6230PD C9 C15 100uF, 63V C13 N.C. N.C. N.C. N.C. N.C. N.C. N.C. N.C. N.C. N.C. N.C. N.C. EP 220nF, 16V D12 SMBJ48A-TR 21 31 17 35 34 23 2 16 3 6 14 20 37 VIN+ 2 1 CON2 UM1945 Figure 15. L6230 driver and BEMF detection circuit Motor J2 3V3 D5 BAT30KFILM 3V3 C23 0.1uF/6.3V OUT1 GPIO_BEMF 3V3 GPIO_BEMF D6 BAT30KFILM D7 BAT30KFILM R36 2.2k R39 10k BEMF DETECTION - 6-STEP BEMF1 GPIO_BEMF 3V3 GPIO_BEMF D8 BAT30KFILM D9 BAT30KFILM OUT2 CON3 3sh 1sh J5 1 2 3 R40 10k BEMF2 CON3 Vshunt_1 SENS1 Vshunt_2 GPIO_BEMF D10 BAT30KFILM R38 2.2k R37 2.2k BEMF1 GPIO_BEMF 3sh 1sh 1 2 3 OUT3 R41 10k BEMF3 BEMF3 Vshunt_3 SENS3 Vshunt_2 J6 Electrical schematics 23/27 Currents PWM PA11 R46 0 R302 R49 0 R53 0 R56 0R 58 0 C10_14 C7_28 C7_36 C7_38 C7_30 C7_35 F302 C10_28 C10_13 C10_23 C7_1 PA6-BKIN PA8-UH PC10 PA9-VH PC11 R64 R67 0 0 R70 0R 72 0 C10_21 C7_2 C10_33 C7_3 PA10-WH PC12 DIAG/EN Vshunt_1 IN2 EN2 DocID028309 Rev 1 0 0 0 Curr_f dbk1 Curr_f dbk2 Curr_f dbk3 VBUS Temperature f eedback 3V3 R62 N.M.13K 1% R65 0 R73 0 C10_15 R69 C7_37 C7_34 C10_15 C10_26 IN3 EN3 PA15 - Enc. A/H1 PB3 - Enc. B/H2 PB10 - Enc. Z/H3 PB0 - EmbPGA R74 N.N. 4.99K PC3 - ADC PB0 - ADC PA7 - ADC R302 0 0 0 0 F302 CPOUT GPIO_BEMF R59 R60 R63 R66 BEMF1 BEMF2 BEMF3 BEMF 6-step A+/H1 B+/H2 Z+/H3 C10_11 C10_30 C10_29 PA4- DAC PB4-PWM 0-N.M. R76 0 R77 C7_32 C10_27 N.M.13K 1% CURRENT REF C10_24 1 2 3 PA5 - DAC PA5/PB13 PB5-DAC PWM 0 R80 R302 0 R82 0 R85 F302 J8 RING C10_22 CN10 C10_1 C10_3 C10_5 C10_7 C10_9 C10_11 C10_13 C10_15 C10_17 C10_19 C10_21 C10_23 C10_25 C10_27 C10_29 C10_31 C10_33 C10_35 C10_37 0 R78 PB2 R83 510 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 SPEED D11 RED J9 2 5V ARDUINO/MORPHO CONNECTOR C7_2 C7_4 C7_18 10 E5V C7_6 C5_10 CN5 9 C7_8 3V3 C5_9 CN6 8 N.C. C7_10 C6_1 N.C. 1 C5_8 7 C7_12 C6_2 +3V3 2 C5_7 3 6 C7_14 C6_3 C5_6 4 5 C7_16 C6_4 C5_5 5 4 C7_18 C6_5 C5_4 6 3 C7_20 C6_6 C5_3 7 2 C7_22 C6_7 C5_2 8 1 C7_24 C6_8 C5_1 8 C7_26 C9_8 1 7 C7_28 C8_1 C9_7 2 6 C7_30 C8_2 C9_6 3 5 C7_32 C8_3 C9_5 4 4 C7_34 C8_4 C9_4 5 3 C7_36 C8_5 C9_3 6 2 C7_38 C8_6 C9_2 1 C9_1 CN8 CN9 PB1 J7 Stripline m. 1x3 1 CN7 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 0 R55 N.M.13K 1% C7_34 R75 VIN+ 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 PC9 - GPIO F302 DAC/REF C7_1 C7_3 C7_5 C7_7 C7_9 C7_11 C7_13 C7_15 C7_17 C7_19 C7_21 C7_23 C7_25 C7_27 C7_29 C7_31 C7_33 C7_35 C7_37 PA12- TIM1 ETR 0 R52 C10_12 C10_1 C7_30 N.N. 4.99K PA1 - EmbPGA R61 N.N. 4.99K PA7 - EmbPGA R68 Vshunt_2 R302 C10_26 R71 0-N.M. HALL/ENCODER SENSOR R79 R81 R84 R47 R48 R50 R51 R54 0 R57 IN1 EN1 Vshunt_3 C7_17 C10_31 C10_25 PA0 - PhA 0 PC1 - PhB 0 PC0 - PhC 0 PA1 - BUSV 0 PC2 - Temp. Sens.0 Electrical schematics 24/27 Figure 16. STM32 MCU pin assignment 1 VIN C7_24 OPEN BY DEFAULT 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 C10_2 C10_4 C10_6 C10_8 C10_10 C10_12 C10_14 C10_16 C10_18 C10_20 C10_22 C10_24 C10_26 C10_28 C10_30 C10_32 C10_34 C10_36 C10_38 If J9 ON: 1) 12VMAX ON J1 2) JP5 (Nucleo pin 2,3) 2) JP1 (Nucleo) Removed STM32 NUCLEO PART USED PC13 - START/STOP (B1 BUTTON) RESET - MCU RST (B2 BUTTON) UM1945 UM1945Federal Communications Commission (FCC) and Industry Canada (IC) Compliance State- Appendix A Federal Communications Commission (FCC) and Industry Canada (IC) Compliance Statements A.1 FCC Compliance Statement A.1.1 Part 15.19 This device complies with Part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation. A.1.2 Part 15.105 This equipment has been tested and found to comply with the limits for a Class B digital device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference in a residential installation. This equipment generates uses and can radiate radio frequency energy and, if not installed and used in accordance with the instructions, may cause harmful interference to radio communications. However, there is no guarantee that interference will not occur in a particular installation. If this equipment does cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference's by one or more of the following measures: A.1.3 Reorient or relocate the receiving antenna. Increase the separation between the equipment and the receiver. Connect the equipment into an outlet on a circuit different from that to which the receiver is connected. Consult the dealer or an experienced radio/TV technician for help. Part 15.21 Any changes or modifications to this equipment not expressly approved by STMicroelectronics may cause harmful interference and void the user’s authority to operate this equipment. A.2 IC Compliance Statement A.2.1 Compliance Statement Industry Canada ICES-003 Compliance Label: CAN ICES-3 (B)/NMB-3(B) A.2.2 Déclaration de conformité Étiquette de conformité à la NMB-003 d’Industrie Canada: CAN ICES-3 (B)/NMB-3(B) DocID028309 Rev 1 25/27 26 Revision History 6 UM1945 Revision History Table 4. Document Revision History 26/27 Date Version 22-Sep-2015 1 Revision Details Initial version DocID028309 Rev 1 UM1945 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. © 2015 STMicroelectronics – All rights reserved DocID028309 Rev 1 27/27 27