This article refers to the address: http://
Abstract : This paper introduces the basic characteristics of ST20's OS20 real-time embedded operating system. Through the application design of DVB-T digital TV set-top box R&D project, the main problems of software development of set-top box software and the realization of software architecture are analyzed, including the state machine design of the system, the realization of the search algorithm, and the design of the EPG-based SI decoding system. Implementation and optimization, from various aspects, describes the application practice of OS20 real-time operating system in set-top box design.
Keywords : OS20; embedded system; set-top box; digital video broadcasting; electronic program guide
1 Introduction
In a relatively short period of time, DTV and SDTV cannot be lowered to the price of existing analog TV receivers, so it is also necessary to display the program of terrestrial digital television broadcasting on the analog television receiver through the terrestrial digital STB.
This article combines the author's experience in the development of DVB-T receiver using ST DTTi5516 main chip, combined with ST Semiconductor's OS20 real-time operating system, to talk about several major issues in the application design of digital TV receiver development.
2 system introduction
Taking DVB-T as an example, the entire terminal receiving decoding process is as shown in the following figure.
Figure 1 Terminal receiving decoding process
The process of processing the digital TV signal by the set-top box is as follows: the TV radio frequency signal is tuned by Tuner (high-frequency head), and the analog-to-digital conversion is performed, and the output of the 36 MHz intermediate frequency digital signal is sent to the OFDM demodulation module for demodulation, and then becomes TS flow. The channel decoding obtains the MPEG-2 TS stream, and the demultiplexing module (integrated descrambling module) selects an MPEG-2 audio and video stream and corresponding data information, and obtains the digital information of the selected program after being decoded by the source. Since the output of the set-top box is connected to the analog TV, the digital information is encoded by the analog signal to obtain an analog signal output to the conventional analog television.
3 software system
3.1 Software Hierarchy
The software structure hierarchy is mainly divided into three layers: the driver layer, the middle layer, and the application layer. The software structure hierarchy is shown in Figure 2.
Figure 2 software hierarchy diagram
In addition to the driver-driven change of the driver layer, the main work is focused on the application layer and the DVB-T module API. Among them, the packaged API mainly includes drawing points, lines, frames (with various foreground and background colors), drawing various languages ​​(can increase or decrease and replace fonts), drawing bitmaps, and increasing or decreasing menus according to menu structure. Menu page turning, request and reception of EPG and teletext in dbase, switch switching of subtitle, etc.
3.2 OS20 real-time operating system
In the project development plan designed by the author, ST's STLite/OS20 real-time multitasking operating system is used, which has the following basic features:
1) Adopt a priority-based multi-task preemptive scheduling strategy;
2) The kernel is short, real-time, and can perform fast context switching (less than 5μs) with high efficiency;
3) Open source code and support a series of processor chips (the kernel is mainly divided into two versions C1 and C2);
4) Low memory requirements: For the kernel, only 600B internal and 11K RAM are required (C1 core only needs 3K); for each process, only 24B internal (C1 core is 32B) and 36B external are required.
This highly efficient operating system provides an efficient multitasking environment for embedded systems based on the ST20 platform, including task scheduling management, clock management, memory management, interrupt handling, synchronization and mutual exclusion through semaphores, and messaging. The queue implements message communication and the like.
4 design and implementation of each software application module
4.1 GUI and state machine design
Interface style selection: Select pop-up menus and dialogs. For example, the data structure of the Menu includes a title bar, a total number of items, a current selection (highlighted) item, a menu handle, and a menu item structure array head pointer;
Font: Generate dot matrix fonts, including English widened 16 dot matrix fonts, Chinese simplified traditional 16*16 (for EPG and Teletext interfaces) and 24*24 (for menus and dialogs) dot matrix fonts (one of GB2312 standard) Level font), Latin-1 European eight countries (English, French, German, Spanish, Italian, Dutch, Portuguese, Polish) language letter set 16 * 16 dot matrix font.
Palette: The platform supports an optional 16-color or 256-color palette. For 24-bit images as close as possible to the primary color, the palette selection is key. Organize all the pictures to be displayed into a large picture with photoshop, select the best displayed 256-color index value, and export the corresponding 256-color color palette.
State machine: In the case of TV program playback, press the number keys, Ch+/- to switch channels, press Vol+/- to control the volume, Mute to mute the switch, press the channel button and the up and down buttons to quickly select the channel you want to watch ( Press the left or right button to switch between all channels and favorite channels. Press the Menu button to enter the menu and press the EPG button to enter the EPG interface. The module state switching relationship is shown in Figure 3.
Description: K: indicates the button message, receives and converts the infrared remote control button input; M: indicates that an operation is selected.
Figure 3 system state transition diagram
4.2 Â Design of major digital TV function modules
4.2.1 Search mechanism
The search algorithm for digital TV is very important, because not only to find out the channel list, but also to analyze a certain degree of information about each channel. The search algorithm includes manual search and automatic search algorithms. Automatic search is achieved by manually searching the for loop of the frequency. So just discuss the manual search. The search process is shown in Figure 4.
Figure 4 search flow chart
First, the driver API is called to set the parameters such as Tuner frequency and symbol rate, and the frequency is locked (if it fails, then return), according to the way of data update, whether to clear the ProgramList and TransponderList, and then search and parse the PAT table, the PAT table is parsed. After that, the PMT table and the SDT table are parsed one by one. After all the programs are completed, the NIT table is parsed to obtain network information, the TransponderList is updated, and finally the return is successful.
It should be noted that: First, when searching, you should use Tuner's driver function to detect its lock status, but you cannot simply set the timeout. There are three states of Tuner: lock success, lock failure, and lock. For the success of the lock and the failure of the lock, you can return immediately; for the locked state, you need to set a certain timeout mechanism, such as 1s, to decide whether to abandon the search; second, in the automatic search, for each search, you must confirm The dbase process has completed the relevant table parsing and needs to be synchronized with semaphores.
4.2.2 Construction of Data Base and EPG
Data Base, including the construction of ProgramList, TransponderList, and EPG information. Among them, the construction of ProgramList and TransponderList is completed during the search. When the user manages the channel, it needs to update and write Flash.
EPG information (herein referred to as basic EPG, excluding extended EPG), consists of DVB-SI. For EPG information, the most important is the program schedule and current/next information solved from the EIT table, corresponding to the EIT Schedule table (table ID 0x50-0x6F) and the EIT p/f table (table ID 0x4E- 0x4F).
The amount of information in the EIT table is very large. If there are 200 programs, if there are 20 programs per program per program, the description of the program content of each program must be stored with 256 Bbytes (SI1.0 standard), if the spread is One week program guide, only the program content description information needs storage space: 200*20*7 (days)*256≈7MB, such a large storage space to achieve such a small part of the function, whether for Flash or SDRAM is intolerable .
Figure 5 Comparison of receiving speeds of different receiving methods
To this end, only the EIT table information of a Program (currently playing or default playing program) is parsed and accessed. The EIT table information is updated when the set top box is started or when the user changes the station. Although in theory, all EIT table data can be collected and buffered in a loop sent by the front end for resolution. However, due to the limitation of the demultiplexing processing speed and the sensitivity of the remote control button response, it is possible It is not possible to receive and parse all EIT data in one cycle, so a compromise is made between the amount of data to be demultiplexed and the response speed of the remote control button.
According to the DVB standard, the EIT table information cyclic transmission interval within 8 days does not exceed 10s, so the program schedule does not need to be accepted in chronological order. The method of out-of-order reception and parsing can greatly improve the resolution speed of the EIT table. The project practice proves that the method of out-of-order reception and parsing can improve the refresh rate of one week program guide information by more than three times! As shown in Figure 5. After optimization, the one-week program guide of the Program being watched can be updated in about 20s.
The implementation of Teletext and Subtitle can be implemented by calling the corresponding API according to the initialization->open->link data flow process.
5 conclusions
Like many embedded real-time operating systems, ST's OS20 features real-time, efficient and refined features required by embedded systems for stable and efficient application to high-speed digital TV reception and decoding. Through the application design practice of DVB-T digital TV set-top box research and development project, this paper proves that the design of the state machine design, the search algorithm and the design and implementation of the EPG-based SI decoding system are better. s solution.
references:
[1] ISO/IEC 13818-1, Information technology - Generic coding of moving pictures and associated audio: Systems [S], 1994.
[2] STMicroelectronics Inc. Dtti5516 Data Sheet. [DB/OL]. Http://
[3] ETSI EN 300 468 V1.6.1, Video Broadcasting (DVB), Specification for Service Information (SI) in DVB systems [S], 2004.
[4] ETSI EN 300 708 V1.2.1, Television systems, Data transmission within Teletext [S], 2003.
[5] Gu Zhiqi, Yu Songyu. Design and implementation of set-top box SI module [J]. Television Technology, 2004 (3): 51-53.
[6] Zhu Bing, Zheng Shibao. Application of multi-task real-time operating system in digital TV receiver [J]. Television Technology, 2005 (8+): 76-85.
[7] Zheng Zonghan. Real-time system software foundation [M]. Beijing: Tsinghua University Press, 2003.
[8] Xu Deng, Zheng Shibao, Jin Jian. Design and implementation of an optimized set-top box SI engine [J]. Television Technology, 2005 (5): 13-15.
[9] Liu Jiufu, Sun Demin, Yang Zhong, et al. Dynamic testing of embedded software [J]. Microcomputer Information, 2006 (1): 82-84.
North American Power Plug,AC Power Cord,USA UL Power Cords
Ningbo Aurich Electronics Co.,Ltd , http://www.powercordset.com