Design of embedded application system based on Lingyang SPCE061A

Publisher:郑大大Latest update time:2012-01-09 Keywords:SPCE061A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

SPCE061A is a 16-bit single-chip microcomputer with u-class SP core newly launched by Lingyang Technology. SPCE061A with embedded 32K words of Flash is an economical choice for digital speech recognition applications. It supports a streamlined instruction system and has rich hardware resources on the chip. Only a small amount of off-chip expansion circuits need to be designed to achieve the hardware functional requirements of the application system. μC/OS-II is a streamlined operating system kernel with strong real-time performance and strong portability. Designing a system based on μC/OS-II can improve the efficiency of system software development. Porting μC/OS-II to SPCE061A and designing software on the μC/OS-II platform are of great significance in improving the quality of related embedded application system products, reducing development cycles and reducing costs.

Design of the minimum hardware system based on SPCE061A

System structure of SPCE061A

SPCE061A has rich on-chip system resources. The structure is shown in Figure 1. The chip includes:

·16-bit high performance USB core microcontroller

CPU clock range: 0.32MHz~49MHz

On-chip 32k words of Flash program memory, 2k words of SRAM data memory

· 2 16-bit I/O ports

14 interrupt sources

1 channel dedicated audio A/D conversion channel

7-channel A/D conversion channel

Built-in MIC amplifier circuit and automatic gain (AGC) amplifier circuit

·2-channel current output type D/A conversion channel

·2 16-bit general-purpose timers/counters

Real-time clock (RTC)

Low voltage reset, low voltage monitoring

Built-in online emulation interface (ICE)

·With confidentiality function

·With WatchDog function

Construction of the Minimum Application System Based on SPCE061A

Based on the rich on-chip resources of SPCE061A, a minimum system can be formed by connecting a 32768 Hz crystal oscillator and a resonant capacitor to its OSCO and OSCI terminals, connecting corresponding capacitors and resistors to the RC input VCP terminal of the phase-locked loop voltage-controlled oscillator, and adding a reset circuit. As shown in Figure 2. The peripheral circuit interface can be expanded to include an LCD display for real-time display of relevant data.

μC/OS-II transplantation on SPCE061A

Main contents of μC/OS-II kernel transplantation

μC/OS-II is a preemptive real-time multitasking operating system designed for microcontrollers and application software development. Its kernel mainly implements task scheduling, communication between tasks, memory management and time management. Its software architecture and its relationship with hardware are shown in Figure 3. The
multitasking application is located at the top layer, and it implements task scheduling and switching, storage management and communication of task processes by calling the kernel's API functions. Most of the code of μC/OS-II is written in C language, and the three source program files related to the hardware, OS_CPU.H, OS_CPU_A.A, and OS_CPU_C.C, contain assembly language codes related to the hardware processor to implement access to processor registers and stack operations. Therefore, the transplantation of the μC/OS-II operating system on SPCE061A mainly involves the writing of the three source programs OS_CPU.H, OS_CPU_A.A, and OS_CPU_C.C.

OS_CPU.H includes processor-related constants, macros and type definitions defined with #define. This is consistent with the variable types defined by μC/OS-II. OS_CPU_A.A requires the user to write four simple assembly functions: (1) The OSStartHighRdy() function is used to run the highest priority ready task. (2) OSCtxSw() is used to implement the switching between tasks during normal CPU operation, that is, to save the current task stack and pop the high priority task stack, so that the highest priority task can obtain the control of the CPU. (3) OSIntCtxSw() is a function that performs the task switching function in the interrupt service program. (4) OSTickISR() is the interrupt service program of the system clock. The execution frequency of this program is 10 to 100 Hz. Its main function is to check whether there is a task that has been suspended due to delay and becomes a ready task. If there is, OSIntCtxSw() is called to switch tasks, so as to run the high priority task. OS_CPU_C.C mainly writes the task stack initialization function OSTaskStklnit().

Key issues in transplantation

When a multi-task system is running, any currently running task seems to monopolize the CPU. It is necessary to open up a memory space for each task as the task stack of the task. The function of this stack is to save the values ​​of the CPU registers and the data of the system stack before the task is switched. Since different processors have different internal register allocations and sometimes the stack grows in different ways, the key issue of porting is how to protect the status of registers when switching tasks for different processors, as well as the switching of the system stack and the task stack, so as to write a good software layer between the underlying hardware and the operating system. The Lingyang SPCE061A microcontroller has five general registers R1~R5, as well as the segment register SR and the program counter PC. There are a total of 7 CPU internal registers that need to be saved before the task is switched. The μC/OS-II system implements task switching by calling OSCtxSw().

Speech Recognition System Example

This system verifies the successful transplantation of μC/OS-II on SPCE061A by designing a speech recognition system. The system creates a total of 4 real-time tasks. The hardware implementation only requires adding corresponding audio circuits and LCD display modules to the minimum system.

//Create speech recognition initialization task

OSTaskCreate(Task1, (void * )0, (void*) tackl[-TASK—STK—SIZE-1], 1);

//Create a voice training task

OSTaskCreate(Task2, (void * )0, (void*) tack2[-TASK—STK—SIZE-1], 2);

//Create a speech recognition task

OSTaskCreate(Task3, (void * )0, (void*) tack3[-TASK—STK—SIZE—1], 3);

//LCD display task

OSTaskCreate(Task4, (void * )1, (void*) tack4[-TASK—STK—SIZE-1], 4);

At the same time, the signal quantity is used to realize the communication between the speech recognition task and the LCD display task, so that after the system successfully recognizes the speech, it can control the LCD to output the correct or incorrect information. System operation results: The system is initialized and the training function is called to perform speech recognition training; after the training is successful, the speech recognition loop is entered and the speech recognition results are displayed on the LCD.

Conclusion

The μC/OS-II operating system has strong real-time performance and a small amount of code (more than 8K in total). It has been ported to many processors. Porting μC/OS-II to the SPCE061A chip has certain application value, making the design of the application system based on SPCE061A more flexible. At the same time, the porting of the μC/OS-II real-time operating system to SPCE061A can not only improve the real-time performance, reliability and stability of the application system based on SPCE061A, but also improve the portability of the application software and reduce the R&D cycle.

References:

1. JEAN J, LABROSSE. uC/OS-II open source real-time embedded operating system [M]. Translated by Shao Beibei. Beijing: China Electric Power Press, 2001

2. Shao Beibei. Online Development Method for Embedded Microcontrollers[M]. Beijing: Tsinghua University Press, 2004

3. Ren Zhe. Principles and Applications of Embedded Real-time Operating System uC/OS-II [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005

4. Liu Haicheng, Qin Jinping, Han Xichun. Principles and Applications of MCU-DSP Microcontrollers [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2006

Keywords:SPCE061A Reference address:Design of embedded application system based on Lingyang SPCE061A

Previous article:FPGA Design of Traffic Light Control Circuit
Next article:A brief discussion on the porting of μCOSII to the ARM processor based on the Cortex-M3 core

Recommended ReadingLatest update time:2024-11-16 20:36

Design of dot matrix electronic display screen based on SPCE061A
1 Introduction 无忧电子开发网 http://www.51kaifa.com In some public places such as stations, shopping malls, stock exchanges, factories and mines, it is often necessary to use LED (light-emitting diode) electronic display screens to release real-time and changing information or conduct advertising. LED e
[Microcontroller]
Design of dot matrix electronic display screen based on SPCE061A
Analysis and processing of RF reader output signal based on SPCE061A single chip microcomputer
At present, the application of readers is becoming more and more widespread. In the process of production and sales, people often suffer from the lack of a quick and easy way to intuitively display the output signal of the reader, so that the product often needs to be reworked and the signal output of the product needs
[Microcontroller]
Analysis and processing of RF reader output signal based on SPCE061A single chip microcomputer
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号