www.embedinfo.com/en STM32F107 ARM-CM3 Board User Guide Rev. 1.0 Release: 4/20/2010 EMBEST CO., LIMITED Address: Room 509, Luohu Science & Technology Building, No.85, Taining Road, Shenzhen, Guangdong, China 518020 Telephone: +86-755-25621715 Fax: +86-755-25616057 Sales Email: sales.en@embedinfo.com Support Email: support.en@embedinfo.com Website: http://www.embedinfo.com/en 1/27 www.embedinfo.com/en Revision history Rev Date Description 1.0 4/20/2010 Initial version 2/27 www.embedinfo.com/en Catalog CHAPTER 1 OVERVIEW....................................................................................................................................4 1.1 The Microcontroller Introduction......................................................................................................4 1.2 Hardware resources list.......................................................................................................................4 1.3 Software resources list ........................................................................................................................5 CHAPTER 2 GETTING STARTED ....................................................................................................................7 2.1 2.2 2.3 2.4 Documents Description .......................................................................................................................7 Version Information ..............................................................................................................................7 Hardware resource requirements....................................................................................................7 Preparations.............................................................................................................................................7 CHAPTER 3 STM32F107 BOARD INTRODUCTION .....................................................................................9 3.1 Board Interface Overview...................................................................................................................9 3.2 Jumpers Settings .................................................................................................................................10 3.3 Hardware Interface Introduction ...................................................................................................10 3.3.1 JTAG..................................................................................................................................................10 3.3.2 Micro SD Card ...............................................................................................................................10 3.3.3 Ethernet...........................................................................................................................................10 3.3.4 Audio.................................................................................................................................................10 3.3.5 CAN ................................................................................................................................................... 11 3.3.6 UART ................................................................................................................................................. 11 3.3.7 LCD & Touch Screen Controller .............................................................................................. 11 3.3.8 Mini USB Port................................................................................................................................. 11 3.3.9 EEPROM ........................................................................................................................................... 11 3.3.10 MEMS motion sensor................................................................................................................ 11 3.3.11 JoyStick Button & others Buttons ....................................................................................... 11 3.3.12 7 sections of numerical code tubes.................................................................................... 11 3.3.13 LED..................................................................................................................................................12 CHAPTER 4 SOFTWARE RESOURCES INTRODUCTION........................................................................13 CHAPTER 5 SOFTWARE DEVELOPMENT AND EXAMPLES .................................................................14 5.1 MDK Introduction.................................................................................................................................14 5.2 Compiler routine ..................................................................................................................................14 5.2.1 Open a routine ..............................................................................................................................14 5.2.2 Compiler the routine...................................................................................................................15 5.3 Debug and Download the routine using Emulator ..................................................................16 5.3.1 Debug and Download the routine using ULINK2 .............................................................16 5.3.2 Download and Debug the routine using Emlink JTAG Emulator ................................21 APPENDIX A: AFTER-SALE SERVICE..........................................................................................................27 3/27 www.embedinfo.com/en Chapter 1 Overview 1.1 The Microcontroller Introduction The STM32F107 incorporates the high performance ARM(R) CortexTM-M3 32-bit RISC core operating at a 72 MHz frequency, high speed embedded memories (Flash memory up to 256 Kbytes and SRAM up to 64 Kbytes), and an extensive range of enhanced I/Os 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, an USB OTG FS and two CANs. Ethernet is available on the STM32F107. The STM32F107 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. 1.2 Hardware resources list z STM32F107 ARM 32-bit CortexTM-M3 z An RS232 connection socket (DB9) CPU, 72 MHz maximum frequency z SPI interface z An Ethernet interface z IIC interface z A 3.2-inch large-screen 320 * 240 z LCD interface 4/27 www.embedinfo.com/en TFT-LCD z z A Micro SD card connector Resistive touch professional screen , high-precision with z IIC interface connects to external EEPROM touch z ADC and DAC Module screen controller chip z One way analog input potentiometer z 4 LED light tube, a power supply LED z Four 7 sections of numerical code tubes z Low Power, Stereo CODEC z An ultra compact low-power three axes w/Headphone & Speaker Amps linear accelerometer z Support Touch Screen Controller Port z A speaker z A standard 3.5mm headphone jack z A five-way joystick z A mini-type USB socket, support for z Own CPU power measurement circuit expansion z A JTAG/SWD debug interface(20pin) USB OTG specifically z Three GPIO buttons applications z A RESET button z 2 CAN connection sockets designed for low-power z Power Supply: USB powered 1.3 Software resources list Project Name Function Description 8leds Use the 8leds to display different digital. ADC1_DMA Use the ADC1 and DMA to transfer continuously converted data from ADC1 to memory. BKP_Backup_Data This example shows how to store user data in the Backup data registers. CAN_Normal_single_board Configure CAN2 to send and CAN1 to receive CAN frames in normal mode. The sent frames are used to control LEDs by pressing key push button. CAN_Normal_two_board CAN peripheral to send and receive frames in normal mode(need two boards). DAC_TwoChannels_Triangle Wave This example describes how to use two DAC channels to generate two different signals with triangle waves on each DAC Channel output. EMAC_Test Network interface functional test EXTI This example shows how to configure an external interrupt line. FLASH_Program This example provides a description of how to program the STM32F10x FLASH. GPIO_IOToggle This example describes how to use GPIO BSRR (Port bit set/reset register) and BRR (Port bit reset register) for IO toggling. I2C_EEPROM This example provides a basic example of how to use the I2C software library and an associate I2C EEPROM driver to communicate with an I2C EEPROM device 5/27 www.embedinfo.com/en IWDG This example shows how to reload at regulate period the IWDG counter using the SysTick interrupt. LCD Using the LCD display pictures and test touchscreen Lib_DEBUG This example demonstrates how to declare dynamic peripherals pointers used for Debug mode. NVIC_VectorTable_Relocatio n This example describes how to set the CortexM3 vector table in a specific address other than default using the NVIC_SetVectorTable function PWR_STANDBY This example shows how to enter the system to STANDBY mode and wake-up from this mode using: external RESET, RTC Alarm or WKUP pin. RCC This example shows how to configure the System clock(SYSCLK) to have different frequencies:24MHz, 36MHz, 48MHz, 56MHz and 72MHz RTC_Calendar it demonstrates how to setup the RTC peripheral, in terms of prescale and interrupts, to be used to keep time and to generate Second interrupt. OS_Test Traffic program based on a RTX Kernel that controls a traffic light. UCOSII 2.8.6 SDcard This example provides a description of how to initialize the SD card on Embest_STM3210C board then write and read 512 bytes from the SD card, then verify them. SysTick This example shows how to configure the SysTick to generate a time base equal to 1 ms. The system clock is set to 72 MHz, the SysTick is clocked by the AHB clock (HCLK). USART_HyperTerminal_Inte rrupt This example provides a description of how to use the EVAL_COM1 transmit and receive interrupts to communicate with the Hyper Terminal. USB_Test It Contains four sub-routines, Audio_Streaming JoyStickMouse, Mass_Storage and Virtual_COM_Port WWDG This example shows how to update at regulate period the WWDG counter using the Early Wakeup interrupt (EWI). 6/27 www.embedinfo.com/en Chapter 2 Getting Started 2.1 Documents Description File name / Item Description Attribute STM32F107_Board_ UserManualV1.0.pdf This document 671KB EM_STM3210C Board Schematic.pdf Development board schematic 128KB STM32F105_107xx Datasheet.pdf Datasheet of STM32F105_107xx 981KB STM32F105_107xx Reference Manual.pdf Reference Manual of STM32F105_107xx 1.05MB Other PDF documents Introduce other modules in the board, such as Audio, CAN... 1.8MB 2.2 Version Information 3/4 3/4 The version of the development tools: MDK4.01 The version of the ST Library: V3.1.2 2.3 Hardware resource requirements When we test STM32F107 BOARD, PC recommended the following configuration: z 2.0GHz (or higher) of the CPU z 512M RAM z 2 USB interfaces z A serial interface z Windows XP operating system z KEIL Integrated Development Environment installed 2.4 Preparations 3/4 3/4 Jumper Settings: Jumper use the default sets, no need to change. Serial Connection: Connect com of board and the com of PC through serial port cable. LCD Connection: The LCD screen inserted in the LCD interface of board. USB Connection: Using USB cable, one end plugged into the USB port on the board, the other end connected to PC. SD Card Connection: Connect Micro SD to SD socket on the board. JTAG Debugger ConnectionOne end connected to JTAG interface on the boardthe 3/4 other end connected to PC. Serial Port Receive Settings: In the PC, run HyperTerminal serial communication 3/4 3/4 3/4 3/4 7/27 www.embedinfo.com/en 3/4 program, select the serial port used and set the following parameters (to set status: Baud rate (115200), data bits (8 bits), stop bits (1 bit), parity bit (no ), data flow control (no)). Network Connection: Through the crossover cable provided connect J3 interface on the board and the network interface of PC side. 8/27 www.embedinfo.com/en Chapter 3 STM32F107 Board Introduction 3.1 Board Interface Overview USB Supply UART NET JTAG TFT LCD Audio (under the LCD) CAN1 Micro SD Card (under the CAN2 Potentiomet 7 sections of numerical code tubes STM32F10 J1 Micro SD Card U6 Lower-power CODEC chip J2 JTAG Interface U7 CAN Transceivers J3 NET Interface U8 CAN Transceivers J4 Audio Line Out U9 USB very low capacitance ESD protection J5 Audio Analog IN U10 Enhanced single channel power switches J6 CAN1 U11 Touch Screen Controller J7 UART U12 2.5V Voltage adjustor J8 CAN2 U13 3.3V Voltage adjustor J9 LCD U14 7 sections of numerical code tubes J10 USB MINI AB Interface D1 LED1 J11 Processor Cable External Round D2 LED2 J12 Processor Cable External Round D3 LED3 9/27 www.embedinfo.com/en J13 Control GND Jumper D4 LED4 U1 STM32F107 Chip K1 User Button 2 U2 Serial I C BUS EEPROM K2 Tamper Button U3 MEMS motion sensor K3 Wakeup Button U4 JoyStick Button K4 Reset Button U5 Ethernet Transceiver 3.2 Jumpers Settings ID Name JP1 JP2 JP3 BOOT0 BOOT0 MICBIAS Default Settings Close (1-2) Close (1-2) Close JP4 MICBIAS Close JP5 SPKR/HP Close Note Choose Start-up mode cooperating with JP2 Choose Start-up mode cooperating with JP1 Microphone DC bias voltage control signal corresponding to AIN3A Microphone DC bias voltage control signal corresponding to AIN3B Speaker / Headphone output options 3.3 Hardware Interface Introduction 3.3.1 JTAG A standard 20-pin JTAG connector is implemented on the STM32F107 BOARD for any ARM JTAG Emulator, such as ULINIK2, JLink, CoLink... 3.3.2 Micro SD Card A Mini SD Card Interface is implemented on this Board; it can only be used by Mini SD Card and it transports data with SPI mode. 3.3.3 Ethernet A Physical Layer Transceiver DP83848J (U5) and an integrated RJ45 interface are implemented in this Board, and it supports both 10BASE-T and 100BASE-TX Ethernet protocol, which ensures compatibility and interoperability with all other standard based Ethernet solutions. 3.3.4 Audio The STM32F107 Board through a CS42L52 low-power stereo audio codec chip to connect the I2C port and a DAC channel in STM32F107. The CS42L52 is a highly integrated, low power stereo CODEC with headphone and Class D speaker amplifiers. STM32F107 BOARD supports stereo audio playback, and CS42L52 sets the parameters through I2C bus. The speaker and headphone can automatically switch between through corresponding pin. 10/27 www.embedinfo.com/en In addition, CS42L52 can also support the MIC input, encodes the input sound signal into the digital signal microcontroller can identify. 3.3.5 CAN There are 2 controller area network (CAN) transceivers in this board, and they both use SN65HVD230D controller chip. Each CAN transceiver is designed to provide differential transmit capability to the bus and differential receive capability to a CAN controller a speeds up to 1 Mbps. 3.3.6 UART The Universal Asynchronous Receiver Transmitter features a 9-pin UART that can be used for communication and trace purposes. It offers an ideal channel for ISP downloading. 3.3.7 LCD & Touch Screen Controller STM32F107 BOARD provides a 320*240 size TFT LCD with a Touch Screen Controller. This LCD uses a ILI9325 driver IC and represents a pixel with 16 bits. Touch Screen uses a 8-bit STMPE811 control chip and we can get the touch-screen data through I2C interface. 3.3.8 Mini USB Port A USB Mini AB interface is implemented to transport USB data, and it also supports USB-OTG full speed. In addition, supply 5V voltage to the Board through this USB port. 3.3.9 EEPROM A 64kbit EEPROM is connected to the I2C bus in STM32F107 BOARD. 3.3.10 MEMS motion sensor There is a MEMS motion sensor which uses the LIS302DL chip. The LIS302DL is an ultra compact low-power three axes linear accelerometer. It includes a sensing element and an IC interface able to provide the measured acceleration to the external world through I2C serial interface. 3.3.11 JoyStick Button & others Buttons STM32F107 BOARD provides a JoyStick button, and it has the UP, DOWN, LEFT, RIGHT and ENSURE function. In addition, the board also provides RESET, WAKEUP, TAMPER and USER buttons. RESET button is used to reset the processor; WAKEUP connects with PA0 pin, it is used to wakeup the processor when it is sleep; TAMPER and USER respectively connect with PC13 and PB7 pins, they can be used for user input. 3.3.12 7 sections of numerical code tubes The Board has four 7 sections of numerical code tubes. They can be used to display time, data or other numbers. 11/27 www.embedinfo.com/en 3.3.13 LED STM32F107 BOARD provides 4 LEDs D1, D2, D3 and D4, they respectively connect with PE2, PE3, PE4 and PE5 IO pins, and they can be used for user output. 12/27 www.embedinfo.com/en Chapter 4 Software Resources Introduction There are 25 test examples in the CD-ROM provided which are built under the Keil RealView MDK environment. The directory of storing these test examples is 03-software\examples. You can find 27 folders in this directory. The Libraries and Utilities are common source files and head files. The other 25 items are all test cases used to test the peripherals or functions of the STM32F107 Board. Test cases' functions, most of those are easy to understand, but need to explain just that 24-USB_Test. There are four projects in the directory 03-software\Examples\24-USB_Test\USB_DEVICE\Project. They are Audio Streaming, JoyStick Mouse, Mass Storage and Virtual COM Port, all of which are used to test USB function of STM32F107 Board. You can get the details about testing introductions and phenomenon from the readme.txt files in the projects or get them by view the STM32F107 BOARD UserManual V1.0.doc documents. Note: The evaluation edition of RealView MDK we provided in the CD-ROM of the board might be not able to compile all of test programs we offer, because it has only 32KB code limitation. If you would like to purchase the authorized edition of RealView MDK of Keil, please contact Keil Inc. directly or his distributors in the world. 13/27 www.embedinfo.com/en Chapter 5 Software development and examples 5.1 MDK Introduction RealView MDK Development Suite is the latest software development tool of ARM Limited Corporation for Embedded Processors. MDK4.01 integrates the most advanced technology in this industry, including Vision4 IDE and RealView RVCT4.0 Compiler; RealView MDK supports ARM7, ARM9 and the latest Cortex-M3 Core Processor. It has a configuration wizard for startup code and integrates flash program module, powerful device simulation, performance analyzer and so on. You can obtain the free evaluation edition of MDK software from the CD released with STM32F107 Board in the directory of 04-tools\RealviewMDK, or you can download the latest evaluation version of RealView MDK for free of charge from Keil website www.keil.com. Double click the installation file setup.exe; finish Keil Vision4 installation under the guidance of the installation wizard. Note: If you want to purchase the authorized RealView MDK, please contact Keil Inc. directly or his distributors in the world. The installation interface as follows: 5.2 Compiler routine 5.2.1 Open a routine Enter in the folder of 03-software\Examples; Open the Embest_STM3210C.uvproj file in the project directory of one routine. For example: \03-software\Examples\01-8leds\project\Embest_STM3210C.uvproj. 14/27 www.embedinfo.com/en 5.2.2 Compiler the routine 1) If you need the .hex format file, then you can configure MDK to build the hex file, Click Select Folder for Object... to specify the hex file's output directory. Or you can skip this step. 2) If you need the .bin format file, then you can configure MDK to build the bin file. Or you can skip this step. 15/27 www.embedinfo.com/en 3/4 D:\Keil\ARM\BIN40\fromelf.exe specify the path of fromelf.exe, it will convert axf file to bin file 3/4 --bin -o 3/4 ./obj/Embest_STM3210C.bin export bin file the directory and file name of the bin file you want to create 3/4 ./obj/Embest_STM3210C.axf the directory and file name of the axf file you want to convert 3) Click project->build, or click the shortcut button to build the routine. 5.3 Debug and Download the routine using Emulator The precondition for the next steps is that you have bought or owned a corresponding hardware Emulator. 5.3.1 Debug and Download the routine using ULINK2 1. Debug the routin using ULINK2 1) Choose Emulator 16/27 www.embedinfo.com/en 2) Check the ULINK2, optional. When ULINK2 connects to the Development Board, if the RUN and COM indicator lights first change to blue and then go out, and the USB indicator light has always been red, this proves that ULINK2 is no problem. In addition, you can use the next way to check ULINK2. Click the Settings button in the Debug TAB, if the red marked part appears, it proves that ULINK2 is no problem. 3) Check that whether ULINK2 can detect the development board or not, optional. Click the Settings button in the Debug TAB, if the red marked part appears, it proves that 17/27 www.embedinfo.com/en ULINK2 has detected the development board. 4) Set the Flash Programmer, configure the Utilities TAB. Then click Settings button, it appears: 18/27 www.embedinfo.com/en If nothing is in the Programming Algorithm, then you should add the corresponding Flash programming algorithm by clicking the Add button, as follows: After you choose a Flash Programming Algorithm, then Click Add button. 5) Start to Debug the routine by clicking shortcut button or clicking Debug->Start/Stop Debug Session, the status of the debug as follows: 19/27 www.embedinfo.com/en 2. Download the routine using ULINK2 1) Check the Flash Programmer's setting 20/27 www.embedinfo.com/en 2) Start to Download by click Flash->Download or the shortcut button as follows: 5.3.2 Download and Debug the routine using Emlink JTAG Emulator 1. Debug the routine using Emlink JTAG Emulator 1) Install the Emlink for MDK driver. 2) Choose the Emulator. 21/27 www.embedinfo.com/en 3) Click the Settings button to configure Emlink, as follows: 4) Set the Flash Programmer. Configure the Utilities TAB, as follows: 22/27 www.embedinfo.com/en Then click the Settings buttons, it will show the next Dialog. If nothing is in the Programming Algorithm, then you should add the corresponding Flash programming algorithm by clicking the Add button, as follows: 23/27 www.embedinfo.com/en 5) Start to debug the routine by clicking the shortcut button or clicking Debug->Start/Stop Debug Session, the status of the debug is as follows: 2. Download the routine using Emlink 1) Check the Flash Programmer's setting. 24/27 www.embedinfo.com/en 2) Start to download by clicking Flash->Download or the shortcut button, as follows: 25/27 www.embedinfo.com/en 26/27 www.embedinfo.com/en Appendix A: After-sale Service Embest is at your service, and we have special Technical Support Engineers to provide support and consultation of our products and services in forms of telephone, E-mail, Fax and website. y TEL: +86-755-25621715 y FAX: +86-755-25616057 y E-mail for Technical Support: support.en@embedinfo.com Website: you can leave your questions at http://www.embedinfo.com/en/Request.asp, and then our technical support engineers will get back to you as soon as possible. 27/27