Design of motion control MP3 based on SEP4020 microprocessor

Publisher:zhihuaLatest update time:2010-04-10 Source: 电子科技 Keywords:SEP4020 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

Motion recognition is a hot topic. After launching the sensational multi-touch technology, Apple is preparing to apply for its own motion recognition patent. Motion recognition is simply to use the acceleration sensor to detect the speed change in space and extract the action through the algorithm. Motion recognition has applications in many aspects, such as Wii, mobile phone sensing games, four-propeller aircraft, etc., but it is rarely or even not used in MP3 control. A major trend of today's electronic products is motion control. Imagine an MP3 without any touch or mechanical buttons. As long as you shake it back and forth, you can perform all the most basic control operations. It is both smart and fashionable. This should be a new operating experience. This article will explore how to design such an MP3 that can be normally controlled by motion.

1 Hardware Platform

1.1 SEP4020 Embedded Processor

The driver described in this article is based on the SEP4020 embedded microprocessor. SEP4020 is a processor designed by the National ASIC System Engineering Technology Research Center of Southeast University. It is designed using 0.18 μm standard CMOS process and embedded with ASIX CORE (32-bit RISC core, compatible with ARM720T, with 8kB instruction data cache and full-function MMU). The SEP4020 chip integrates various functions, including:

8/16-bit SRAM/NOR FALSH interface, 16-bit SDRAM interface
Hardware NAND FLASH controller, supports NAND FLASH self-start, supports software/hardware ECC check
10M/100M adaptive Ethernet MAC, supports RMII interface
64k Byte high-speed on-chip SRAM
USBl. 1 Device, full speed 12Mb/s
supports I2S audio interface
Supports MMC/SD card
LCD controller, supports 640×480×16-bit TFT color screen and STN black and white, grayscale screen
RTC, supports calendar function/WatchDog, supports backup power
10-channel TIMER, supports capture, external clock drive and MATCHOUT
4-channel PWM, supports high-speed GPIO
4-channel UART, supports infrared
2-channel SSI, supports SPI and Microwire protocol
2-channel SmartCard interface, compatible with IS07816 protocol
Supports up to 97 GPIO, 14 external interrupts
Supports linked list DMA transfer and external DMA transfer
On-chip DPLL, supports multiple power consumption modes: IDLE, SLOW, NORMAL SLEEP

1.2 MC9S08QG8

The motion capture judgment part in this article is controlled by MC9S08QG8. MC9S08QG8 is a single-chip microcomputer of Freescale Company, and its performance is as follows:

8-channel, 10-bit analog-to-digital converter
3 communication interfaces: SCI, SPI, IIC
4k or 8k reprogrammable FLASH memory
Built-in in-circuit emulator (ICE)

1.3 MMA7620

The motion sensing in the motion-controlled MP3 is done by MMA7620. MMA7620 is a three-axis acceleration sensor from Freescale, and its performance is as follows:

3-axis acceleration sensing and output, can simultaneously measure the values ​​of three coordinate axes (x, y, z) and output them through three channels

4 sensitivity levels to choose from

With sleep mode

2 Design of motion-controlled MP3

2.1 Motion Capture

An action will generate acceleration from the beginning to the end, so the action can be judged by detecting the magnitude and direction of the acceleration generated by the action. To measure the magnitude of acceleration, an acceleration sensor is needed to express the obtained acceleration in the form of analog quantity, and then the analog quantity obtained by the sensor is converted into a digital signal through an AD conversion module to facilitate subsequent calculations. However, after searching for information, it was found that if an AD converter is used unilaterally to convert the voltage signal obtained from the acceleration sensor into a digital signal and the desired accuracy is required, the cost will be greatly increased. However, many existing single-chip microcomputers have integrated AD conversion modules, and the price of the entire single-chip microcomputer is lower than that of a single three-channel AD conversion chip. What is more impressive is that the processing function of the single-chip microcomputer itself can be used to process the digital signal obtained by AD conversion and predict the action. In addition, many communication protocols are integrated in the single-chip microcomputer, which is simple and robust. Considering the above, if a single-chip microcomputer is used instead of an AD conversion module, the burden of the core board and the development difficulty of the entire project can be reduced.

The acceleration sensor can be the MMA7620 three-axis acceleration sensor of Freescale. The single-chip microcomputer can be the MC9S08QG8 single-chip microcomputer of Freescale. Its integrated eight-channel 9-bit AD conversion module matches the three-channel output of MMA7620, and its volume is also very small, which is suitable for portable devices.

Figure 1 is the schematic diagram of the handheld part, including the microcontroller and sensors PTA0, PTA1, PTA2: Input: Connect to the x, y, z port outputs of the three-axis acceleration sensor respectively, and read the analog data of the x, y, z axis of the acceleration sensor.


PTA3: Output; connected to the Sleep pin of the three-axis acceleration sensor to put the sensor into sleep mode to reduce power consumption and lock it to avoid interference during movement.

PTTB0: Input; used as the serial port receiving pin to receive commands from the core board.

PTFBl: Output; used as the serial port sending pin to send the action information measured by the acceleration sensor and processed by the microcontroller to the core board.

PTB6, PTB7: Output; connected to the gselect pin of the accelerometer to control the sensitivity of the accelerometer.

2.2 Action judgment

Using Freescale's FreeMASTER software, you can easily debug the program online and view all global variables of the program. For specific software and usage methods, please check the Freescale website. The following data was obtained using FreeMASTER software, with time and AD conversion value as coordinates.

20 data are sampled in each direction each time. Since the reliability of the first data is relatively large, the first data of each group of data is used as the basis for comparison. After many tests, when the value of the x direction is less than 80, it is a right turn action, when the value of the x direction is greater than 170, it is a left turn action, when the value of the y direction is less than 70, it is an upward lift action, and when the value of the y direction is greater than 160, it is a downward press action. Although the above data can represent the action, the difference between the human action time and the processing and analysis speed of the single-chip microcomputer is still too large. In order to solve this problem and synchronize the single-chip microcomputer with the action, the previous two actions can be recorded, and the current action can be filtered according to the previous two actions: if there are several consecutive identical actions, it is judged as one action, and if they are different, it is switched. The switching of actions must bring about changes in the previous and subsequent actions. Memorizing the previous actions can determine whether there is an action switch. This action recognition method is relatively simple and easy to implement. If more accurate recognition is to be achieved, the algorithm needs to be further optimized. Figure 2 shows the result obtained by the AD converter when shaking right. Figure 3 shows the data of swinging back and forth and left and right.


After the action is identified, the action ID agreed upon by both parties is sent through the serial communication protocol. See Table 1 for details.


Through the serial port protocol, the core board can also perform certain control over the sensor and the microcontroller, including sensor sensitivity adjustment and lock sleep function, making the subsequent test development more convenient.

2.3 MP3 Control

As a platform, Linux operating system has good system customization and portability, which makes it occupy an important position in the embedded field. Linux has many good process communication mechanisms, such as memory sharing, pipes, multithreading, signals, etc. Here, signals are selected as the bridge for control communication. Using the complete serial port driver inside Linux, it is easy to send signals to the specified program, that is, the player program, in the soft interrupt receiving program of the serial port. Then the player program receives and judges the signal type, and assigns the corresponding control value to the corresponding control global variable, making intervention control possible. The control uses the player's own mechanism, which makes it more stable and reliable. Madplay is used as the MP3 player software, and its default control is achieved through the terminal keyboard. In order to control the playback with the signal generated by the action, and at the same time not to modify the Madplay program source code in large quantities, the connection between the player and the keyboard can be cut off and connected to the serial port, so that the action of the entire player can be controlled without modifying the upper-level mechanism.

For details on specific system transplantation and required source code software packages, please visit www.armfans.net

2.4 MP3 playback

MC9S08QG8 and SEP4020 communicate through the serial port.

The basic principle of serial port operation is to save the original parameters of the serial port first, then set the parameters required by the program, and restore the scene after the program ends. The general operation of the serial port is as follows:

Header files required for serial port operations

Set up the serial port soft interrupt, fill in the SIGIO structure, and assign the corresponding interrupt function:

Add an automatic play script to the operating system so that the system can search for MP3 files, create a playlist, start the Madplay player, etc. when it boots up. The script code is as follows:


When an action occurs, MC9S08QG8 sends an action signal to SEP4020, and then the Linux kernel in SEP4020 sends a SIGIO (serial port signal) to each user process. Madplay process captures the signal and reads the message on the serial port to determine the form of the action. Two modules need to be added to the Madplay program. The first module is used to read the message on the serial port. The specific implementation method is to open and read the serial port device file /dev/ttySl to obtain the message, and then according to the setting, 4 serial port signals will be read from the device, corresponding to 4 ASCII characters "L, R, U, D" corresponding to four different actions; the second module is the processing function of the response signal. Once the Linux kernel receives the SIGIO serial port signal, the Madplay process enters the soft interrupt to read the serial port message on /dev/ttySl. As soon as the action is determined, Madplay uses the kill function to send the corresponding signal to this process to control the playback.

3 Conclusion

This article introduces the design process of motion control MP3 under Linux operating system for hardware such as SEP4020 processor, and provides an example for the design of MP3 with this control mode. The following are some suggestions for improvement: As a handheld device, motion control MP3 has high requirements for energy consumption, so when designing, it is necessary to consider using more low-power devices to replace high-power devices. The motion control MP3 is restricted in motion, and the judgment of MP3 will be greatly disturbed. Therefore, if it is difficult to make great improvements in the motion sampling method and motion judgment algorithm, other control methods should be considered to temporarily replace motion control for the convenience of continued use.

Keywords:SEP4020 Reference address:Design of motion control MP3 based on SEP4020 microprocessor

Previous article:Design of dimming controller based on single chip microcomputer
Next article:Design and implementation of MCU for multi-point video conferencing control unit

Recommended ReadingLatest update time:2024-11-17 02:55

Small Faults and Solutions of Flash-Memory MP3 Players
Flash MP3 (referring to flash memory with MP3 playback function) is relatively cheap, so it has a large number of users. It is inevitable that we will encounter faults when using it. If it is a serious fault of the product itself, it should be handed over to the dealer or manufacturer for processing. However, for so
[Analog Electronics]
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号