Category:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
Position:IcFull.com » IC Electronic information » Category: A

IC Electronic information

A new generation of development and application of embedded microprocessor STM32F103

In Electronic Infomation Category: A | on April 22,2011

Abstract: Co rtex-M3 core STM 32F103 series chip is the new 32-bit embedded microprocessor, it is no operating system, ARM, its performance is much higher than the 51 series, but the development process and AD706A datasheet and 51 as simple microcontroller, which in many applications to replace 51 computers. From the STM 32F103 series chip performance characteristics and AD706A price and on-chip resources to start, focusing on its development tools and AD706A suppliers and development process. And the temperature measurement, for example, to specify based on Keil? Vision4 established software engineering, source code editing, compilation, based on J-L ink emulator download, program online debugging, running and other on-chip process, the ultimate measure of the temperature conversion digital content, through the serial port to the PC-display.

1 Introduction

Embedded microprocessors are increasingly widely used in the production of all areas of life, but either the traditional 8-bit embedded microprocessor processor, performance is limited, either 32-bit ARM-based microprocessors require the use of embedded operating system support, such as L inux operating system, making the system less refined. ARM has introduced this situation until the Cortex-M was able to improve the kernel, it does not require the operating system, you can use the same as the microcontroller Ke il C programming language, greatly reduced the developers workload. June 2007, ST launched the company in a timely manner based on the Cortex-M 3 a new type of ARM processor cores: STM32 series microprocessor. In this paper, stm32F103 processor, for example, cited the need to use a variety of hardware and software development resources and their role in developing a more detailed description of the processor to use, and then specific to the temperature sensor detects the temperature of the actual application, the developer provide a more intuitive impression, the purpose is to allow developers to quickly understand the familiar features of the processor, control the development of the family of processors to use.

2 STM32F103 series microprocessor Introduction

STM32F103 series is the first microprocessor architecture based on ARMv7-M standard 32-bit RISC (reduced instruction set) processor to provide high code efficiency, the usual 8-bit and 16-bit system memory to play a high-performance ARM core. The series microprocessor operating frequency is 72MHz, built-in up to 128K bytes of Flash memory and 20K bytes of SRAM, with a wealth of general-purpose I / O ports.

As the latest generation of embedded ARM processors, which for the realization of the need to provide a low-cost MCU platform, reduced pin count, reduced power consumption, while providing a superior computing performance and advanced interrupt response system. Rich on-chip resources make STM32F103 series microprocessors in a variety of fields such as motor drives, real-time control, handheld devices, PC peripherals and air conditioning systems and so the game shows great potential for development.

STM32F103 series of microprocessors are the main resources and features:

(1) up to 51 Fast I / O port, all I / O ports can be mapped onto the 16 external interrupts, almost all ports are allowed to 5V input. Each port can be configured by software output (push-pull or open drain), enter (with or without pull-up or pull-down), or other peripheral functions mouth.

(2) 2 12-bit ADC, up to 16 external input channels, the conversion rate of up to 1MH z, conversion range of 0 ~ 36V; with the dual sample and hold function; internal embedding a temperature sensor, processors can be easily measured temperature.

(3) 7 general-purpose flexible memory to memory DMA to manage the device to the memory and data memory to the device without any CPU intervention. Through the DMA can move data quickly, and this section? ? CPU resources for other operations. DMA controller supports circular buffer management to avoid the controller reaches the end of the buffer when the interrupt generated. It supports the peripherals include: timers, ADC, SPI, I2C and USART and so on.

(4) Debug mode: support for the standard 20 pin JTAG emulation and debugging for the Cortex-M3 core of the serial wire debug (SWD) capabilities. Usually the default JTAG debug interface is the interface.

(5) contains up to 7 internal timer, the specific names and functions shown in Table 1.

(6) contains a wealth of communication interface: three USART asynchronous serial communication interface, two I2C interfaces, two SPI ports, a CAN interface and a USB interface for data communications to provide a guarantee.

Table 1, the name and the role of the various timers


3 development tools and processes

3.1 Tools STM32F103 series MPU

before development on the need to prepare the appropriate hardware and software. The hardware includes STM32F103 development board (or the user target board), J-L ink download emulator, etc.; software, including Ke il V ision4 IDE development platform. The following functions and features of their own to do a brief description.

(1) STM32F103 development board (or the user target board) is to develop the target object.

(2) J-L ink download download the emulator is a hub, it comes with standard 20-pin flat cable can download the program to the processor through the JTAG interface to the internal storage space; no external power supply, with USB connection PC-connected line and immediately after work; also has a download speed, low power consumption.

(3) Ke il V ision4 IDE is a Windows-based software development platform that integrates a powerful and modern editor, project manager and make tools, integrated development of embedded systems is almost all the necessary tools: C / C + + compiler, macro assembler, link / locator, HEX file generator and so on. The software provides two operating modes: compile and debug mode. In the compilation mode, developers can create project, select the target device, the new file, enter the source code, an executable file; debug mode, developers can take advantage of its powerful integrated debugger to debug the application, such as set-off point, single-step execution, facilitate the search and modify the program errors.

3.2 development process

(1) with J-L ink emulator to PC, and STM32F103 development board connected.

(2) using K eil V ision4 IDE development platform to create a new project, writing source code.

Open Ke il V ision4 software, create a new project file, select the device for the project: STM icroe lectron ics company STM32F103R8 chips, click OK, the dialog box will pop up, you are prompted to select the boot code to the target project . System startup code used to complete the initialization, for embedded systems is essential. Choice? ? Startup code is added to the target project, so that boot code can greatly reduce the preparation. After project is created, you can work under the new C file, write source code, when completed, will add to the project. Finally, the library file STM32F10xRLIB and STM32F10xDLIB also added to the project. Thus, the program creates job completed. The necessary source files and functions as shown in Table 2.

Table 2 complete construction documents required


(3) compile the program, download, simulation, and debug.

Compiled after the completion of programming, compile error-free option and select Options, the link in the D ebug program compiled successfully, select the Pro ject / Opt ions for Targe, t open the dialog box, select the Debug tab In U se the drop-down buttons Cortex-M3 J-L ink, select then hit settings, in the pop-up dialog box, click Add button, select STM32F10xM ed-density Flash. Click OK to complete configuration. Load the program can be downloaded through to the target device. Figure 1.

If you need to debug the program online, select the S tart / Stop Debug Session, then you can insert breakpoints, set the pointer, step, reset, etc., you can also observe changes in the value of each register, the wave simulation. Can easily short-circuit debugging process.

4 instances of application development

Below to temperature measurement, for example, describes the specific use STM32F103 processor development. The processor with 12-bit successive approximation ADC, the input range for the VREF-~ VREF +, pin or less in LQFP64 pin package, they are inside the chip and the ADC, and power supply VDDA is connected to VSSA. STM32 processor as used in the design of 33V voltage power supply, so the input range is 0 ~ 33V.

Inside the processor comes with a temperature sensor, it senses the temperature around the MPU will be transformed into voltage changes. The temperature of the sensor to adapt to a wide range, can be measured - 40 ~ + 125 temperature change between the conversion accuracy is 1.5 , can better meet temperature measurement task.

4.1 AD conversion and data transmission

Typically, the internal temperature sensor is off, in order to make it work, you first need to select the ADC _IN16 channels because the channel is an internal channel, and the temperature sensor is directly connected, followed by the register related functions to set the TSVREFE ADC _CR2 bit, open the temperature sensor and VREFINT channel.

Write main c file, the first configure the system clock, and then the pin configuration, mainly for sending and receiving serial data pin configuration, the design uses a general-purpose I / O port pin PB10 as a serial port, configured as a push pull style output, speed 50MH z; the general I / O port pin PB11 as a serial receiver, floating input mode. Work and then configure the serial port interrupt, set the baud rate is 9600Baud, 8 data bits, no parity, 1 stop bit, no hardware flow control. Then enables the serial port interrupts, sending and receiving. The AD conversion channel set to channel 16, enabling the temperature sensor. ADC calibration registers detected after reset, start ADC calibration, the calibration is complete the software trigger start ADC conversion.

Set wh ile an infinite loop, waiting for the serial port interrupt, the interrupt program stm32 f10x_ it c file, convert the resulting data will be sent through the serial port to the PC. Flow chart shown in Figure 2.


Figure 1 Dubug configuration options


temperature measurement flow chart in Figure 2


Figure 3 C + + Buider display interface

4.2 shows the design of the interface

The PC, using C + + Builder software to create the display interface. The preparation of the receiver program, consistent with the serial port settings with the originator to receive data in order to receive the double-byte hexadecimal. Between the size of the received data between 0 ~ 0x0FFF, converted to a decimal number between 0 ~ 4095. Since VREF-= 0V, VREF + = 3.3V, therefore, according to the relationship between values ??and voltage values ??the current voltage value considered. VSENSE = Data / 4096 * 3.3V. For example, if the decimal value of the current by 1773, according to the formula is considered the current voltage of 1.428V. After the voltage value obtained by the formula:

TA = {(V25 - VSEN SE) / A vg_S lope} + 25 can further calculate the current temperature. Which, V25 is VSENSE size at 25 , whose value is 1.43V; Avg_Slope VSENSE curve for the temperature and the average slope, size of 4.3mV / . According to the current drawn from the above example the voltage 1428V, the value can be estimated by the temperature 25.36 . While the outcome of the temperature value displayed in the interface. Results shown in Figure 3.

5 Conclusion:

Based on C ortex-M3 processor core is a new STM32F103 family of embedded microprocessors, which are indicators in every respect far better than 51 series, but its use has developed 51 series and the same simple, and does not require operating system support, development effort compared to traditional embedded systems greatly reduced. These highlight the advantages of making STM32 family of processors in all areas of production and life of great potential, has been more widely used. In this paper, which the processor resources, performance and features to start, a more detailed description of its development tools and development process, especially for K eilV ision4 development platform used to make a detailed description. Finally, temperature measurement, for example, a chip specifically explain the development of AD use of resources, to provide readers with a visual impression, for which developers make better use of microprocessors for reference.

AD706A datasheetAD706A suppliersAD706A Price

Related technical information

All right reserved:icfull.com © 2010-2016 Certificate