Design of digital PDA system based on STM32 processor

Publisher:心若澄明Latest update time:2012-06-07 Source: 电子设计工程 Keywords:STM32  μCOS-Ⅱ Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
The processor with Cortex-M3 as the core is a 32-bit processor with low power consumption and low cost. More and more researchers have begun to shift to this field from 51 processors, AVR and other processors. The digital PDA system design uses the STM32ZET6 controller with the Cortex-M3 core. However, since the STM32ZET6 does not have an MMU inside, it cannot transplant WinCE, Linux and other operating systems, so only real-time operating systems such as ucLinux and μC/OS-Ⅱ can be used. After the traditional operating systems ucLinux and μC/OS-Ⅱ are transplanted in the microcontroller, the application program begins to interact with the operating system and the hardware driver. Once a new application is added or the application is changed, the amount of code modification and the stability of the entire operating system will be affected. At this time, a new mechanism is needed to quickly design applications on the basis of ensuring system stability. It is based on this idea that the digital PDA system uniformly encapsulates the real-time operating system, hardware driver, and FATFS, and provides a page-based mechanism. Each page is a thread, using the μC/OS-Ⅱ operating system to switch between tasks, and the application only needs to design the application page according to the page design rules. The design is finally proven to be reasonable and reliable.

1 Digital PDA system principle block diagram description
The hardware circuit part of the digital PDA system consists of a microcontroller STM32F103ZET6, a 16 Mb NOR FLASH memory, a liquid crystal display LCD control circuit, a USB interface circuit, a VS1003B MP3 decoding chip circuit, a 2 Gb misroSD card interface circuit, and a 2.5~5 V power supply circuit. Its structure diagram is shown in Figure 1.

a.jpg



2 Digital PDA system hardware circuit design
2.1 Microprocessor MCU
The microprocessor MCU uses STM32F103ZET6 ARM chip, which is characterized by low power consumption, low price, rich peripheral resources such as FSMC controller, USB, multi-channel SPI and USART, and has MDK programming manual, which is easy to use.
2.2 NOR FLASH memory
NOR FLASH uses M29W128 chip. The function of NOR FLASH is to store page resources, GUI resources, and various font resources. The digital PDA system hardware circuit uses the FSMC controller of the microcontroller to read and write M29W128 NOR FLASH, mainly to improve the reading and writing speed of M29W128. The data stored in M29W128 NOR FLASH can also be read and stored from the microSD card.
2.3 TFT LCD display circuit
The digital PDA system hardware circuit uses the LCD control circuit with HX8312 as the main control chip and connects to the main controller. The data communication between the main controller and the LCD control circuit also uses the FSMC interface of the main controller, the purpose is to quickly transmit data and avoid the LCD screen brushing phenomenon.
2.4 VS1003 audio decoding circuit
VS1003 is an audio decoding chip, which supports Mpeg1 and Mpeg2, WMA, MIDI, MP3 decoding, and supports IMA ADPCM (mono), microphone and line input encoding. VS1003 has a high-performance and low-power DSP processor core VS_DSP, 0.5 KB data RAM. The digital PDA system uses the VS1003 audio decoding chip to realize the music MP3 playback function of the PDA.
2.5 USB interface circuit and microSD card interface circuit
The STM32 microcontroller has a USB interface, which mainly realizes the USB communication of the digital system PDA when it is connected to the PC, and of course it can also power the digital system PDA system. Micro SD realizes the storage of large-capacity data in the digital PDA system.
2.6 PDA internal USB to serial port circuit
PL2303 follows the USB protocol and supports conversion to RS 232. The PDA digital system uses the PL2303 circuit to realize serial communication between the serial port of the main controller and the PC. This circuit is mainly used for system debugging.
2.7 Power supply circuit
The power supply circuit includes five circuits: lithium battery, 5 V external power supply filter circuit, 5 V to 3.3 V, 3.3 V to 2.8 V, and 3.3 V to 2.5 V. They are mainly responsible for providing power to the main controller, decoding chip, SD, and NORFLASH.
[page]

3 Design of Digital PDA System Software System
3.1 General Introduction of Software System
Compared with hardware circuits, once the hardware circuit is determined and the circuit is correct, there is basically no major change, while the software part will have very large changes because the application programs are diverse. However, the STM32 microcontroller does not contain MMU like PC processors, and cannot run Linux and WinCE operating systems. However, in many cases, PDA digital systems are required to implement multi-tasking operations, or multi-threaded operations. Therefore, under this condition, the PDA digital system uses μC/OS-Ⅱ to schedule multiple tasks according to priority levels, and the application is based on the operating system and hardware. In order to improve the stability of the operating system and reduce the code modification when adding applications to the digital PDA, the digital PDA system integrates the operating system, GUI, hardware driver, and file system FATFS, and adopts a page mechanism. Each page refers to a page displayed by a TFT LCD, and each page is a thread. When the page is switched, the underlying operating system implements the task switching.
3.2 Transplantation of FATFS file system
Since the PDA digital system uses SD card as a large-capacity data storage, although the main controller STM32 contains SDIO interface, the hardware driver can realize the SD read and write operation as long as the corresponding configuration is performed, but this operation is based on sectors, and the upper-level application operates on files, so the file system must be transplanted. The transplantation step is to associate the SD read and write sector function with the underlying interface function of the file system. The digital PDA system uses FATFS file system, and of course FAT32 file system can also be used. In the FATFS file system, diskio.c provides five interface functions, as shown in Figure 2.

b.jpg


The SD sector read function, sector write function, and SD initialization function of the microSD card driver function are connected to disk_read, disk_write, and disk_initialize in the figure. Of course, the data type integer.h in the FATFS file system must include stm32f10x.h and the data type in integer.h must be changed. You only need to change the BOOL type data in the file system to be consistent with the bool type in stm32f10x.h, and the file system is transplanted. After transplanting the FATFS file system, the digital PDA system can read data according to the commonly used file format when reading the SD card.
3.3 Transplantation of μC/OS-Ⅱ real-time operating system
μC/OS-Ⅱ provides multi-threaded operation and task scheduling for the operating system of the PDA digital system. Since the system requires multi-threaded scheduling, μC/OS-Ⅱ needs to be transplanted for the digital PDA system. The digital PDA system uses semaphore and mailbox mechanisms for multi-task scheduling. μC/OS-Ⅱ is written in standard C language and assembly language. Only the microprocessor-related parts are written in assembly instructions. Therefore, to transplant the μC/OS-Ⅱ real-time operating system on STM32F103ZET6, you only need to change or rewrite the processor-related files OS_CPU.H and OS_CPU_C.C, the assembly file OS_CPU-A.ASM, and the system configuration file OS_CFG.h.
3.4 Hardware driver
The digital PDA system needs to call the drivers of these hardware resources when calling various peripheral interface resources and various hardware resources of the microcontroller. The hardware driver of the digital PDA system consists of the serial port print output driver, SD card driver, VS1003B hardware driver, TFT LCD liquid crystal display driver, 3 SPI serial communication port drivers, NOR FLASH and STM32 FSMC interface driver, and touch screen TSC2046 driver. The above drivers ensure the normal operation of the hardware resources of each module. As the lowest-level driver, these programs ensure that the entire digital PDA system can implement various applications.
3.5 Page and GUI interface
The digital PDA system needs to display the graphical interface on the TFT LCD display, which requires the support of GUI. The digital PDA system adopts GUI design without transplanting uCGui, but rewrites the GUI based on the LCD controller. Since the clock of the STM32F103ZET6 microcontroller is 72 MHz, the advantage of writing in this way is to increase the speed of LCD page display, reduce the occurrence of screen refresh phenomenon, and improve the quality of PDA LCD screen display. The
digital PDA system integrates all the above software, and regards a page displayed on the LCD screen as a thread. The page switching realizes the task switching, and the task switching is realized by the operating system. Through the framework of the page mechanism, when the application is modified or a new application is added, the amount of code modification is reduced to ensure the stability of the system. After the digital
PDA system is started, it enters the homepage thread. The operating system system also switches according to the hardware interrupt and semaphore mailbox mechanism. When the page is switched, the file system or hardware driver will be called. This is the working principle of the PDA system.

4 Conclusion
The design of digital PDA is completed by transplanting the file system and operating system on the hardware circuit design. The whole system requires not only the correct compatibility of the hardware circuit, but also the correct transplantation of the FATFS file system and μC/OS-Ⅱ operating system. The whole system performs task switching based on the page mechanism. It has been proven in practice that the page mechanism can be used for rapid and rigorous application development.

Keywords:STM32  μCOS-Ⅱ Reference address:Design of digital PDA system based on STM32 processor

Previous article:Design of intelligent wireless signal transmitter based on ARM
Next article:Interface design between OLED display module and AT91RM9200

Recommended ReadingLatest update time:2024-11-16 15:28

Configuration issues of STM32 projects with different external crystal oscillators
Problems encountered: The same serial port configuration code can be output normally on one 407 development board, but garbled characters appear when it is switched to another 407 development board. After checking the serial port output waveform, it is found that there is no problem with the level conversion chip, but
[Microcontroller]
The problem of reading "negative numbers" in encoder mode in stm32
    I was recently debugging a balancing car and found the source code for the DC motor encoder on the Internet. Looking at the STM32 user manual, you can see the following configuration and pictures. Basically, the program also sets the relevant registers in this way.     If TI1 and TI2 are connected to the A phase
[Microcontroller]
Complete the HID application on stm32
This is a project of our company. In the past, we used the virtual serial port based on USB to communicate with the upper and lower computers. Because USB is usually only used for updating parameters and debugging and is not often used, there are reports that USB sometimes cannot connect to the STM32 controller. I alwa
[Microcontroller]
STM32 A method to call the Bootloader in the system memory from the user code
Preface As we all know, any STM32 contains a system memory, which stores the internal boot code Bootloader. Different STM32 models support different communication ports for upgrading code, and you need to refer to the application note AN2606. However, there is a problem that cannot be avoided, that is, how to enter th
[Microcontroller]
STM32 A method to call the Bootloader in the system memory from the user code
Two STM32 chips use HAL to complete SPI full-duplex master-slave communication
SPI is a very simple and easy-to-use full-duplex master-slave communication protocol. This article uses two STM32F429 chips, one as the host and the other as the slave to complete the SPI full-duplex communication test. The HAL library of STM32 simplifies the sending and receiving of the SPI host side, but the HAL
[Microcontroller]
Two STM32 chips use HAL to complete SPI full-duplex master-slave communication
STM32 Application Notes GPIO Initialization
//Initialize IO mode: pull-up/pull-down input. Call function:  void KEY_Init(void) //IO initialization {       GPIO_InitTypeDef GPIO_InitStructure;        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOE,ENABLE); //Enable PORTA, PORTE clock        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2|GPIO_Pin_3|G
[Microcontroller]
Basic introduction of SPI based on STM32
STM32---Summary of SPI (DMA) communication (library function operation) This article mainly introduces SPI in 7 items and will attach the test source code for reference at the end: 1. SPI communication protocol 2. SPI communication initialization (with STM32 as slave and LPC1114 as host) 3. SPI read and write function
[Microcontroller]
Basic introduction of SPI based on STM32
STM32 Development Board Getting Started Tutorial (VI) - I2C--24Cxx
The 24Cxx series we use for demonstration is the most commonly used EEPROM chip. As mentioned above, the address code of 24Cxx is fixed, and the 8 bits are as follows: 1 0 1 0 A2 A1 A0 0 A2 A1 A0 are the levels of its three pins . 24Cxx is special to understand. 24Cxx includes four types: 01/02/04/08/16, and t
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号