### dm00117753

```UM1771
User manual
EVAL6474H-DISC: fully integrated microstepping motor driver
based on the L6474 and STM32™
Introduction
The EVAL6474H-DISC is a low cost development tool based on the L6474 and STM32™.
It is an ideal starter kit for both beginners and experienced users, it is autonomous and can
be used with a software interface, or it can be used with custom firmware thanks to the
embedded microcontroller with the 128 kB Flash memory and 64 kB RAM.
Through the available GUI the user can easily set the full configuration of application
parameters.
There are “Plug and Play” tools suitable for high power solutions thanks to the wide
operating voltage range from 8 V to 45 V and the current capability up to 3 Ar.m.s.
Figure 1. EVAL6474H-DISC board photo
April 2015
DocID026392 Rev 2
1/38
www.st.com
38
Contents
UM1771
Contents
1
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2
Board specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4
5
3.1
Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
3.2
L6474 stepper motor controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3
Charge pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Device configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1
Advanced current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2
Overcurrent protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3
Speed profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Programming section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1
STM32F105RB microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.2
Firmware loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.3
5.4
5.2.1
DfuSe installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2.2
Generate a DFU file from an HEX file . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2.3
Board settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2.4
DFU loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Using the EVAL6474H-DISC with the firmware for the GUI (FWGUI) . . . 25
5.3.1
Sanity check of the board with the firmware for the GUI (FWGUI) . . . . 25
5.3.2
Parameters exportation from the GUI to the FW library . . . . . . . . . . . . . 31
Using the EVAL6474H-DISC with the firmware library
(FW L6474) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.4.1
FW library package contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.4.2
FW L6474 library description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.4.3
Create a project using the FW library package . . . . . . . . . . . . . . . . . . . 34
6
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
7
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2/38
DocID026392 Rev 2
UM1771
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Electrical specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Recommended operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Phase current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
DocID026392 Rev 2
3/38
38
List of figures
UM1771
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.
Figure 17.
Figure 18.
Figure 19.
Figure 20.
Figure 21.
Figure 22.
Figure 23.
Figure 24.
Figure 25.
Figure 26.
Figure 27.
Figure 28.
Figure 29.
4/38
EVAL6474H-DISC board photo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Schematic (power supply part) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Schematic (microcontroller control part) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Schematic (motion control part) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Layout top layer and bottom layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Power supply section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
L6474 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Charge pump circuitry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Overcurrent protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
STM32F105xx and STM32F107xx block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
DFU file Manager (action). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
DFU File Manager (generation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Board settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
DFU loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
DFU file (open) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
DFU file (upgrade) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
DFU file (confirmation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
DFU file ( download OK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Starting board (BOOT mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Starting board (motor power supply) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Starting board (USB connection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Starting board (error case) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Starting board (board OK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Starting board (display board ID) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Starting board (action LEFT key) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Starting board (action RIGHT key) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Starting board (action RESET key). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Parameters exportation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Parameters exportation (save file) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
DocID026392 Rev 2
UM1771
1
Main features
Main features
The characteristics of the EVAL6474H-DISC are the following:

DC voltage range from 8 V to 45 V

Maximum load phase current at 3 Ar.m.s.

Footprint for external resonator or crystal

Control interface through trimmer - user keys and switch motor input

Control through LED indicators

Interface control by USB and debug outputs

Compatible with SPINFamily evaluation tool

Autonomous board due to an embedded firmware

Up to 1/16 microstepping

Optimized layout on 2 layers board - low cost and high thermal performance
The possibility with these boards is double:

Adapt the settings with your specific setup (motor - voltage) by using the dedicated PC
application.
–

The user is able to save inside the board the specific parameters depending on
user setup
Using the board (with user parameters) directly on site - without a connected PC.
DocID026392 Rev 2
5/38
38
Board specifications
2
UM1771
Board specifications
Table 1. Electrical specifications
Name
Value
Supply voltage (VS)
8 to 45 V
Maximum output current (each phase)
3 A r.m.s
Logic supply voltage (VREG)
3 V (L6474 regulator supply)
Logic interface voltage (VDD)
3.3 V (USB supply)
Low level logic inputs voltage
0V
High level logic input voltage
VDD
Stepping
Up to 1/16 microstepping
Operating temperature
0 to 85 °C
Figure 2. Schematic (power supply part)
9''
9''
73
8
-
6+(//
6+(//
6+(//
6+(//
86%B9&&
86%'0
86%'3
,'
86%B*1'
9
86%'0
86%'3
&
1)
.(<6721(
&
8)
8
5
0
1&
9287
9287
1&
/''7 5
&
1)
*1'
9287
9287
9,1
,2
,2
*1'
9%86
,2
,2
86%'0
9''
86%'3
86%/&3
5
86%B,7
&
1)
.
\$0
6/38
DocID026392 Rev 2
UM1771
Board specifications
Figure 3. Schematic (microcontroller control part)
9''
9''
9''
5
.
5
.
5
5
5
5
5
5
.
.
.
.
.
&21675\$,*+7;0
%227
-
5
-
23(1
&
1)
9''
&
1)
%227
&
8)
1)
-7\$*B7',
-7\$*B7&.
-7\$*B17657
-7\$*B7'2
5(6(7
&
5
5
5
.
.
.
&
5(6(7
/('B63\$5(
/('B(5525
/('B%86<
/('B5(\$'<
5
5
5
5
5
'
'
5('
25\$1*(
6:B02725
%87721B\$
%87721B%
*5((1
9''
%86< 5(\$'<
&
63\$5( (5525
670)5%7
9''B
966B
3\$
3\$
3\$
3\$
3\$
3\$
3&
3&
3&
3&
3%
3%
3%
3%
3\$
966B
9''
3\$
3\$
3\$
3\$
3&
3&
3%
3%
3%
3%
3%
966B
9''B
'
<(//2:
5
'
8
&
67&.
8) 1)
9''
*1'
9''
9''
9''
*1'
5
9%\$7
3&7\$03(557&
3&26&B,1
3&26&B287
3'26&B,1
3'26&B287
1567
3&
3&
3&
3&
966\$
9''\$
3\$:.83
3\$
3\$
&
1)
3\$B706
86%'3
86%'0
3\$B8\$57B5;
3\$B8\$57B7;
3\$B8\$57B&.
9''
5
.
9''
5
.
73
73
73
86%B,7
%2\$5'B,'B
%2\$5'B,'B
%2\$5'B,'B
%2\$5'B,'B
5
5
5
5
.
13
.
13
%227
)/\$*
%86<
3)
5
9''
5
0
63,B166
63,B1&.
63,B0,62
63,B026,
',5
67%<B5(6(7
<
0+]
9''B
966B
3%
3%
%227
3%
3%
3%
3%
3%
3'
3&
3&
3&
3\$
3\$
3)
&
9''
&
5
.
1)
5
.
5
.
5
.
&
1)
&
6:02725
&
6
1)
6
1)
5(6(7
&
1)
5
-
23(1
/()7
67\$576723
6
1)
&
5
5,*+7
\$0
DocID026392 Rev 2
7/38
38
Board specifications
UM1771
Figure 4. Schematic (motion control part)
3
74
,
74
\$
/'
"%\$*/
51
%
04\$065 "%\$*/
%*3
45\$,
45#:@3&4&5
'-"(
#64:
'*9
'*9
065"
04\$065
\$
/'
74"
74"
74#
74#
04\$*/
6
-)
065"
\$
\$
6'
/'
7
+
"
"
"%\$*/
%*3
45\$,
45#:@3&4
'-"(
#64:@4:/\$
\$4
\$,
4%*
4%0
065#
065#
41*@/44
41*@/\$,
41*@.04*
41*@.*40
\$1
7%%
73&(
+
+
#
#
"(/%
1(/%
1(/%
04\$*/
&1"%
3
/1
/'
51
\$
/'
\$
95"-
74
/'
6'
7%%
(/%
51
\$
7#005
/'
3
,
\$
3
/1
%(/%
7
\$
74
,&:450/&
%
#"3
3
,
.*3&
015*\$"[email protected]"3(&
5
.*3&
015*\$"[email protected]"3(&
5
45
.*3&
015*\$"[email protected]"3(&
5
'*9
&7"-)%*4\$
%&.0/453"5*0/#0"3%'03&7"-6"5*0/#0"3%0/-:
3P)4\$0.1-*"/5*&\$
'*9
".7
8/38
DocID026392 Rev 2
UM1771
Board specifications
Figure 5. Layout top layer and bottom layer
\$0
\$0
Table 2. Bill of material
Item
Qty.
Reference
Value
Package
C1, C16
2
Cap. cer. 10 F 10 V X7R 0805
10 F
0805
C2
1
Cap. cer. 1 F 10 V X7R 0805
1 F
0805
C3, C4, C10 - C13, C17 C19, C21, C22, C25 -C27
14
Cap. cer. 100 nF 50 V X7R 0603
100 nF
0603
C5
1
Cap. cer. 3.3 nF 50 V X7R 0603
3.3 nF
0603
C6
1
Cap. cer. 220 nF 35 V X7R 0603
220 nF
0603
C7
1
Cap. cer. 4.7 nF 50 V X7R 0603
4.7 nF
0603
C8, C15, C20, C28
4
Cap. cer. 10 nF 50 V X7R 0603
10 nF
0603
C9
1
Cap. tant. 47 F 6.3 V 10% PACK-A
47 F
3216
C14
1
Cap. elect. 100 F 63 V
100 F
CAPES-R10HXX
C23, C24
2
Cap. cer. 20 pF 50 V COG 0603
20 pF
0603
D1
1
Zener regulator
3.6 V
SOD 523
D2
1
Double diode high speed switching
diode
BAR43
SOT 23
D3
1
LED red - 0805 - 2 mcd - 621 nm
Red
0805
D4
1
LED green - 0805 - 6 mcd - 569 nm
Green
0805
D5
1
LED yellow - 0805 - 6 mcd - 588 nm
Yellow
0805
D6
1
LED orange - 0805 - 2 mcd - 602 nm
Orange
0805
FIX1 - FIX4
4
Hole
3 mn
-
J1 - J3
3
Screw connector 2 poles MKDSN
1.5 /2 - 5.08
DocID026392 Rev 2
MKDSN1.5 /2 - 5.08 MKDSN1.5 /2 - 5.08
9/38
38
Board specifications
UM1771
Table 2. Bill of material (continued)
Item
Qty.
Reference
Value
Package
J4
1
JTAG CON-FLAT-10 x 2 - 180 M
CON-FLAT 10 x 2 - 180 M
CON-FLAT 10 x 2 - 180M
J5
1
USB_B_MINI_AMP_1734035-1
CN-USB
CMS mini-USB
J6, J7
2
JUMP254P-M-2
OPEN
Strip 2 x 2.54
MIRE1 - MIRE3
3
OPTICAL_TARGET
OPTICAL_TARGET
Diam. 1 mn
R1
1
Trimmer 200 K
200 K
Trimm.
100 x 50 x 110
R2
1
27 K 5% 1/10 W
27 K
0603
R3
1
Res. 7.5 K 5% 1/10 W 0603 SMD
7.5 K
0603
R4, R13
2
Res. 1 M 1/10 W 5% 0603 SMD
1 M
0603
R5
1
Res. 1.5 K 1/10 W 5% 0603 SMD
1.5 K
0603
R6, R8 - R11, R14, R19,
R30 - R32
10
Res. 10 K 5% 1/10 W 0603 SMD
10 K
0603
R7, R12
2
Res. 100  5% 1/10 W
100 
0603
R15 - R18
4
Res. 470  5% 1/10 W 0603
470 
0603
R20, R22, R33
3
Res. 1 K 5% 1/10 W 0603 SMD
1 K
0603
R21, R23, R34
3
Res. NP 0603
NP
0603
R24 - R27
4
Res. 4.7 K 5% 1/10 W 0603 SMD
4.7 K
0603
R28
1
Res. 100 K 5% 1/10 W 0603 SMD
100 K
0603
R29
1
Res. NP 0805
NP
0805
S1 - S3
3
Switch button SMD
EVQQ2D03W
CMS 6.5 x 6 x 3.1
TP1, TP2, TP4 - TP7
6
Test point red
Keystone-5000
TH
TP3
1
Test point black
Keystone-5001
TH
U1
1
IC REG 1300 MA LN 3.3 V
LD1117D33TR
SO8
U2
1
UBSLC6-2P6 - ESD protection low
capacitance
USBLC6-2P6
SOT 666
U3
1
L6474 microstepping motor driven
L6474
HTSSOP28
U4
1
IC, MCU, RISC, 72 MHz, 3.6 V,
32-bit, 64-pin, LQFP
STM32F105RBT6
LQFP64 10 x 10
Y1
1
Xtal 8 MHz - 30 PPM - 20 pF
8 MHz
HC49/US-SM
10/38
DocID026392 Rev 2
UM1771
General description
3
General description
3.1
Power supply
The EVAL6474H-DISC board is designed to be powered via:

Connector J1: power of the motor and also motor control driver

USB connector J5: power of microcontroller and logic control
The USB cable supplies the digital part through a dedicated LDO (U1) providing 3.3 V.
The motor power must be set according the voltage required by the user motor.
Note:
Both the supply sources (USB connector and J1 connector) must be present to make
the board operative.
Figure 6. Power supply section
DocID026392 Rev 2
11/38
38
General description
3.2
UM1771
L6474 stepper motor controller
Features

Operating voltage: 8 - 45 V

7.0 A out peak current (3.0 A r.m.s.)

Low RDS(on) power MOSFETs

Programmable power MOS slew-rate

Up to 1/16 microstepping


Non-dissipative current sensing

Integrated voltage regulators

SPI interface

Low quiescent standby currents

Programmable non-dissipative overcurrent

Overtemperature protection
Figure 7. L6474 block diagram
12/38
DocID026392 Rev 2
UM1771
General description
Table 3. Recommended operating conditions
3.3
Symbol
Parameter
VDD
Logic Interface supply voltage
VS
Motor supply voltage
VOUT_diff
Test condition
Value
Unit
3.3
V
VSA = VSB = VS
8 ÷ 45
V
Differential voltage between VSA, OUT1A, OUT2A,
PGND and VSB, OUT1B, OUT2B, PGND pins
VSA = VSB = VS
Up to 45
V
VREG in
Logic supply voltage
VREG internal
3
V
0 ÷ VREG
V
Charge pump
The L6474 device uses an internal charge pump for driving correctly the integrated
MOSFETs, a voltage higher than the motor power supply. The charge pump is obtained
through an oscillator and few external components.
Figure 8. Charge pump circuitry
DocID026392 Rev 2
13/38
38
Device configuration
4
UM1771
Device configuration
This section offers an overview of the basic configuration steps which are required to make
the demonstration board operative.
Warning:
4.1
Important - the device configuration is mandatory. The
default configuration is not operative.
Before changing the device configuration verify that the
device is in high impedance status (power stage is disabled).
The following configuration gives good results with most of motors:
Table 4. Phase current control
Parameter
Value
Unit
Minimum ON time
4
s
Minimum OFF time
21
s
Maximum fast decay (TOFF_FAST)
10
s
Maximum fast decay at step change (FAST_STEP)
16
s
Target switching time
48
s
The impacts of the timing parameters are explained in the application note AN4158- “Peak
current control with automatic decay adjustment and predictive current control: basics and
setup”.
4.2
Overcurrent protection
The overcurrent protection detection is implemented by measuring the current flowing into
each integrated MOSFET.
The overcurrent protection threshold should be set just above the current rating of the
motor:
IOCDth > Imax,r.m.s. × √2
For example: if the maximum phase current of the motor is 2 Ar.m.s., the overcurrent
protection should be set to about 3 A.
Warning:
14/38
Important - it is strongly discouraged to disable the
overcurrent shutdown. It may result in critical failures.
DocID026392 Rev 2
UM1771
Device configuration
Figure 9. Overcurrent protection
4.3
Speed profile
The max. speed parameter is the maximum speed the motor will run. By default, it is about
1000 steps. That means, if you send a command to run at 2000 steps, the motor speed is
limited at 1000 steps.
This is an important safety feature in the final application, but not necessarily useful to
evaluate the device performances. Setting the parameter to high values (e.g. 6000 steps)
allows evaluating the maximum speed which can be achieved by the application under test
through the speed tracking command (Run), but it probably limits the possibility to use
positioning commands (“Move”, “GoTo”, etc.).
The “Full step” speed parameter indicates the speed at which the system switches from
microstepping to full step operation.
DocID026392 Rev 2
15/38
38
Programming section
UM1771
5
Programming section
5.1
STM32F105RB microcontroller
The STM32F105xx device incorporates the high-performance ARM®Cortex™-M3 32-bit
RISC core operating at a 72 MHz frequency, high-speed embedded memories (Flash
memory up to 256 Kbytes and SRAM 64 Kbytes), and an extensive range of enhanced I/O
and peripherals connected to two APB buses. All devices offer two 12-bit ADCs, four
general-purpose 16-bit timers plus a PWM timer, as well as standard and advanced
communication interfaces: up to two I2Cs, three SPIs, two I2Ss, five USARTs, a USB OTG
FS and two CANs.
The STM32F105xx operates in the -40 to +105 °C temperature range, from a 2.0 to 3.6 V
power supply. A comprehensive set of power-saving mode allows the design of low-power
applications.
The STM32F105xx offers devices in three different package types: from 64 pins to 100 pins.
Depending on the device chosen, different sets of peripherals are included.
These features make the STM32F105xx and STM32F107xx connectivity line
microcontroller family suitable for a wide range of applications such as motor drives and
application control, medical and handheld equipment, industrial applications, PLCs,
inverters, printers, and scanners, alarm systems, video intercom, HVAC and home audio
equipment.
Please refer to the STM32F105xx datasheet for an overview of the complete range of
peripherals proposed in this family.
microcontroller operation.
The STM32F105RBT6 has a 64-pin LQFP package with 128 KBytes Flash memory and
operates in the -40 to +85 °C temperature range.
16/38
DocID026392 Rev 2
UM1771
Programming section
Figure 10 shows the general block diagram of the STM32F105xx and STM32F107xx family.
Figure 10. STM32F105xx and STM32F107xx block diagram
(70
7UDFH7ULJ
,EXV
&RUWH[0&38
6\VWHP
19,&
*3'0\$
#9''
;7\$/RVF
0+]
1567
9''\$
966\$
26&B,1
26&B287
&B2
,:'* 3&/.
3&/.
+&/.
)&/.
3//
6WDQGE\
LQWHUIDFH
9%\$7 9WR9
#9%\$7
;7\$/N+]
%DF NXS
UHJLVWHU
57&
\$:8
'35\$0.% '35\$0.%
26&B,1
26&B287
7\$03(557&
\$/\$506(&21'287
%DFNXSLQWHUIDFH
86%27*)6
\$+%WR
\$3%
\$+%WR
\$3%
(;7,7
:.83
*3,2SRUW&
3'>@
*3,2SRUW'
3(>@
*3,2SRUW(
\$3%) PD[ 0+]
3&>@
7,0
&KDQQHOV (75
DV\$)
7,0
&KDQQHOV (75
DV\$)
7,0
&KDQQHOV (75
DV\$)
7,0
&KDQQHO V(75
DV\$ )
5;7;&76576
&.DV\$)
86\$57
5;7;&76576
&.DV\$)
86\$57
5;7;DV\$)
8\$57
5;7;DV\$)
8\$57
63,,6
[[E
LW
7,0
63,,6
[[E
LW
63,
::'*
86\$57
026,6'0,620&.
6&.&.166:6DV\$)
026,6'0,620&.
6&.&.166:6DV\$)
,&
6&/6'\$ 60%\$
DV\$)
,&
6&/6'\$60%\$
DV\$)
E[ &\$1
&\$1B7;DV\$)
&\$1B5;DV\$)
65\$0%
7HP SVHQVRU
95()
95()
3253'5
#9''\$
'0\$(WKHUQHW
*3,2SRUW%
3
\$'&B,1V
FRPPRQWR
\$'&\$'&
6XSSO\
VXSHUYLVLRQ
,QW
3//
5HVHW
FORFN
FRQWURO
966
39'
3//
(WKHUQHW 0\$&
3%> @
5;7;&76576
&.DV\$)
325
5HVHW
5&/6
*3'0\$
*3,2SRUW\$
3
026,0,62
6&.166DV\$)
5&+6
3//
3\$> @
&KDQQHOV
FRPSO &KDQQHOV
%.,1(75LQSXWDV\$)
#9''\$
FKDQQHOV
65\$0.%
\$)
ELW
65\$0
.%
FKDQQHOV
9'' WR9
#9''
\$3%)PD[ 0+]
62)
9%86
,'
'0
'3
)ODVK.%
\$+%
0,,B7;'>@50,,B7;'>@
0,,B7;B&/.50,,B7;B&/.
0,,B7;B(150,,B7;B(1
0,,B5;'>@50,,B5;'>@
0,,B5;B(550,,B5;B(5
0,,B5;B&/.50,,B5()B&/.
0,,B5;B'950,,B&56B'9
0,,B&56
0,,B&2/50,,B&2/
0'&
0',2
336B287
9ROWDJHUHJ
9WR9
'EXV
)PD[ 0+]
3RZHU
9''
,QWHUIDFH
73,8
6:-7\$*
)ODVKO REO
DV\$)
1-7567
-7',
-7&.6:&/.
-7066:',2
-7'2
DV\$ )
%XV 0DWUL [
75\$&(&/.
75\$&('>@
E[ &\$1
EL W\$'& ,)
ELW\$'&
,)
&\$1B7;D
V \$)
&\$1B5;DV\$)
7,0
,) ELW '\$&
,)
'\$&B287DV\$)
7,0
ELW'\$& '\$&B287DV\$)
#9''\$
#9''\$
DL
DocID026392 Rev 2
17/38
38
Programming section
5.2
UM1771
This section describes how to load firmware into the board by using the DfuSe
demonstration software.
5.2.1
DfuSe installation
The DfuSe tool is referenced under the development suite STSW-STM32080.
More details on the DfuSe are given in the UM0412 - “Getting started with DfuSe USB
device firmware upgrade STMicroelectronics extension” user manual.
5.2.2
Generate a DFU file from an HEX file
If the file you want to download to the discovery board is not a DFU file but an HEX file, you
will need first to convert it.
In this purpose,

Start the DFU file manager (V3.0.3 or greater) which has been installed with the DfuSe.

Choose “I want to GENERATE a DFU file from S19, HEX or BIN files”.
Figure 11. DFU file Manager (action)
18/38
DocID026392 Rev 2
UM1771
Programming section

Click “S19 or Hex”… button

Select in the open dialog box the file of type “hex Files”, select the HEX file and click
“OK”.

Click on the “Generate…” button

Give a name to the *.DFU file and click on the “Save” button.
Figure 12. DFU File Manager (generation)
DocID026392 Rev 2
19/38
38
Programming section
5.2.3
UM1771
Board settings
To be able to download firmware, the discovery board should be started in the “DFU” mode.
In this purpose:
1.
Remove the jumper from the BOOT pins.
2.
Plug a USB cable between the discovery board and the PC.
It does not matter if the discovery board is plugged or not to a 5 - 45 V DC supply.
Figure 13. Board settings
20/38
DocID026392 Rev 2
UM1771
5.2.4
Programming section
At this step, you are now ready to perform the firmware upgrade.
1.
Start the “DfuSeDemo.exe”.
2.
You must have an “STM Device in DFU Mode” in the list of the “Available DFU
Devices”. Else, it means that your board is not correctly configured or not connected to
the PC.
3.
In the “Upgrade or Verify Action” group, click the “Choose…” button.
DocID026392 Rev 2
21/38
38
Programming section
4.
UM1771
Select the *.dfu file of your choice in the “Open” dialog box and click on the “Open”
button.
Figure 15. DFU file (open)
22/38
DocID026392 Rev 2
UM1771
Programming section
5.
6.
If this dialog box appears, click “Yes”.
Figure 17. DFU file (confirmation)
DocID026392 Rev 2
23/38
38
Programming section
7.
UM1771
8.
24/38
Do no forget to put the jumper back on the BOOT pins in order to restart the discovery
board to the normal mode!
DocID026392 Rev 2
UM1771
5.3
Programming section
Using the EVAL6474H-DISC with the firmware for the GUI
(FWGUI)
By default the discovery board is loaded with the FWGUI. This firmware offers the capability
to connect the board with a GUI: the SPINFamily evaluation tool. This GUI provides direct
Both the FWGUI and the GUI can be downloaded on the “Design Resources” page of the
L6474.
The FWGUI can be downloaded to the discovery board as detailed in Section 5.2.
The behavior of the GUI is detailed in the “Help.chm” file which is provided with the setup file
of the GUI.
5.3.1
Sanity check of the board with the firmware for the GUI (FWGUI)
At the startup of the FWGUI, a sanity check is performed to confirm the discovery board is
working correctly. The status is returned via the board LEDs.
To have a correct execution of the sanity check, please follow the steps below:
1.
Place a jumper on the BOOT pins (bottom left corner of the board):
Figure 19. Starting board (BOOT mode)
DocID026392 Rev 2
25/38
38
Programming section
2.
UM1771
Connect the board to a 5 V - 45 V DC power supply:
Figure 20. Starting board (motor power supply)
3.
Plug a USB cable (which must at least provide a power supply).
Figure 21. Starting board (USB connection)
4.
26/38
The board should switch on automatically.
DocID026392 Rev 2
UM1771
Programming section
5.
At this step:
a)
If a problem is detected, the “ready” LED (green) and the “error” LED (red) will
switch on without blinking. This means that:
- Either the board Id is not recognized by the FW (bad FW versions used).
- Or there is a problem with the SPI (no connection between the MCU and the
L6474 via the SPI).
- Or there is no 5 V - 45 V DC power supply.
Figure 22. Starting board (error case)
DocID026392 Rev 2
27/38
38
Programming section
b)
UM1771
If no problem is detected, the LEDs will start an infinite two-step loop:
- In the first step, the four LEDs will switch on one after the other by starting by the
green one and ending by the yellow one.
Figure 23. Starting board (board OK)
- In the second step, only the LEDs which correspond to the board ID are switched
on all at the same time. For the L6474 device, there are the green and red LEDs.
Figure 24. Starting board (display board ID)
28/38
DocID026392 Rev 2
UM1771
Programming section
6.
Press the LEFT button and check the two-step loop stops after a few seconds. Only the
green LED remains switched on.
Figure 25. Starting board (action LEFT key)
7.
Press the RIGHT button and check the two-step loops restarts.
Figure 26. Starting board (action RIGHT key)
DocID026392 Rev 2
29/38
38
Programming section
8.
UM1771
Press the RESET button and check that the LEDs restart there two-step loop after the
board reset.
Figure 27. Starting board (action RESET key)
Note:
30/38
Please note that once you have connected the discovery board to the GUI, the LEDs
meaning is different. You then need to restart the board to perform a new auto-check and to
have a valid status from the LEDs.
DocID026392 Rev 2
UM1771
5.3.2
Programming section
Parameters exportation from the GUI to the FW library
Once you have customized the L6474 parameters with the GUI, you can export them to
a header file in order to use it with the FW demonstration library.
In this purpose:
1.
Press the “header file” button on the main window of the GUI.
Figure 28. Parameters exportation
DocID026392 Rev 2
31/38
38
Programming section
2.
UM1771
Replace the existing “easyspin_target_config.h” of your current demonstration FW
library by the new one.
Figure 29. Parameters exportation (save file)
3.
32/38
Then you only need to recompile your project “demo FW library” as usual to use the
exported parameters.
DocID026392 Rev 2
UM1771
5.4
Programming section
Using the EVAL6474H-DISC with the firmware library
(FW L6474)
The L6474 firmware library is supplied as an IAR workspace with a source, including project
files. If you are using the IAR design environment, you just need to load the “easyspin.eww”
file and use the “fwlibrairies_easyspin_discoverykit” project which is already active.
If you are using a different design environment, you will find instructions in this user manual
to build a new project on your preferred IDE.
The L6474 firmware library is also supplied as an executable in the HEX and in DFU format.
It can be loaded into the EVAL6474H-DISC board as explained in Section 5.2.
5.4.1
FW library package contents

FW L6474 library
–

–

/stm32f10x/CMSIS
Library used by the L6474 FW library
STM32F10x Standard Peripherals Library Drivers
–

Described in Section 5.4.2.
CMSIS library
/stm32f10x/STM32F10x_StdPeriph_Driver Library used by the L6474 FW library
IAR workspace files
–
/user_motion/project/ewarm6/fwlibraries/easyspin/easyspin.eww
- workspace file
–
/user_motion/project/ewarm6/fwlibraries/easyspin/settings/easyspin.wsdt
- workspace settings file
–
/user_motion/project/ewarm6/fwlibraries/easyspin/discoverykit
- directory containing easySPIN discovery board project files and subdirectories
–
/user_motion/project/ewarm6/fwlibraries/easyspin/discoverykit/Debug/Exe/
- directory containing the *.HEX and *.DFU executable files
–
/user_motion/project/ewarm6/fwlibraries/easyspin/pcc009v2
- directory containing PCC009V2 board project files and subdirectories
5.4.2
FW L6474 library description
The FW L6474 library has the following features:


Register values conversion

Device configuration

Motion commands

FLAG interrupts management

Button interrupts management

“Daisy Chain” mode
The FW L6474 library has been tested on the L6474H Discovery board. The main program
contains a commented demonstration sequence which uses most of the FW L6474 library
supported features.
DocID026392 Rev 2
33/38
38
Programming section
UM1771
At the end of the demonstration sequence, the GPIO connected to LEFT and RIGHT
buttons are configured to trigger interrupts on the microcontroller:

On a LEFT button press, the microcontroller starts the motor which will accelerate up to
max. speed.

On a RIGHT button press, the microcontroller performs a soft stop of the motor.
Even if the “Daisy Chain” mode is supported in the L6474 FW library, the L6474 Discovery
“Daisy Chain” mode testing or implementation.
The FW L6474 library consists of the following files:
5.4.3

user_motion/easyspin/inc/stm32f10x_conf.h
Library configuration file

user_motion/ easyspin /src/stm32f10x_it.c
Interrupt handlers

user_motion/easyspin/inc/stm32f10x_it.h

user_motion/easyspin/inc/clock.h
System clock setup related

user_motion/ easyspin/src/clock.c
System clock source file

user_motion/easyspin/inc/easyspin.h

user_motion/easyspin/inc/eMotionControl.h
(for motion control routines)

user_motion/easyspin/src/easyspin.c
L6474 routines source file

user_motion/easyspin/src/ eMotionControl.c
L6474 routines source file
(related to motion control)

user_motion/easyspin/inc/easyspin _target_config.h L6474 configuration
parameters (this file can be
generated by the GUI)

user_motion/easyspin/inc/main.h

user_motion/easyspin/src/main.c
Main program

user_motion/easyspin/inc/pre_include.h
First header file included by the
preprocessor

Information on the files
Create a project using the FW library package
Using your preferred IDE, create a new project.
In project options, properties or settings:

Select for the device, the ST STM32F105xB.

Use the CMSIS library.
Edit the preprocessor defined symbols and add:

STM32F10X_CL

USE_STDPERIPH_DRIVER

ST_EASYSPIN_6474H_DISC
Edit the preprocessor include directories and add:
34/38

\$PROJ_DIR\$\…\…\…\…\…\…\stm32f10x\CMSIS\CM3\DeviceSupport\ST\STM32F10x

\$PROJ_DIR\$\…\…\…\…\…\…\stm32f10x\STM32F10x_StdPeriph_Driver\inc

\$PROJ_DIR\$\…\…\…\…\…\easyspin\inc
DocID026392 Rev 2
UM1771
Programming section

\$PROJ_DIR\$\config\stm32f10x_flash.icf
Where \$PROJ_DIR\$ is a variable containing the path to the project directory.
Add the required library source files:

startup_stm32f10x_cl.s

system_stm32f10x.c

misc.c

stm32f10x_exti.c

stm32f10x_flash.c

stm32f10x_gpio.c

stm32f10x_rcc.c

stm32f10x_spi.c

stm32f10x_tim.c
For the debugger, for example, select the ST-LINK and configure it to run to main, to verify
“FlashSTM32F105xB.board”.
DocID026392 Rev 2
35/38
38
References
6
UM1771
References
This user manual provides information on the hardware features and use of the
EVAL6474H-DISC board along with the demonstration firmware and software. For
additional information, refer to the following:
36/38
1.
STM32F105xx/STM32F107xx datasheet (CD00220364).
2.
STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx
advanced ARM®-based 32-bit MCUs reference manual (RM0008).
3.
L647x, L648x and powerSTEP01 family communication protocol (AN4290).
4.
Getting started with DfuSe USB device firmware upgrade STMicroelectronics
extension (UM0412).
DocID026392 Rev 2
UM1771
7
Revision history
Revision history
Table 5. Document revision history
Date
Revision
02-Jul-2014
1
Initial release.
2
Replaced “easySPIN” by “L6474” and/or “motor” in the
whole document.
Updated Figure 4 on page 8 (removed web link).
Removed Figure 5. Layout (silk screen) from page 9.
Updated Table 2 on page 9 (replaced “L6474H” by
“L6474”).
Updated Table 3 on page 13 (minor modifications).
Updated Section 4.2 on page 14 (added “r.m.s.” and
subscripts).
Updated Section 5.3 on page 25 (replaced “FWPSPIN”
Updated from 1. to 3. in Section 6 on page 36.
Minor modifications throughout document.
17-Apr-2015
Changes
DocID026392 Rev 2
37/38
38
UM1771
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.