Universal Serial Bus (USB) is an emerging computer peripheral serial communication interface standard. It overcomes the defects of traditional computer serial/parallel ports and has the advantages of hot swap, plug and play, reliable data transmission, convenient expansion, and low cost. It has become one of the necessary interfaces for current computers and is also widely used in embedded system design.
In order to enable USB developers and enthusiasts to easily learn USB protocols and develop USB devices, Lingyang Technology Education Promotion Center has designed a USB interface module. The USB interface module can be connected to any MCU that meets the resource conditions, and designers can use it to complete their own USB devices. This article introduces the use of the USB interface module of Lingyang Education Promotion Center combined with the voice features of the SPCE061A microcontroller to complete a recording system with a USB interface.
2 Introduction to chip features
2.1 Introduction to SPCE061A features
SPCE061A is a 16-bit microcontroller with a high cost performance developed and produced by Lingyang Technology. It can be used to implement a voice recording and playback system very conveniently and flexibly. The chip has 8 10-bit precision ADCs, one of which is an audio conversion channel, and has a built-in automatic gain circuit. This provides convenient hardware conditions for voice recording. Two-channel 10-bit precision DAC only needs an external power amplifier (SPY0030A) to complete voice playback. In addition, Lingyang's 16-bit microcontroller has a set of easy-to-learn and easy-to-use high-efficiency instruction systems and integrated development environment. In this environment, standard C language is supported, and mutual calls between C language and Lingyang assembly language can be realized. In addition, library functions for voice recording and playback are provided. As long as you understand the use of library functions, it will be easy to complete voice recording and playback. These provide convenient conditions for software development:
Features:
u 16-bit μ'nSP microprocessor;
u Working voltage: core working voltage VDD is 2.6~3.6V (CPU), IO port working voltage VDDH is VDD~5.5V (I/O);
u CPU clock: 0.32MHz~49.152MHz;
u Built-in 2K word SRAM;
u Built-in 32K flash ROM;
u Programmable audio processing;
u Crystal oscillator;
u When the system is in standby state (clock is in stop state), the power consumption is less than 2μA@3.6V;
u 2 16-bit programmable timer/counters (initial count value can be automatically preset);
u 2 10-bit DAC (digital-to-analog conversion) output channels;
u 32-bit general-purpose programmable input/output port;
u 14 interrupt sources can come from timer A/ B, time base, 2 external clock source inputs, key wake-up;
u With touch key wake-up function;
u Use Lingyang audio encoding SACM_S240 mode (2.4K bits/second), can accommodate 210 seconds of voice data;
u Phase-locked loop PLL oscillator provides system clock signal;
u 32768Hz real-time clock;
u 7-channel 10-bit voltage analog-to-digital converter (ADC) and single-channel sound analog-to-digital converter;
u Sound analog-to-digital converter input channel has built-in microphone amplifier and automatic gain control (AGC) function;
u With serial device interface;
u Low voltage reset (LVR) function and low voltage detection (LVD) function;
u Built-in online emulation board (ICE, In-Circuit Emulator) interface.
2.2 Introduction to USB interface module
2.2.1 Basic features and parameter indicators
u Product model: USB MODULE SN-008;
u USB interface module operating voltage: 3.3V or 5V;
u USB interface module dimensions: 35mm×52mm;
u USB interface module working system environment: windows98/windows me/windows 2000/windows xp. 2.2.2 Main functions
u The USB interface module supports USB bus power supply and peripheral power supply. The USB interface module can provide power to peripherals.
u The USB interface module can be connected to any MCU that meets the resource requirements for USB communication. 2.2.3 Comparison between the block diagram and the actual picture
Figure 2.1 USB interface module structure diagram and physical picture
The JP1 interface of the USB interface module leads out the data lines (D0~D7), control lines (INT_N, RESET_N, CS_N, ALE, WR_N, RD_N), and power lines (VCC, GND) of PDIUSBD12, which is convenient for developers to use the USB interface module to connect with various types of MCUs; the PDIUSBD12 chip is used to complete all hardware functions of the USB interface; the function of capacitor C4 is to complete the power-on reset of the PDIUSBD12 chip; the crystal oscillator is used by the PDIUSBD12 chip; the L1~L4 magnetic beads have an anti-interference effect to ensure the correct data transmission; the USB interface completes the connection between devices; the indicator light lights up when the USB interface module is enumerated successfully, and flashes when transferring data; J5 is the ground wire, which is mainly used with the experimental box launched by Lingyang Education Promotion Center to play a fixing role; the power jumper is used to change the power supply mode of the USB interface module, or change the power supply mode of the peripherals.
3 Introduction to the overall system plan
The structural block diagram of the system is shown in Figure 3.1.
Figure 3.1 System structure diagram
The system includes a USB interface module, SPR4096 Flash memory, a playback output part, a 61 board (including MIC voice input, keyboard) and a PC, with the PC serving as a USB host. The system first completes the collection of voice data through the three buttons on the 61 board (record, stop, play). If the voice resources need to be uploaded to the PC, the upload can be achieved through the PC client software control system. The SPR4096 Flash memory can also store a small amount of recording data.
The USB interface module mainly completes the USB interface function, allowing the PC to communicate with the 61 board through the USB interface.
4 System Hardware Design
Figure 4.1 below is the circuit schematic diagram of the USB interface module:
Figure 4.1 USB interface module circuit diagram
There are relatively few devices, mainly the PDIUSBD12 chip and the crystal oscillator, reset and other peripheral circuits that make the chip work. In addition, magnetic beads (L1~L4) are used to improve the anti-interference ability of the system.
Physical hardware interface connection:
USB interface module interface detailed description The
detailed description of the USB interface module JP1 port is shown in Figure 4.2:
Figure 4.2 Schematic diagram of USB interface module port
The description of each port of USB interface module JP1 is shown in Table 4.1: Table 4.1 Description of each port of USB interface module JP1
Port Symbols |
type |
illustrate |
VCC |
Power |
power supply |
GND |
Power |
land |
NC |
useless |
|
INT_N |
Output |
Interrupt control (active low) |
RESET_N |
Input |
Reset (active low) |
CS_N |
Input |
Chip select (active low) |
ALE |
Input |
Address Latch Enable |
WR_N |
Input |
Write strobe (active low) |
RD_N |
Input |
Read strobe (active low) |
D0~D7 |
Output /Input |
Bidirectional data port |
Power jumper description (J1)
The power jumper of the USB interface module is shown in Figure 4.3:
Figure 4.3 USB interface module power jumper
There are 4 PINs in Figure 4.3, namely PC, MCU, D12, PC. Different combinations of these 4 PINs can form different power supply forms, as shown in Table 4.2: Table 4.2 USB interface module power jumper combination form
Pin connection form |
Power supply form |
MCU is connected to D12, other PINs are not connected |
The USB interface module is powered by the MCU board |
PC is connected to D12, other PINs are not connected |
The USB interface module is powered by the USB bus |
PC is connected to D12, PC is connected to MCU |
USB interface module and MCU board are powered by USB bus power |
5 System software design
In the main program, firstly, the USB device (recording system with USB interface) is enumerated. After the enumeration is successful, the data of the PC client software is received, and the recording and playback data are uploaded and downloaded according to the relevant data. There is also a key scan process in the main function to control whether the recording system is in the recording state, playback state, or stop state. Note that the recording data upload and download functions can only be realized in the stop state. The interrupt request processing of PDIUSBD12 is completed in the interrupt program. The flowchart of the main program is shown in Figure 5.1, and the flowchart of the interrupt program is shown in Figure 5.1. [page]
Figure 5.1 Main program flow chart
Figure 5.2 Interrupt subroutine flow chart
The application plan is a bit empty. Can you write more description of the principle of software implementation? For example: after recording, save it to XX place, then respond to some input number, upload the recorded voice data to the PC application through the software and hardware protocol of the USB interface module...
The recording function is mainly realized by calling Lingyang's function library. The main functions are as follows:
SACM_DVR_InitQueue();
SACM_DVR_InitEncoder(RceMonitorOff);
SACM_DVR_Stop();
SACM_DVR_TestQueue()
The program code of the recording function is as follows:
case 0x01: // Record Key
if (KeyStatus == Record)
SACM_DVR_Stop();
KeyStatus = Record;
Addr = 0;
SACM_DVR_Initial(Manual);
SP_SIOMassErase();
SACM_DVR_InitQueue();
SACM_DVR_InitEncoder(RceMonitorOff);
Key=0;
break;
Operation steps and experimental phenomena:
Step 1: Compile and connect the provided firmware program to ensure that the compilation and connection are correct.
Figure 5.3 Compiling and linking the firmware program
Step 2: Download the firmware to the experiment box or 61 board.
Figure 5.4 Firmware download
Step 3: Unplug the Probe (EZ_Probe).
Step 4: Connect the USB interface module to the 61 board as shown below. If it is an experimental box, just connect the USB module to the experimental box.
Figure 5.5 Connection diagram between USB interface module and 61 board
Step 5: Connect the 61 board to SPR4096. For the specific connection diagram, refer to Figure 5.6. This step is omitted for the experimental box.
Figure 5.6 Connection diagram of SPCE061A and SPR4096
Step 6: If it is a test box, connect IOA0, IOA1, and IOA2 to the keyboard respectively, and the other end of the keyboard to the power supply. This step is omitted for the 61 board.
Step 7: Use a USB cable to connect the USB interface module to the PC and install the driver.
Figure 5.7 Driver installation prompt
Figure 5.8 Driver installation prompt
Figure 5.9 Driver installation prompt
Figure 5.10 Driver installation prompt
Figure 5.11 Diagram of selecting driver file
Step 8: Double-click to open the PC user program. The user interface is shown in Figure 5.12. [page]
Figure 5.12 PC user interface
Step 9: Click the Open Device button and the following prompt will pop up.
Figure 5.13 Prompt information
Step 10: Press the "Record" button (IOA0) to record, press the "Stop" button (IOA1) to stop recording and playback, and press the "Play" button (IOA2) to play the voice.
Step 11: Select the voice resource storage path, click the Upload button to complete the data upload.
Figure 5.14 Data upload diagram
Click OK and a message will pop up.
Figure 5.15 Prompt information
Step 12: Select the path to save the Wave file and convert the file.
Figure 5.16 Prompt information
Step 13: Click the Play and Stop buttons to play the file on the PC.
Step 14: Click the Download button to download the file to the SPCE061A for playback. The relevant prompt information is as follows.
Figure 5.17 Download file prompt information
6 Conclusion
The characteristics and advantages of using this chip for this type of design.
The structural characteristics of Lingyang's SPCE061A and its related development platform have brought great convenience to our development of products with voice features; this system is only a basic application of SPCE061A, reflecting the great support of SPCE061A's various resources for product development, and at the same time reflecting its voice characteristics. USB is a popular interface for computer peripherals today. This system uses the USB interface module to complete a USB device with certain functions, which serves as a reference for the development of related USB devices.
Previous article:Development standardization issues for single-chip microcomputers or embedded systems
Next article:Application of single chip microcomputer in USB design
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [CY8CKIT-149 PSoC 4100S Review] + Porting Program Code
- Source program simulation file based on 51 single-chip multifunctional intelligent desk lamp (with clock, posture correction, display temperature and brightness)
- What are the advantages of CC1350, CC1352R and CC1352P?
- Pelvic floor muscle therapy instrument parameters technical parameters
- Design and Application of Power Monitoring System for Hubei Daguannan Expressway
- Analysis of installation techniques of magnetic flap level gauge for high liquid level tank
- 【LAUNCHXL-CC1350-4】- 0: Unboxing Post
- SparkRoad Review (2) - Can I burn a Cortex-M0 soft core?
- GD32L233C rtos debut
- To become a high-level electronic engineer, in addition to programming and PCB drawing, please recommend other circuit design books. Thank you