STMicroelectronics underlying configuration based MCU STM32

STMicroelectronics MCU is the world's leading semiconductor supplier, since its inception has been to meet the diverse needs of the market, the industry provides a range of areas of semiconductor products and solutions. In order to maintain its technological advantage, STMicroelectronics is strongly committed to innovation, about 7400 people engaged in R & D and product design, and in 2018 15% of its revenue on research and development. STM32MCU is widely used in a rich variety of different occupations. For this reason this article will introduce the relevant technology-related STM32 underlying configuration.

This paper describes the main STM32 underlying configuration, by introducing the source code of the key steps, and precautions set forth for data transmission. This method has other projects or some chip to realize the value and the reference value, and is simple and reliable, universal and versatile.

. 1, bottom STM32 configuration
in order to achieve the data transfer between the MCU STM32 SIM900A the command module, the serial paper, for example, to build a development platform, and adding the corresponding library functions in the project profile, and then configure the appropriate clock and serial GPIO input and output interfaces. While the configuration, you need to write for their schematics in order to ensure the configuration is correct. Such basic development platform is built up.

1.1, serial port configuration
after development platform to build up, you can configure the serial port. Configured rate 115200b / s, word length is 8bit, 1bit stop bit, serial input mode and output mode, corresponding to the last initialization of the serial port. After initializing the serial port, the serial port interrupt response function of opening, i.e. USART_ITConfig (USART2, USART_IT_RXNE, ENABLE) ( In Example 2 serial), and then enable the corresponding serial port so that the function of the basic configuration. Note that some programs may appear the first time lost in transit. This problem involves USART mechanism. After the hardware reset, The USART is set to a status bit (set to 1, it indicates the transmission has been completed), at which point the data can be normally transmitted. When a data transmission, the bit hardware. TC bit cleared (set to 0) is done by software, by first reading USART_SR, USART_DR the write bit is cleared. But the program at the time of sending the first frame data, and did not read USART_SR, but directly write USART_DR, therefore TC flag is set, and not cleared. After transmitting the first data frame, with USART_GetFlagStatus () returns the detection state has been sent, the program immediately sends the next frame, the first frame of data will be the data covering the second frame, so can not see to the top of the data. Transfer completion flag can be cleared, i.e. USART_ClearFlag (USART2, USART_FLAG_TC) before or after each transmission is according to the case.

1.2, interrupt configuration
after you finish configuring the serial port, NVIC will be configured. First configuration interruption group, and select the serial port interrupt, namely NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn (used to define the main library firmware).

Then set preemptive interrupt priority and responsive interrupt priority, the interrupt is then enabled and initialized. The above configuration have its own case, the optimal design of the interrupt packet and priority, to ensure that the program interrupt response speed. Stm32f10x_it.c content made in the configuration file after the interruption.

MCU application is extremely broad, domestic local order no longer dependent on imported chips and join the development of the domestic chip. At present, there are several good companies, the market has to offer hundreds of MCU products such as Smart microelectronics, its products MM32F series STM32F compatible replacement series.

About Shanghai Smart Microelectronics

Smart microelectronics is the focus on the MCU products and a leading supplier of application solutions, since its establishment in March 2011 to now, Shanghai Smart Microelectronics has successfully completed several hundred MCU product design and marketing, Smart micro currently available in volume quantities based on core M0 and Cortex-M3 core MCU product comprising: MM32F series, low power consumption and high performance general security applications market MM32L series, having a plurality of MM32W series, and the motor power of a dedicated wireless connection capability series MM32SPIN and OTP type MM32P series, to meet customer and market multi-field, multi-level rich application scenarios demand.

Guess you like

Origin blog.51cto.com/14618340/2453646