STM32F4DIS-BB User Manual

STM32F4DIS-BB
User Manual
STM32F4DIS-BB User Manual
Discover-more
help to discover more!
Embest Technology Co., LTD
REV 1.0
STM32F4DIS-BB Base Board
Base Board for STM32F4DISCOVERY High-Performance Discovery Board
Extended peripherals including UART, Ethernet, CAN, Camera, LCD, TF, SPI, I2C
Supports optional 3.5’’ LCD module and 1.3 Megapixel digital camera module
Supports FatFs_vR0.08a File System (Used for TF card)
Supports LwIP_v1.3.2 Protocol Stack
Supports Micrium µC/OS-II_v2.91
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 1 of 90
Declaration
element14/Embest and ST have launched the STM32F4DIS-BB, a low cost development platform based on STM32F4DISCOVERY.The platform also supports two modules
STM32F4DIS-LCD, STM32F4DIS-CAM.
Glossary
Term Meaning
STM32F4DIS-BB, DM-STF4BB the Base Board for the STM32F4DISCOVERY
STM32F4DIS-LCD,DM-LCD35RT the LCD module for the STM32F4DIS-BB
STM32F4DIS-CAM,DM-CAM130 the Camera module for the STM32F4DIS-BB
Devkit407 STM32F4DIS-BB and STM32F4DISCOVERY
STM32F4DIS-BB,STM32F4DIS-LCD,STM32F4DIS-CAM are the ST part numbers.
DM-STF4BB,DM-LCD35RT,DM-CAM130 are the Embest part numbers.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 2 of 90
COPYRIGHT
,Discover-more,Devkit407,DM-STF4BB,DM-LCD35RT,DM-CAM13
0,are trademarks of Embest Technology Co., LTD.
,STM32F407,STM32F4DISCOVERY,STM32F4DIS-BB,STM32F4DIS-
LCD,STM32F4DIS-CAM are trademarks of STMicroelectronics.
is trademark of Element14.
Microsoft, MS-DOS, Windows XP are trademarks of Microsoft Corporation.
Important Notice
Embest has the ownership and rights to the use of this document. Information in the document is within the protection of copyright. Unless specifically allowed, no part of this document should be modified, issued or copied in any manner or form without prior written approval of Embest Technology Co., LTD.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 3 of 90
Version of update records:
Rev
V1.0
Date
28-Dec-2012
Description
Initial version
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 4 of 90
Contact:
If you want to order products from Embest, please contact the Marketing Department:
Tel: +86-755-25635656 / 25636285
Fax: +86-755-25616057
E-mail: [email protected]
If you need technical assistance from Embest, please contact the Technical Assistance
Department:
Tel: +86-755-25503401
E-mail: [email protected]
URL: http://www.armkits.com
Address: Room 509, Luohu Science &Technology Building, #85 Taining Road, Shenzhen,
Guangdong, China (518020)
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 5 of 90
Contents
1.6 ESD Precautions and Proper Handling Procedures ............................................ 15
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 6 of 90
4.5.8 FreeRTOS\udptcp_echo_server_netconn ................................................. 63
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 7 of 90
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 8 of 90
Chapter 1 Overview
1.1 Product Introduction
The STM32F4DIS-BB Base Board from Embest is an expansion board designed especially for STMicroelectronics’ STM32F4DISCOVERY High-Performance Discovery
Board which is based on the STM32F407VGT6 ARM Cortex-M4 microcontroller and includes an ST-LINK/V2 embedded debug tool, two ST MEMS sensors, digital accelerometer and digital microphone, one audio DAC with integrated class D speaker driver, LEDs, push buttons and an USB OTG micro-AB connector.
The STM32F4DIS-BB Base Board enables STM32F4DISCOVERY board users to discover more features of the STM32F4. It brings additional functionality to the
STF32F4DISCOVERY, including serial ports, USB, Ethernet, CAN, SPI, I2C, GPIO,
Camera, TF Card, LCD and touch screen interfaces on board.
The combination of the STM32F4DIS-BB and the STM32F4DISCOVERY forms the evaluation board Devkit407 for evaluating the STM32F4xx series ARM Cortex-M4 microcontrollers and allows easy prototyping of third party solutions with
STM32F4DISCOVERY board or STM32F4xx series microcontrollers.
Embest has ported Micrium µC/OS-II to the DevKit407 board and the software also features LwIP_v1.3.2 protocol support. Embest also offers rich software examples for
DevKit407 to complement those provided by the original STM32F4DISCOVERY kit.
Included in the package is a CD containing the µC/OS-II BSP and plenty of software examples, board schematic and user manual to help you better understand this board and develop your own applications.
To expand the performance of the STM32F4DISCOVERY board, Embest also offers the
STM32F4DIS-CAM 1.3 Mega pixel camera and STM32F4DIS-LCD
3.5’’
LCD modules which interface easily with the STM32F4-BB base board.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 9 of 90
1.2 How to Form DevKit407
Mount your STM32F4DISCOVERY board to your STM32F4DIS-BB board through CON1 and CON2 to form DevKit407.
1.3 Interface of STM32F4DIS-BB
STM32F4DIS-BB
User Manual
Figure 1-1 Interface of STM32F4DIS-BB
Embest Technology Co., LTD
Page 10 of 90
1.4 Diagram of DevKit407
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 11 of 90
1.5 Hardware Features
Processor
STMicroelectronics STM32F407VGT6 Flash Microcontroller
ARM 32-bit Cortex-M4 CPU with ART accelerator, frequency up to 168 MHz
On chip 1MB of Flash memory and 192+4KB of SRAM
Flexible static memory controller that supports Compact Flash, SRAM,
PSRAM, NOR and NAND memories
LCD parallel interface, 8080/6800 modes
USB 2.0 High-Speed/Full-Speed Device/Host/OTG
10/100 Ethernet MAC, supports IEEE 1588v2 hardware, MII/RMII
2 CAN 2.0B interfaces: up to 4 USARTs and 2 UARTs, 3 SPI (30Mbit/s), 2 with mux’ed I2S
8- to 14-bit parallel camera interface (up to 48MB/s)
1-/4-/8-bit SD/MMC/SDIO interface, supports up to 32GB storage
Up to 140 I/O ports up to 84 MHz
Up to 17 timers (two 32-bit timers), up to 168 MHz
3 x 12-bit A/D converters, 2 x 12-bit D/A converters
Analog true random number generator
Low power supports Sleep, Stop and Standby modes
Supports booting from Flash, System memory or SRAM
Supports ISP and IAP programming
External Memory
Micro SD card slot
MEMS accelerometer
LIS302DL, ST MEMS motion sensor, 3-axis digital output accelerometer
Audio interfaces
I2S Audio DAC, stereo audio jack for headset
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 12 of 90
MP45DT02, ST MEMS audio sensor, omnidirectional digital microphone
Camera Interface
1 x camera interface
LCD/Touch Screen
3.5 inch TFT color LCD (240 x 320-pixel RGB resolution, 262000 colors, 16-bit
8080 parallel interface, brightness control via PWM)
4-wire resistive touch screen
Data Transfer Interfaces
1 x 5-wire RS232 Serial Port
1 x USB2.0 OTG/Device/Host, Full-speed, up to12Mbit/s
1 x 10/100 Ethernet with IEE 1588v2 (RJ45 connector)
Programming and Debugging Interface
On-board ST-LINK/V2 with selection mode switch to use the kit as a standalone
ST-LINK/V2 (with SWD connector for programming and debugging)
I/O Interface
5 x 3- wire TTL UART
1 x 4 channel PWM
1 x SPI, I2C, CAN
6 GPIOs
All the I/Os are extended by extension connectors.
Board Power Supply
Through USB bus or from an external 5 V supply voltage
External application power supply: 3 V and 5 V
Mechanical Parameters
Power consumption: 180 mA @ 5 V (without LCD module)
Storage and Working Temp.: 0°C ~ 45°C
Humidity Range: 20% ~ 90%
CE and RoHS compliant
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 13 of 90
1.6 ESD Precautions and Proper Handling Procedures
Please note that the board comes without any case/box and all components are exposed.
Therefore, extra attention must be paid to ESD (electrostatic discharge) precautions. To effectively prevent electrostatic damage, please follow the steps below:
Avoid carpets in cool, dry areas. Leave development kits in their anti-static packaging until ready to be installed.
Dissipate static electricity before handling any system components
(development kits) by touching a grounded metal object, such as the system unit unpainted metal chassis.
If possible, use antistatic devices, such as wrist straps and floor mats.
Always hold an evaluation board by its edges. Avoid touching the contacts and components on the board.
Take care when connecting or disconnecting cables. A damaged cable can cause a short in the electrical circuit.
Prevent damage to the connectors by aligning connector pins before you connect the cable. Misaligned connector pins can cause damage to system components at power-on.
When disconnecting a cable, always pull on the cable connector or strain-relief loop, not on the cable itself.
Warning
:
This is a class A product. In a domestic this product may cause radio interference in which case the user may be required to take adequate measures.
1.7 Software Features
Features
The DevKit407 software features:
Support for Micrium µC/OS-II_v2.91 operating system
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 14 of 90
Supports FatFs_vR0.08a file system
Supports LWIP _v1.3.2 protocol stack
Integrated Development Environment Support
IAR EWARM
All drivers support IAR EWARM, the EWARM version should be V6.40 or above.
µC /OS-II Demos do not support IAR EWARM at present.
Keil MDK-ARM
All drivers and applications support Keil MDK-ARM, the MDK-ARM version should be V4.22a or above.
Debug Tools Support
ULINK2
Best used with Keil MDK-ARM.
JLINK-V8
Best used with IAR EWARM.
ST-LINK/V2
Can be used with either Keil MDK-ARM or IAR EWARM.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 15 of 90
Chapter 2 Hardware System
2.1 CPU
CPU Instruction
This ARM Cortex-M4 32-bit MCU with FPU has 210 DMIPS, up to 1 MB Flash/192+4 KB
RAM, USB OTG HS/FS, Ethernet, 17 TIMs, 3 ADCs, 15 comm. interfaces and a camera.
Features
168 MHz/210 DMIPS Cortex-M4 with single cycle DSP MAC and floating point unit providing:
Boosted execution of control algorithms
More features possible for your applications
Ease of use
Better code efficiency
Faster time to market
Elimination of scaling and saturation
Easier support for meta-language tools
Designed for high performance and ultra-fast data transfers: ART Accelerator,
32-bit, 7-layer AHB bus matrix with 7 masters and 8 slaves including 2 blocks of
SRAM, Multi DMA controllers: 2 general purpose, 1 for USB HS, 1 for Ethernet,
One SRAM block dedicated to the core, providing performance equivalent to
0-wait execution from Flash concurrent execution and data transfers and simplified resource allocation
Outstanding power efficiency: Ultra-low dynamic power, RTC < 1 μA typical in
VBAT mode, 3.6 V down to 1.7 V VDD, Voltage regulator with power scaling capability, providing extra flexibility to reduce power consumption for applications requiring both high processing and low power performance when running at low voltage or on a rechargeable battery
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 16 of 90
Maximum integration: Up to 1 MB of on-chip Flash memory, 192 KB of SRAM, reset circuit, internal RCs, PLLs, WLCSP package available, providing more features in space constrained applications
Superior and innovative peripherals providing new possibilities to connect and communicate high speed data at greater precision due to high resolution
Extensive tools and software solutions providing a wide choice within the STM32 ecosystem to develop your applications.
2.2 Hardware Interface
5
6
7
8
9
2
3
Pin
1
4
2.2.1 Serial Ports
Signal
NC
RXD
TXD
NC
GND
DSR
NC
CTS
NC
Table 2-1 Serial Ports Interface
COM1
Description
NC
Receive data
Transit data
NC
GND
Data Set Ready
NC
Clear To Send
NC
2.2.2 Ethernet Interface
Pin Signal
Table 2-2 Ethernet Interface
J1
Description
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 17 of 90
7
8
9
5
6
3
4
1
2
10
11
12
13
14
15
16
TX+
TX-
RX+
CT
CT
RX-
NC
SHIELD
LED1
VDD3V3
LED2
VDD3V3
4&5
7&8
NC
NC
TX+ output
TX- output
RX+ input
CT
CT
RX- input
NC
Shield
LINK LED
3.3 V Power for LED
SPEED LED
3.3 V Power for LED
Connect to shield
Connect to shield
NC
NC
2.2.3 MicroSD Card Interface
5
6
7
2
3
Pin
1
4
STM32F4DIS-BB
User Manual
Signal
DAT2
DAT3
CMD
VDD
CLK
VSS
DAT0
Table 2-3 MicroSD Card Interface
CON6
Description
Card data 2
Card data 3
Command Signal
VDD
Clock
VSS
Card data 0
Embest Technology Co., LTD
Page 18 of 90
8
9
DAT1
CD
Card data 1
Card detect
2.2.4 TFT_LCD Interface
18
19
20
21
14
15
16
17
10
11
12
13
7
8
9
3
4
5
6
Pin
1
2
STM32F4DIS-BB
User Manual
D2
D3
D4
D5
GND
GND
D0
D1
Signal
VDD5
VDD5
GND
GND
VDD33
VDD33
LCD_PWM
I2C_SCL
I2C_SDA
TC_INT
LCD_RST
LCD_cs
GND
Table 2-4 TFT_LCD Interface
CON3
Description
+5 V
+5 V
GND
GND
+3.3 V
+3.3 V
LED Dimming Control by PWM Signal
I2C master serial clock
I2C serial bidirectional data
Touch screen interrupt
LCD reset
LCD chip select
GND
GND
GND
16-bit 8080 parallel interface, Data bit 0
16-bit 8080 parallel interface, Data bit 1
16-bit 8080 parallel interface, Data bit 2
16-bit 8080 parallel interface, Data bit 3
16-bit 8080 parallel interface, Data bit 4
16-bit 8080 parallel interface, Data bit 5
Embest Technology Co., LTD
Page 19 of 90
30
31
32
33
34
35
36
37
38
39
40
26
27
28
29
22
23
24
25
D12
D13
D14
D15
GND
GND
GND
D8
D9
D10
D11
GND
D6
D7
GND
LCD_DC
LCD_RD
LCD_WR
GND
2.2.5 I/O Interface
Pin
1
2
3
4
STM32F4DIS-BB
User Manual
Table 2-5 I/O Interface
CON4
Description Signal
UART6_TXD UART6_TXD
JP1 UART6_TX
UART6_RXD UART6_RXD
JP2 UART6_RX
GND
16-bit 8080 parallel interface, Data bit 6
16-bit 8080 parallel interface, Data bit 7
GND
16-bit 8080 parallel interface, Data bit 8
16-bit 8080 parallel interface, Data bit 9
16-bit 8080 parallel interface, Data bit 10
16-bit 8080 parallel interface, Data bit 11
16-bit 8080 parallel interface, Data bit 12
16-bit 8080 parallel interface, Data bit 13
16-bit 8080 parallel interface, Data bit 14
16-bit 8080 parallel interface, Data bit 15
GND
GND
GND
LCD Parallel Interface
Read signal
Write signal
GND
Embest Technology Co., LTD
Page 20 of 90
27
28
29
30
21
22
23
24
25
26
31
32
14
15
16
17
18
19
20
9
10
11
12
13
7
8
5
6
STM32F4DIS-BB
User Manual
UART1_TXD UART1_TXD
UART2_TXD UART2_TXD
UART1_RXD UART1_RXD
UART2_RXD UART2_RXD
GND1
GND2
GND
GND
UART3_TXD UART3_TXD
UART5_TXD UART5_TXD
UART3_RXD UART3_RXD
UART5_RXD UART5_RXD
UART4_TXD UART4_TXD
GPIO1 IO
UART4_RXD UART4_RXD
GPIO2
GND3
GND4
IO
GND
GND
I2C1_SCL
GPIO3
I2C_SDA
GPIO4
CAN1_RX
GPIO5
CAN1_TX
GPIO6
GND5
GND6
TIM3_CH1
SPI1_NSS
I2C1_SCL
IO
I2C_SDA
IO
CAN1_RX
IO
CAN1_TX
IO
GND
GND
TIM3_CH1
SPI1_NSS
Embest Technology Co., LTD
Page 21 of 90
37
38
39
40
33
34
35
36
TIM3_CH1
SPI1_SCK
TIM3_CH1
SPI1_SCK
TIM3_CH1 TIM3_CH1
SPI1_MISO SPI1_MISO
TIM3_CH1 TIM3_CH1
SPI1_MOSI SPI1_MOSI
VDD5V
VDD3V
+5 V
+3 V
2.2.6 Camera Interface
11
12
13
8
9
10
14
15
5
6
3
4
7
Pin
1
2
STM32F4DIS-BB
User Manual
D6
D7
D8
D9
D10
D11
GND2
PCLK
Signal
GND1
D0
D1
D2
D3
D4
D5
Table 2-6 Camera Interface
CON7
Description
GND
NC
NC
Digital image data bit 0
Digital image data bit 1
Digital image data bit 2
Digital image data bit 3
Digital image data bit 4
Digital image data bit 5
Digital image data bit 6
Digital image data bit 7
NC
NC
GND
Pixel clock
Embest Technology Co., LTD
Page 22 of 90
27
28
29
30
24
25
26
19
20
21
22
23
16
17
18
GND3
HS
VDD50
VS
VDD33
XCLKA
XCLKB
GND4
FLD
PWR_EN
RST
SDA
SCL
GND5
VDDIO
GND
Horizontal synchronization
NC
Vertical synchronization
+3.3 V
Clock output a
NC
GND
NC
Power Enable
Reset the camera
I2C master serial clock
I2C serial bidirectional data
GND
+3.3 V
2.3 Pin Multiplexing
There is pin multiplexing between the STM32F4Discovery and STM32F4DIS-BB.
Some functions therefore cannot work simultaneously as shown below:
1) OTG_FS
OTG_FS and LCD, UART2 cannot work simultaneously.
2) Audio
Audio and LCD, Camera, UART1/4/5/6, SPI2 cannot work simultaneously.
3) LEDs
LED3~LED6 and Camera, LCD cannot work simultaneously.
4) MEMS
MEMS and Ethernet, Camera cannot work simultaneously.
5) CAN
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 23 of 90
CAN and LCD cannot work simultaneously.
6) UART1/6
UART1/6 and Camera cannot work simultaneously.
7) UART2
UART2 and Camera, LCD cannot work simultaneously.
8) UART3
UART3 and LCD cannot work simultaneously.
9) UART4/5
UART4/5 and MicroSD cannot work simultaneously.
For more detail, please refer to Table 2-7 Pin multiplexing of STM32F4Discovery and
Table 2-8 Pin multiplexing of CON4 extension port and
Table 2-7 Pin multiplexing of STM32F4Discovery and STM32F4DIS-BB
Discovery
Multiplexing
Function 1
OTG_FS_ID
GPIO
PA10
Multiplexing
Function2
STM32F4DIS-BB
PA10
LCD_WR
GPIO2
LCD
OTG_FS OTG_FS_
Overcurrent
PD5
PB6
UART2_TX
DCMI_D5
UART2
Camera
Audio_SCL
UART1_TX UART1
PC7
DCMI_D1 Camera
I2S3_MCK
Audio I2S3_SCK
PC10
UART6_RX
SDIO_D2
UART4_TX
UART6
MicroSD
UART4
PC12
I2S3_SD
I2S3_WS
Audio_RST
PA4
PD4
SDIO_CK
UART5_TX
DCMI_HSYNC
LCD_RD
MicroSD
UART5
Camera
LCD
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 24 of 90
LED
MEMS
PDM_OUT
LED4
LED3
LED5
LED6
SPI1_SCK
SPI1_CS
SPI1_MOSI
SPI1_MISO
MEMS_INT1
MEMS_INT2
PC3
PD12
PD13
PD14
PD15
PA5
PE3
PA7
PA6
PE0
PE1
SPI2_MOSI
Camera_RST
LCD_PWM
LCD_D0
LCD_D1
PA5
ETH_RST
ETH_RMII_CRS_D
V
DCMI_PIXCLK
DCMI_D2
DCMI_D3
SPI2
Camera
LCD
GPIO6
Ethernet
Camera
Table 2-8 Pin multiplexing of CON4 extension port and STM32F4DIS-BB
Multiplexing
Discovery
Function 1
GPIO
Multiplexing
Function2
STM32F4DIS-BB
CAN1
CAN1_RX
CAN1_TX
UART1
TXD1
RXD1
PD0
PD1
PB6
PB7
LCD_D2
LCD_D3
DCMI_D5
DCMI_VSYNC
LCD
Camera
UART2
TXD2
RXD2
UART3
TXD3
RXD3
UART4
TXD4
RXD4
UART5
TXD5
RXD5
STM32F4DIS-BB
User Manual
PD5
PD6
PD8
PD9
PC12
PD2
Camera_PWR_EN Camera
PC10 SDIO_D2
PC11 SDIO_D3
LCD WR
LCD_D13
LCD_D14
SDIO_CK
SDIO_CMD
LCD
LCD
MicroSD
Embest Technology Co., LTD
Page 25 of 90
UART6
TXD6
RXD6
PC6
PC7
DCMI_D0
DCMI_D1
2.4 Hardware Dimensions
The hardware dimensions of STM32F4DIS-BB (Unit: mm):
Camera
Top Layer Component Height
MAX
: 13.5 mm
Board Thickness: 1.6 mm
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 26 of 90
Chapter 3 Development Environment
3.1 Hardware Environment
Setup DevKit407 hardware environment following these steps:
1) Mount STM32F4DISCOVERY board to STM32F4DIS-BB board through CON1 and
CON2 to form DevKit407.
2)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
3.2 Software Environment
DevKit407 supports two development environments: Keil MDK-ARM and IAR EWARM.
Keil MDK-ARM requires V4.22a or above. IAR EWARM requires V6.40.2 or above. The instructions given in Getting Started with Software and Firmware Environments for
the STM32F4DISCOVERY Kit.pdf describes how to use development toolchains to build, debug and run your project. Please refer to the document for more details.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 27 of 90
3.3 PC Environment
3.3.1 HyperTerminal Connection
In order to use HyperTerminal on a PC, please follow the below process to setup Hyper
Terminal connection (for example, on Windows XP OS):
1) Select Start -> All Programs -> Accessories -> Communication -> Hyper Terminal.
Find the HyperTerminal, as shown below:
Figure 3-1 Create a new HyperTerminal
2) Create a new HyperTerminal connection, enter a name and choose an icon.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 28 of 90
Figure 3-2 Description for new connection
3) Select the specific serial port from the list as per your computer COM port configuration:
Figure 3-3 Select a COM port for connection
4) Set parameters for serial port connection as follows:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 29 of 90
Figure 3-4 Settings for the selected port
5) A Hyper Terminal connection with PC serial port will have been established as shown below:
STM32F4DIS-BB
User Manual
Figure 3-5 Hyper Terminal successfully built
Embest Technology Co., LTD
Page 30 of 90
3.3.2 PC Network Settings
In order to test the Ethernet examples, first set up the PC network environment. Make sure that the PC's IP address and the DevKit407 board's IP address are on the same network.
1) On PC, select Start-> Control Panel-> Network connections-> Local Area
Connection-> Properties, as shown below:
Figure 3-6 Local Area Connection
2)
Click ‘Properties’, this will open the window of Local Area Connection Properties, as shown below:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 31 of 90
Figure 3-7 Local Area Connection Properties
3)
Double click ‘TCP / IP Options’, opens a window for TCP / IP Properties, as shown below:
Figure 3-8 TCP / IP Options
4)
Click the ‘Advanced’ option, open a window for “Advanced TCP / IP settings”, as shown below:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 32 of 90
Figure 3-9 Advanced TCP / IP settings
5)
Click the ‘Add’ option, open a window for "Add TCP / IP".
Enter the IP address and subnet mask, and then click "Add”, as shown below:
Figure 3-10 Add TCP/IP address
6)
Click “OK” to finish network setup.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 33 of 90
Figure 3-11 TCP/IP address successfully setup
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 34 of 90
Chapter 4 Peripherals Examples
4.1 USART Example
The STM32F4xx_USART_Example folder contains one example:
USART_Printf
USART_Printf
1. Purpose
This example shows how to retarget the C library printf function to the USART. The implementation output the printf message on the HyperTerminal using USART6.
2. Description
The example is located in the following folder:
\Codes\STM32F4xx_USART_Example\Project\USART_Printf
3. Software Configuration
HyperTerminal is used in this example. Please refer to 3.3.1 HyperTerminal Connection
for more details.
4. Steps to run
1) Connect a null-modem female/female RS232 cable between the DB9 connector
COM1 (USART6) and PC serial port.
2) Make sure that jumpers JP1 and JP2 are fitted.
3) Open hyperterminal on PC.
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Open the project, rebuild all files, load project image and then run program.
6) Testing actions and results:
After reset, then see the serial terminal, it should be like this:
USART Printf Example: retarget the C library printf function to the USART
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 35 of 90
Type a character on the keyboard, then the HyperTerminal displays the received character on the screen.
4.2 SDIO Example
The STM32F4xx_SDIO_Example folder contains two examples:
FatFs
uSDCard
FatFs example provides an example of how to use the SDIO firmware library and an associate driver to implement Fatfs on the SD Card memory.
uSDCard example provides a basic example of how to use the SDIO firmware library and an associate driver to perform read/write operations on the SD Card memory (SD Card
V1.0, V1.1, V2.0 and SDHC (High Capacity) protocol)that could be mounted on the
Devkit407 board.
4.2.1 FatFs
1. Description
The example is located in the following folder:
\Codes\STM32F4xx_SDIO_Example\Project\FatFs
2. Hardware Configuration
A MicroSD card is needed in this example and Kingston 1GB/2GB or SanDisk 2GB
MicroSD Card is recommended. The card should be formatted before used.
Note: Kingston 1GB/2GB and SanDisk 2GB MicroSD Card have been tested on
DevKit407. It’s not guaranteed that all kind of MicroSD card work well on the board.
3. Software Configuration
HyperTerminal is used in this example. Please refer 3.3.1 HyperTerminal Connection
to for more details.
4. Steps to Run
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 36 of 90
1) Connect a null-modem female/female RS232 cable between the DB9 connector
COM1 (USART6) and PC serial port.
2) Make sure that jumpers JP1 and JP2 are fitted.
3) Open hyperterminal on PC.
4) Copy message.txt in the project folder to a MicroSD card.
5) Insert the MicroSD card into MicroSD slot CON6.
6)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
7) Open the project, rebuild all files, load project image and then run program.
8) Testing actions and results:
After reset, then see the serial terminal, it should be like this:
Debug Module Init
Open a test file (message.txt)
Type the file content hello world!
Close the file
Create a new file (hello.txt)
Write a text data. (hello.txt)
14 bytes written
Close the file read the file (hello.txt)
Type the file content(hello.txt)
Hello world!
Close the file (hello.txt)
Open root directory
Directory listing...
14 HELLO.TXT
12 MESSAGE.TXT
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 37 of 90
Test completed
4.2.2 uSDCard
1. Description
The example is located in the following folder:
\Codes\STM32F4xx_SDIO_Example\Project\uSDCard
2. Hardware Configuration
A MicroSD card is needed in this example and Kingston 1GB/2GB or SanDisk 2GB
MicroSD Card is recommended. The card should be formatted before used.
Note: Kingston 1GB/2GB and SanDisk 2GB MicroSD Card have been tested on
DevKit407. It’s not guaranteed that all kind of MicroSD card work well on the board.
3. Steps to Run
1) Insert the MicroSD card into MicroSD slot CON6.
2)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
3) Open the project, rebuild all files, load project image and then run program.
4) Testing actions and results:
If the Erase operation is PASSED then LED3 ON else the LED6 is ON and LED3 is OFF
If the Single Block Write/Read operation is PASSED then LED4 ON else the
LED6 is ON and LED4 is OFF
If the Multi Blocks Write/Read operation is PASSED then LED5 ON else the
LED6 is ON and LED5 is OFF
Any SD Card operation including the SD Initialization error is signaled by LED6
ON.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 38 of 90
4.3 LCD Example
The STM32F4xx_LCD_Example folder contains two examples:
LCD_35T
LCD_Touch
LCD_35T example project describes how to test LCD module STM32F4DIS-LCD on
Devkit407.
LCD_Touch example describes how to precede LCD touch screen calibration. In this example, four points on the corner of touch screen need to be touch to complete calibration.
4.3.1 LCD_35T
1. Description
The example is located in the following folder:
\Codes\STM32F4xx_LCD_Example\Project\LCD_35T
2. Steps to Run
1) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable. The red line onside indicates the first pin of LCD cable. The triangle onside indicates the first pin of LCD connector.
2)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
3) Open the project, rebuild all files, load project image and then run program.
4) Testing actions and results:
A message display on the LCD
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 39 of 90
Figure 4-1 LCD display message
LCD displays three color bars, red, green and blue.
Figure 4-2 Three color bars
4.3.2 LCD_Touch
1. Description
The example is located in the following folder:
\Codes\STM32F4xx_LCD_Example\Project\LCD_Touch
2. Steps to Run
1) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable. The red line onside indicates the first pin of LCD cable. The triangle onside indicates the first pin of LCD connector.
2) Connect the DevKit4
07 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 40 of 90
cable through USB connector CN1 to power the board.
3) Open the project, rebuild all files, load project image and then run program.
4) Testing actions and results:
5) Click calibration points accurately using a touch pen.
6) LCD will show a message if the calibration is OK. If calibration is OK, then MCU will enter into Calibration_Test_Dispose function.
7) In this function LCD will display the value of points touched by the pen. Both ADC values and coordinate values are displayed.
4.4 DCMI Example
The STM32F4xx_Camera_Example folder contains one example:
OV9655_Camera
1. Purpose
OV9655_Camera example shows how to use the DCMI to control the OV9655 Camera module (STM32F4DIS-CAM) connected with Devkit407 board.
2. Description
The example is located in the following folder:
\Codes\STM32F4xx_Camera_Example\Project\OV9655_Camera
3. Hardware Configuration
A Camera module, STM32F4DIS-CAM, is needed in this example (options module for
DevKit407).
A MicroSD card is needed in this example and Kingston 1GB/2GB or SanDisk 2GB
MicroSD Card is recommended. The card should be formatted before used.
Note: Kingston 1GB/2GB and SanDisk 2GB MicroSD Card have been tested on
DevKit407. It’s not guaranteed that all kind of MicroSD card work well on the board.
4. Steps to Run
1) Connect STM32F4DIS-CAM CON1 to DevKit407 CON7 via FFC soft cable when the
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 41 of 90
power is turned off. Please make sure that STM32F4DIS-CAM module is mounted correctly.
Note: Make sure that JP1 and JP2 are not fitted.
2) Insert a MicroSD card into MicroSD slot CON6.
3) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Open the MDK project, rebuild all files, load project image and then run program.
6) When the program is running, images collected by the module is shown on LCD.
Press User button to take a photograph. The photograph will be stored into
MICROSD card automatically and named as “PICxx.BMP”. ”xx” is picture’s number;
“BMP” is picture’s format.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 42 of 90
4.5 ETH_LwIP Example
STM32F4xx_Ethernet_Example folder contains Standalone and FreeRTOS subfolders:
For Standalone demonstrations LwIP v1.3.2 is used as the TCP/IP stack.
For FreeRTOS demonstrations, LwIP v1.3.2 is used as the TCP/IP stack and FreeRTOS v6.1.0 is used as the Real Time Kernel.
Standalone Examples
There are five examples in Standalone subfolder:
httpserver
tcp_echo_client
tcp_echo_server
udp_echo_client
udp_echo_server
Httpserver example shows how to implement a web server application for STM32F4x7 devices.
Tcp_echo_client example shows how to implement a TCP echo client demonstration for
STM32F4x7 devices.
Tcp_echo_server example shows how to implement a TCP echo server demonstration for STM32F4x7 devices.
Udp_echo_client example shows how to implement a UDP echo client demonstration for
STM32F4x7 devices.
Udp_echo_server example shows how to implement a UDP echo server demonstration for STM32F4x7 devices.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 43 of 90
4.5.1 Standalone\httpserver
1. Description
The HTTP server demo shows an implementation of a web server with the following features:
URL parsing
support of CGI (Common Gateway Interface)
support of SSI (Server Side Includes)
dynamic Header generation
support of HTTP Post request
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
Try to make an external 10K, 3 pins vary-resistor, 1 terminal connects to 3V, the other connects to GND, and the rest (middle pin) connects to ADC1_IN3 (PA3, CON4.26).
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
Figure 4-3 Configure IP address of DevKit407
You can also uncomment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Connect the external 10K, 3 pins vary-resistor following the above instructions.
3) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 44 of 90
4) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45 connector J1.
5)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
6) Rebuild all files, load project image and then run program.
7) After reset, LCD displays the IP address of the DevKit407 board.
Figure 4-4 LCD display message
8) On the remote PC, open a web client (Mozilla Firefox or Internet Explorer) and type the board’s IP address in a web browser. The default IP address is 192.168.0.10.
STM32F4DIS-BB
User Manual
Figure 4-5 Home page of the HTTP server demo
Embest Technology Co., LTD
Page 45 of 90
Click “LED control” to get into LED control interface, select or cancel LED4 and press “Send”, the LED4 on the board will work accordingly.
Figure 4-6 Led control page of the HTTP server demo
Click “ADC status bar” to get the voltage value of potentiometer.
STM32F4DIS-BB
User Manual
Figure 4-7 ADC status bar
Embest Technology Co., LTD
Page 46 of 90
4.5.2 Standalone\tcp_echo_client
1. Description
This demo is used to test a basic TCP connection. In this demo, the STM32F4 acts as a
TCP client that connects to the TCP server. The client sends a string and the server echoes back the same string to the client.
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
Figure 4-8 Configure IP address of DevKit407
You can also uncomment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Configure IP address (The default Static IP address) of remote PC. Modify the relevant macro in main.h depending on your needs, as shown below.
Figure 4-9 Configure IP address of remote PC
3) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 47 of 90
4) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45 connector J1.
5)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
6) Rebuild all files, load project image and then run program.
7) After reset, LCD displays the IP address of the DevKit407 board.
Figure 4-10 LCD display message
8) On the remote PC, copy the echotool software to C root directory.
The echotool software is located in the folder of CD-ROM:
\Codes\STM32F4xx_Ethernet_Example\Utilities\PC_Software
9) On the PC, open a command prompt window. (In Windows, select Start > All
Programs > Accessories > Command Prompt.)
10) At the command prompt, enter:
C:\>echotool /p tcp /s
Where:
– /p tcp is the TCP protocol (TCP protocol)
– /s is the actual mode of connection (Server mode)
11) When the USER1 button on the DevKit407 board is pressed, the client sends a string and the server echoes back the same string to the client. The below screenshot shows an example of the command string and the module’s response.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 48 of 90
Figure 4-11 TCP echo client demo
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 49 of 90
4.5.3 Standalone\tcp_echo_server
1. Description
This demo is used to test a basic TCP connection. In this demo, the STM32F4 acts as a
TCP server that waits for client requests. It simply echoes back whatever is sent.
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
Figure 4-12 Configure IP address of DevKit407
You can also unco mment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
3) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45 connector J1.
4) Connect the Dev
Kit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Rebuild all files, load project image and then run program.
6) After reset, LCD displays the IP address of the DevKit407 board.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 50 of 90
Figure 4-13 LCD display message
7) On the PC, copy the echotool software to C root directory.
The echotool software is located in the folder of CD-ROM:
\Codes\STM32F4xx_Ethernet_Example\Utilities\PC_Software
8) On the remote PC, open a command prompt window. (In Windows, select Start > All
Programs > Accessories > Command Prompt.)
C:\>echotool.exe IP_address /p tcp /r 7 /n 15 /t 2 /d Testing LwIP TCP echo server
where;
– IP_address is the actual board’s IP address;
By default the following static IP address is used: 192.168.0.10
– /p tcp is the protocol (TCP protocol)
– /r is the actual remote port on the echo server (echo port)
– /n is the number of echo requests
– /t is the connection timeout in seconds
– /d is the message to be sent for echo
9) The below screenshot shows an example of this command string and the module response.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 51 of 90
Figure 4-14 TCP echo server demo
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 52 of 90
4.5.4 Standalone\udp_echo_client
1. Description
This demo is used to test a basic UDP echo connection. In this demo the STM32 acts as a
UDP client that connects to a UDP server.
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
Figure 4-15 Configure IP address of DevKit407
You can also uncomment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Configure IP address (The default Static IP address) of remote PC. Modify the relevant macro in main.h depending on your needs, as shown below.
Figure 4-16 Configure IP address of remote PC
3) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
4) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 53 of 90
connector J1.
5)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
6) Rebuild all files, load project image and then run program.
7) After reset, LCD displays the IP address of the DevKit407 board.
Figure 4-17 LCD display message
8) On the PC, copy the echotool software to C root directory.
The echotool software is located in the folder of CD-ROM:
\Codes\STM32F4xx_Ethernet_Example\Utilities\PC_Software
9) On the remote PC, open a command prompt window. (In Windows, select Start > All
Programs > Accessories > Command Prompt.)
10) At the command prompt, enter:
C:\>echotool /p udp /s
where;
– /p udp is the protocol (UDP protocol)
– /s is the actual mode of connection (Server mode)
11) When the USER1 button on the DevKit407 board is pressed, the client sends a string and the server echoes back the same string to the client. The follow figure shows an example of this command string and the module’s response.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 54 of 90
Figure 4-18 UDP echo client demo
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 55 of 90
4.5.5 Standalone\udp_echo_server
1. Description
This demo is used to test a basic UDP connection. In this demo, the STM32 acts as a
UDP server that waits for client requests.
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
Figure 4-19 Configure IP address of DevKit407
You can also uncomment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
3) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45 connector J1.
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Rebuild all files, load project image and then run program.
6) After reset, LCD displays the IP address of the DevKit407 board.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 56 of 90
Figure 4-20 LCD display message
7) On the PC, copy the echotool software to C root directory.
The echotool software is located in the folder of CD-ROM:
\Codes\STM32F4xx_Ethernet_Example\Utilities\PC_Software
8) On the PC, open a command prompt window. (In Windows, select Start > All
Programs > Accessories > Command Prompt.)
9) At the command prompt, enter:
C:\>echotool.exe IP_address /p udp /r 7 /l 7 /n 15 /t 2 /d Testing LwIP UDP echo server
where;
– IP_address is the actual board’s IP address;
By default the following static IP address is used: 192.168.0.10
– /p udp is the protocol (UDP protocol)
– /r is the actual remote port on the echo server (echo port)
– /l is the actual local for the client (echo port)
– /n is the number of echo requests
– /t is the connection timeout in seconds
– /d is the message to be sent for echo
10) The below screenshot shows an example of this command string and the module’s response.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 57 of 90
Figure 4-21 UDP echo server demo
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 58 of 90
FreeRTOS Examples
There are three examples in FreeRTOS subfolder:
httpserver_netconn
httpserver_socket
udptcp_echo_server_netconn
Httpserver_netconn example shows how to implement a web serverapplication, based on the netconn API, for STM32F4x7 devices.
Httpserver_socket example shows how to implement a web server application, based on the socket API, for STM32F4x7 devices.
Udptcp_echo_server_netconn example shows how to implement a UDP-TCP echo server demonstration for STM32F4x7 devices.
4.5.6 FreeRTOS\httpserver_netconn
1. Description
This demo is used to connect the DevKit407 board with a web browser and to load HTML pages.
This demo has two HTML pages. The first one contains general information about
STM32F4x7 microcontrollers, the demonstration package and the stack LwIP. The second one contains the list of running tasks and their status. This page is automatically updated every second.
2. Software Configuration
Ethernet is used in this example. Please reference at 3.3.2 PC Network Settings
for more details.
3. Steps to Run
1) Configure IP address (The default Static IP address) of evaluation board. Modify the relevant macro in main.h file as per your requirement, as shown below.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 59 of 90
Figure 4-22 Configure IP address of DevKit407
You can also uncomment option “USE_DHCP” to enable the DHCP to assign IP addresses dynamically.
2) Connect LCD module STM32F4DIS-LCD to DevKit407 board through CON3
3) Connect the DevKit407 board to a PC with a crossover Ethernet cable through RJ45 connector J1.
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Rebuild all files, load project image and then run program.
6) After reset, LCD displays the IP address of the DevKit407 board.
Figure 4-23 LCD display message
7) On the remote PC, open a web client (Mozilla Firefox or Internet Explorer) and type the board’s IP address in a web browser. The default IP address is 192.168.0.10.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 60 of 90
Figure 4-24 Home page of the HTTP server netconn demo
Click the "List of tasks" into task status monitor page of FreeRTOS real-time system. As shown below:
Figure 4-25 List of tasks page of the HTTP server netconn demo
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 61 of 90
4.5.7 FreeRTOS\httpserver_socket
The HTTP server socket demo shows an implementation of web server application based on the socket API.
To test this demo, please refer to the
4.5.6 FreeRTOS\httpserver_netconn.
4.5.8 FreeRTOS\udptcp_echo_server_netconn
This demo provides the echo service application on both TCP and UDP protocols:
To test the UDP TCP echo server netconn demo in TCP server mode, please refer to the
4.5.3 Standalone\tcp_echo_server .
To test the UDP TCP echo server netconn demo in UDP server mode, please refer to the
4.5.5 Standalone\udp_echo_server .
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 62 of 90
4.6 USB Example
STM32F4xx_USB_Example folder contains
USB_Host_Examples subfolders.
USB_Device_Examples and
Please refer to STM32F4xx USB On-The-Go host and device library.pdf for more information.
Note: USB High Speed is not available on DevKit407.Plesae select macro in IDE :
STM324xG-EVAL_USBD_FS
Figure 4-26 select macro STM324xG-EVAL_USBD_FS in IDE
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 63 of 90
USB_Device_Examples
There are three examples in USB_Device_Examples subfolder:
DFU
MSC
VCP
DFU example presents the implementation of a device firmware upgrade (DFU) capability in the STM32F2xx, STM32F4xx and STM32F105/7 devices.
MSC example gives a typical example of how to use the STM32F2xx, STM32F4xx and
STM32F105/7 USB OTG Device peripheral to communicate with a PC Host using the bulk transfer while the MicroSD card is used as storage media.
VCP example presents the implementation of a Virtual Com Port (VCP) capability in the
STM32F2xx, STM32F4xx and STM32F105/7 devices.
4.6.1 USB_Device_Examples
\DFU
1. Description
The DFU(Device Firmware Upgrade)example allows a device firmware upgrade using the
DFU drivers.
The supported memories for this example are:
Internal Flash memory for STM32F105/7, STM32F2xx and STM32F4xx devices
OTP memory for STM32F2xx and STM32F2xx devices.
DFU device information is located in usbd_desc.c, as shown below:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 64 of 90
Figure 4-27 USB DFU device information
2. Hardware Configuration
A USB type A (Male) to Micro AB (Male) cable is needed in this example.
3. Steps to Run
1) Install DfuSe_Demo_V3.0.2 software on the PC. The software is located in the folder at CD-ROM:
\Codes\STM32F4xx_USB_Example\Utilities\PC_Software\DfuSe_Demo_V3.0.2
If your PC is 64-bit, please install DfuSe Demo V3.0.2_Setup_amd64.exe.
2) Generate DFU upgrade file on the PC(Optional)
Note: There is a DFU file for testing the USB DFU example. User can skip this step.
The DFU file is located in following folder:
\Codes\STM32F4xx_USB_Example\Project\USB_Device_Examples\DFU\binary_te mplate\MDK-ARM
In Installation directory of DfuSe_Demo_V3.0.2, open \BIN folder, this opens a
DfuFileMgr software, as shown below:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 65 of 90
Figure 4-28 DFU file manage
Click “OK”, this opens a window as shown below:
Figure 4-29 Generate DFU file
Click “S19 or Hex” button, select the file to be upgraded, then click “generate” button to generate DFU file.
3) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable.
4) Connect the DevKit407 board to a PC with a 'USB type A (Male) to Micro AB (Male)' cable through USB connector CN5.
5)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
6) Open the project, rebuild all files, load project image and then run program.
7) After reset, the LCD displays the following messages:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 66 of 90
Figure 4-30 USB device firmware upgrade cable connected display message
8) Run DfuSe DEMO software on PC.
If PC identifies the DFU device (DevKit407 board), below window will be displayed, which means board is ready for USB DFU test.
Figure 4-31 STM Device in DFU mode
9) Select the target area to be programmed, as shown in below figure with number 1.
10)
Select the DFU file to be programmed. Click “Choose” button select the DFU to be upgraded, as shown in below figure with number 2.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 67 of 90
There is a DFU file for USB DFU testing purpose at the folder location:
\Codes\STM32F4xx_USB_Example\Project\USB_Device_Examples\DFU\binary_te mplate\MDK-ARM
Figure 4-32 Upgrade DFU file
11) In order to update the firmware click
“Upgrade” button to start the firmware update.
Once completed a message will appear to indicate upgrade is successful or not.
12) After reset, MCU run in the new firmware.
Reset MCU while the User button is pushed, the MCU run the example that downloaded in step 11).
To go back to the DFU example, you have to reset the device (using RESET button or software reset).
Note: In the DFU DEMO, the application start address is set to 0x0800C000, as
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 68 of 90
shown below. This address represents the DFU code protected against write and erase operations. You can modify this address in usbd_conf.h, but you must make sure that there enough space for DFU code (0x08000000
~
application start address).
Figure 4-33 Configure start address of application
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 69 of 90
4.6.2 USB_Device_Examples\MSC
1. Description
The MSC (Mass Storage) example gives a typical example of how to use the STM32F4xx
USB OTG Device peripheral to communicate with a PC Host using the bulk transfer while the MicroSD card is used as storage media. On PC, user can open, close, create, delete, copy and paste the files stored in the SD card.
MSC device information is located in usbd_desc.c, as shown below:
Figure 4-34 USB MSC device information
2. Hardware Configuration
A USB A type (Male) to Micro AB (Male) cable is needed in this example.
A MicroSD card is needed in this example and Kingston 1GB/2GB or SanDisk 2GB
MicroSD Card is recommended. The card should be formatted before used.
Note: Kingston 1GB/2GB and SanDisk 2GB MicroSD Card have been tested on
DevKit407. It’s not guaranteed that all kind of MicroSD card work well on the board.
3. Steps to Run
1) Insert the MicroSD card into MicroSD slot CON6.
2) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 70 of 90
3) Connect the DevKit407 board to a PC with a 'USB type A (Male) to Micro AB (Male)' cable through USB connector CN5.
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Open the project, rebuild all files, load project image and then run program.
6) After reset, the LCD displays the following messages:
Figure 4-35 Cable connected display message
7) PC will identify the removable disk automatically. Users can use it the same as an
U-disk, as shown below:
Figure 4-36 MSC device displayed on PC
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 71 of 90
4.6.3 USB_Device_Examples\VCP
1. Description
The VCP example illustrates an implementation of the CDC class following the PSTN subprotocol.
The VCP example allows the STM32 device to behave as a USB-to-RS232 bridge.
On one side, the STM32 communicates with host (PC) through USB interface in
Device mode.
On the other side, the STM32 communicates with other devices (same host, other host, other devices…) through the USART interface (RS232).
The support of the VCP interface is managed through the ST Virtual Com Port drive
VCP device information is located in usbd_desc.c, as shown below:
Figure 4-37 USB VCP device information
In order to facilitate testing, a PC plays as two host of VCP.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 72 of 90
Figure 4-38 One single Host for USB and USART
2. Hardware Configuration
A USB type A (Male) to Micro AB (Male) cable is needed in this example.
3. Steps to Run
1) Install VCP_V1.3.1_Setup.exe on the PC. The software is located CD-ROM at the following location:
\Codes\STM32F4xx_USB_Example\Utilities\PC_Software\stm32_vcp
If your PC is 64-bit, please install VCP_V1.3.1_Setup_x64.exe.
2) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable.
3) Connect the DevKit407 board to a PC with a 'USB type A (Male) to Micro AB (Male)' cable through USB connector CN5.
4)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Open the project, rebuild all files, load project image and then run program.
6) After reset, the LCD displays the following messages:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 73 of 90
Figure 4-39 USB VCP device cable connected display message
7) USB device (DevKit407) is enumerated as serial communication port
Figure 4-40 DevKit407 have been enumerated as VCP device
8) Configure the virtual com port as below.
Start HyperTerminal by clicking on Start -> Programs -> Accessories ->
Communications ->HyperTerminal.
The ‘Connect To’ dialog box appears. Ignore the first three boxes – these are used with dialup modem services. In the last box ‘Connect using’ select the COM port that you will be using and press ‘OK’.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 74 of 90
Figure 4-41 Create HyperTerminal for the virtual com port
In the following ‘COM properties’ dialog box you can set up the communication parameters for the COM port. Set for 115200 bits per second, 8 data bits, no parity, 1 stop bit and no flow control. Press ‘OK’ when done.
Figure 4-42 VCP port settings
9) Configure com port that connected to DevKit407 board in the same way.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 75 of 90
10) Communication test. Try sending some characters with the HyperTerminal of virtual serial port, the other HyperTerminal (COM3) will receive these characters.
Figure 4-43 Message from VCP COM to True COM
Both the two HyperTerminals can send or receive data. As shown below:
Figure 4-44 Message from True COM to VCP COM
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 76 of 90
USB_Host_Examples
There are two examples in USB_Host_Examples subfolder:
HID
MSC
HID example provides a description of how to use the USB OTG host peripheral on the
STM32F2xx, STM32F4xx and STM32F105/7 devices.
MSC example provides a description of how to use the USB OTG host peripheral on the
STM32F2xx, STM32F4xx and STM32F105/7 devices.
4.6.4 USB_Host_Examples\HID
1. Description
When an USB Device is attached to the Host port, the device is enumerated and checked whether it can support HID device or not, if the attached device supports HID, upon pressing the User button, the mouse or the keyboard application will be launched.
2. Hardware Configuration
A mouse and a USB type A (Female) to Micro AB (Male) cable are needed in this example.
3. Steps to Run
1) Connect LCD module STM32F4DIS-LCD to DevKit407 CON3 via LCD cable.
2) Connect the DevKit407 board to a mouse with a 'USB type A (Female) to Micro AB
(Male)' cable through USB connector CN5.
3)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
4) Open the project, rebuild all files, load project image and then run program.
5) After reset, the LCD displays the following messages:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 77 of 90
Figure 4-45 USB HID Host connected display message
6) When user presses the USER1 button, the application displays the mouse pointer and buttons.
Figure 4-46 USB HID Host user key message
Moving the mouse will move the pointer in the display rectangle and if a button is pressed, the corresponding rectangle will be highlighted in green.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 78 of 90
Figure 4-47 USB HID Host user key pressed
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 79 of 90
4.6.5 USB_Host_Examples\MSC
1. Description
The STM32F4 behave as a mass storage Host that can enumerate, show content and display the supported BMP image in the attached USB flash disk.
2. Hardware Configuration
A USB Flash Disk and a USB type A (Female) to Micro AB (Male) cable are needed in this example.
Note: Kingston 1GB/2GB and SanDisk 4GB USB Flash Disk have been tested on
DevKit407
. It’s not guaranteed that all kind of USB Flash Disk work well on the board.
3. Steps to Run
1) There are some BMP files for testing purpose located in the following location:
\Codes\STM32F4xx_USB_Example\Utilities\Binary\Media
Copy these files to the root of the USB flash disk
2) Connect the DevKit407 board to the USB flash disk with a 'USB type A (Female) to
Micro AB (Male)' cable through USB connector CN5.
3) Connect LCD module STM32F4DIS-LCDto DevKit407 CON3 via LCD cable.
4) Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
5) Open the project, rebuild all files, load project image and then run program.
6) After reset, the LCD displays the following messages:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 80 of 90
Figure 4-48 USB mass storage host display message
7) When the user press the User button, the application explore the USB flash disk content and the LCD displays the following messages:
Figure 4-49 USB mass storage explorer display message
Note: The contents circled by red color depend on the USB device that plugged in.
8) User has to press the User button to display the whole disk (recursion level 2). Below is a screenshot when the entire flash disk is shown:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 81 of 90
Figure 4-50 USB mass storage explorer display message (last screen)
9) The user has to press the User button to write a small file, e.g. Host_Write_Demo.txt
(less to 1 KB) on the disk.
Figure 4-51 USB mass storage write file display message
10) After writing the file to the disk, user can press the USER1 button to start the Image slide show. Only the BMP files with the following format are supported :
Width: 320
Height: 240
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 82 of 90
BPP:
16
Compression: RGB bitmap with RGB masks
Press the User button to start the Image (BMP file for testing) slide show:
Figure 4-52 USB mass storage slideshow example
Note: BMP files should be located in the USB Disk root.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 83 of 90
Chapter 5 Applications Examples
5.1 STM32F4xx_uCOSII_Example
1. Description
This example provides a description of how to use the uC/OS-II on the STM32F4xx devices.
Note: This example just supplies port files. You should download uC/OS-II-v2.91 source code from the Micrium website: http://micrium.com/page/downloads/source_code .
Copy uC/OS-II-v2.91 source from the Micrium folder(Micrium\Software\uCOS-II\Source) to Project folder(STM32F4xx_uCOSII_Example\uCOS-II\Source).
Two tasks work in this example:
App_TaskStar--Control the LED blinking
App_TaskKbd--Control the LED blinking frequency by User button pressing
The MDK project of this example is located in the following folder:
\Codes\STM32F4xx_uCOSII_Example\Project\MDK-ARM
2. Steps to Run
1)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
2) Open the project, rebuild all files, load project image and then run program.
3) Testing actions and results:
LEDs turn on and then turn off in an order: LED4 -> LED6 -> LED5 -> LED3.
Long press on User button, then the blinking speed of the LEDs will be lower than what we saw at the beginning.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 84 of 90
5.2 STM32F4xx_FPU_FFT_Example
1. Description
This example shows how to use the Cortex-M4's FPU unit.
This example demonstrates the calculation of the maximum energy bin in the frequency domain of the input signal with the use of Complex FFT, Complex Magnitude, and
Maximum functions.
The MDK project of this example is located in the following folder:
\Codes\STM32F4xx_FPU_FFT_Example\Project\FPU_FFT_Example\MDK-ARM
2. Steps to Run
1)
Connect the DevKit407 board to a PC with a ‘USB type A (Male) to Mini-B (Male)’ cable through USB connector CN1 to power the board.
2) Open the project, rebuild all files, load project image and then run program.
3) Testing actions and results:
If the demon run ok, the LED6 will turn on, otherwise the LED3 Will turn on.
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 85 of 90
Chapter 6 Other Test Scenarios
This Chapter gives a short description about how to test the DevKit407 peripheral
6.1 USART Testing
Please reference at 4.1 USART Example .
6.2 SDIO Testing
Please reference at 4.2 SDIO Example .
6.3 LCD Testing
Please reference at 4.3 LCD Example .
6.4 DCMI Testing
Please reference at 4.4 DCMI Example .
6.5 Ethernet Testing
Please reference at 4.5 ETH_LwIP Example .
6.6 USB Testing
Please reference at
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 86 of 90
Technical Support & Warranty Service
Embest Technology Co.,LTD., established in March of 2000, is a global provider of embedded hardware and software. Embest aims to help customers to reduce time to market with improved quality by providing the most effective total solutions for the embedded industry. In the rapidly growing market of high end embedded systems,
Embest provides comprehensive services to specify develop and produce products and help customers to implement innovative technology and product features. Progressing from prototyping to the final product within a short time frame and thus shorten the time to market, and to achieve the lowest production costs possible. Embest insists on a simple business model to offer customers high-performance, low-cost products with the best quality and service. The content below is important information for our products technical support and warranty service:
Technical support service
Embest provides one year free technical support service for all products. Technical support service covers:
Embest embedded platform products software/hardware materials
Assist customers in compiling and running the source code we offer.
Assist in troubleshooting on our embedded software/hardware platforms given that the customer has followed the documentation that we offer.
Judge whether the product failure exists.
The services listed below are not included in the range of our free technical support service, and Embest will handle each situation with discretion:
Software/Hardware issues a user meets during the development process
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 87 of 90
Issues which occur when users compile/run the embedded OS which has been modified by users themselves.
User’s own applications.
Problems which occur during the modification of our software source code
Maintenance Service Clause
1) The products except LCD, which are not used properly, will take the warranty since the day of the sale:
PCB: Provide 12 months free maintenance service.
2) The situations listed below are not included in the range of our free maintenance service, Embest will charge the service fees with discretion: a)
Can’t provide valid Proof-of-Purchase, the identification label is torn up or illegible, the identification label is altered or doesn’t accord with the actual products; b)
Don’t follow the instruction of the manual in order to damage the product; c) Due to the natural disasters (unexpected matters), or natural attrition of the components, or unexpected matters leads to the defects of appearance/function; d) Due to the power supply, bump, leaking of the roof, pets, moisture, impurities into the boards, all those reasons which lead the defects of appearance/function; e)
User unauthorized weld or dismantle parts leads the product’s bad condition, or let other people or institution which are not authorized by Embest to dismantle, repair, change the product leads the product bad connection or defects of appearance/function; f) User unauthorized install the software, system or incorrect configuration or computer virus leads the defects; g) Purchase the products through unauthorized channel;
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 88 of 90
h) Those commitments which is committed by other institutions should be responsible by the institutions, Embest has nothing to do with that;
3) During the warranty period, the delivery fee which delivery to Embest should be covered by user, Embest will pay for the return delivery fee to users when the product is repaired. If the warranty period is expired, all the delivery fees will be charged by users.
4) When the board needs repair, please contact technical support department.
Note: Those products are returned without the permission of our technician, we will not take any responsibility for them.
Basic Notice for Protecting LCD Screen
1) Do not use finger nails or hard/sharp objects to touch the surface of the LCD, otherwise the above services will be void.
2) Embest recommend user to purchase a screen wipe to wipe the LCD after long time use, please avoid cleaning the surface with fingers or hands to leave fingerprint.
3) Do not clean the surface of the screen with chemicals, otherwise user can not enjoy above service.
Note: Embest do not supply maintenance service to LCD. We suggest the customer first check the LCD after getting the goods. In case the LCD cannot run or show display, customer should inform Embest within 7 business days from the moment of getting the goods.
Value Added Services
We will provide following value added services:
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 89 of 90
Pro vide services of driver development based on Embest’s embedded platforms, like serial port, USB interface devices, LCD screen.
Provide the services of control system transplant, BSP driver development, API software development.
Other value added services like power adapter, LCD parts.
Other OEM/ODM services.
Technical training.
Please contact Embest to get technical support:
Support Tel:+86-755-25503401
Fax:+86-755-25616057
Pre-Sale consultation: [email protected]
After-Sale consultation: [email protected]
STM32F4DIS-BB
User Manual
Embest Technology Co., LTD
Page 90 of 90
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Related manuals
advertisement