共2条
1/1 1 跳转至页
[转帖]基于TMS320DM642的网络摄像机设计(中英文对照)
引言
网络摄像机的解决方案有多种选择,但是市场主流产品一般选择两种方案:(1)采用CPU+ASIC,(2) 采用双CPU结构,即一个嵌入式CPU和一个专用信号处理芯片DSP。受专用DSP芯片处理能力的限制,现有的嵌入式网络摄象机中使用的视频处理算法基本是H.263以下的标准。
本文介绍一种基于TMS320DM642 DSP的网络摄像机设计方案。其操作系统、通信协议、网络协议、音视频处理软件均在一颗TMS320DM642上实现,降低了开发的难度。
TMS320DM642芯片简介
TI公司的TMS320DM642(以下简称DM642)是一款专门面向多媒体应用的专用DSP。该DSP时钟高达600 MHz,8个并行运算单元,处理能力达4800MIPS;采用二级缓存结构;具有64位外接存储器接口;兼容IEEE-1149.1(JTAG)边界扫描;为了面向多媒体体应用,还集成了3个可配置的视频端口、面向音频应用的McASP(Multi Channel Audio Serial Port)、10/100Mb/s的以太网MAC等外设。鉴于DM642的上述优点,本网络摄像机系统就以DM642为核心,完成音频信号的实时采集、压缩及传输功能。
硬件设计
系统电路组成如图1所示。从摄像机输入的视频信号和从麦克风输入的音频信号经采集、A/D转换为数字信号后送入DSP。DSP在信源处对音频信号进行压缩编码和合流,然后通过局域网和英特网将数据传输给视频监控中心。监控中心同时监视多个现场,接收或发送报警信号,并根据需要通过异步串行总线RS-485实时控制云台,调整摄像头的方向和位置。
视频采集电路
本系统采用的视频解码芯片是Philips公司的SAA7115。从模拟视频输入口输入的全电视信号在SAA 7115内部经过钳位、抗混叠滤波、A/D转换、YUV分离电路之后,在YUV到YCrCb的转换电路中转换成BT.656视频数据流,输入到压缩核心单元DM642中。DM642的3个视频口VP0、VP1、VP2与视频编解码芯片相接。
在本系统中,只有一路视频输入,故VP1、VP2端口未用,VP0通道配置为8位BT.656视频输入口。视频数据的行/场同步信号包含在BT.656数字视频数据流的EAV(end of active video)和SAV(start of active video)时基信号中,视频口只需视频采样时钟和采样使能信号即可。SAA7115内部寄存器参数的配置和状态的读出通过I2C总线进行。视频接口的原理如图2所示。
音频输入/输出电路
本系统采用TI的高性能立体声编解码器TLV320AIC23(以下简称AIC23)实现音频信号的采集和播放。AIC23与DM642的I/O电压兼容,可以实现与DM642的McASP接口无缝连接。
在本系统中,AIC23工作于主模式,左右声道的采样字宽均为16bit。数据接口为DSP模式。通过I2C总线设置内部寄存器的工作参数和反馈状态信息。
因为网络传输的固有特点,音频数据和视频数据从网络摄像机端到达监控中心不可能是均匀的,如果网络摄像机端不做任何纠正处理,则很难保证音视频的同步输出。为了实现音频和视频的同步,本文利用锁相环PLL1708,从SAA7115的LLC引脚输出27MHz时钟,经PLL1708产生AIC23的主时钟MCLK。由于音视频采样信号采用同一个时钟源,就不会出现音视频不同步的问题。PLL1708的SCKO3引脚输出默认时钟频率18.433MHz,作为AIC23的输入主时钟MCLK。AIC23内部采用的时钟可通过设置寄存器由主时钟MCLK分频得到。
以太网接口电路
本系统用LXT971作为快速以太网物理层自适应收发器。由于LXT971支持IEEE802.3标准,提供MII (media independent interface)接口,可以支持MAC,而DM642内部正好集成有以太网媒体存取控制器,所以LXT971可以和DM642实现无缝连接。连接电路如图3所示,其中BH1102为1:1的隔离变压器。从DM642传输过来的数据通过LXT971转换为以太网物理层能接收的数据后,通过RJ-45头传输到因特网。
存储器扩展电路
DM642内部有16KB的一级程序缓存,16KB的一级数据缓存和256KB的程序数据共享二级缓存。但这对于直接处理图象数据是不够的,因此扩展了两片32MB的SDRAM来存放原始图像数据,4MB的FLASH来存放应用程序。二者都映射到DM642的外部数据空间。
CPLD电路
本系统采用的CPLD是Xilinx公司的XC9572XL。该芯片具有72个宏单元,1600个逻辑门;5ns pin-to-pin的逻辑延迟;178MHz的系统频率。CPLD的功能主要是:为FLASH、UART和CPLD异步寄存器空间作地址解码;为FLASH产生3bit的页选信号;监控来自UART的电平中断信号,转换为边沿触发中断信号送给DSP。
RS-485接口电路
该接口连接到摄像机的云台,用来控制云台的转动,调整摄像头的方向和位置。RS-485总线抗干扰能力强,能实现多站点远距离通信。本压缩卡拟采用UART芯片SC16C550和MAXIM公司的MAX487E来实现RS-485信号的传输。SC16C550主要功能是把DSP传送过来的并行信号转换为串行信号。SC16C550 内部的接收器和发送器各有16B的FIFO,能处理的串行信号的速率高达3Mbps。MAX487E是RS-485总线接口芯片,可以工作在全双工、半双工模式。传输速率可达2.5Mbps。
电源电路
整个压缩卡用一个5V的直流变压器供电。由这个5V的电压器产生1.4V和3.3V电压分别给DSP内核和I/O端口供电,产生另外一个3.3V给视频编解码及其他芯片供电。注意这两个3.3V电源要分开设计,以免电源噪声相互干扰。
由于DSP需要两种电压,所以要考虑供电系统的配合问题。加电过程中,应当保证内核电源先上电,最晚也应当与I/O电源一起加。关电源时,先关闭内核电源,再关闭I/O电源。讲究供电次序的原因在于:如果仅CPU内核获得供电,周边I/O没有供电,对芯片不会产生损害,只是没有输入/输出能力而已。如果反过来,周边I/O得到供电而CPU内核没有加电,那么芯片缓冲/驱动部分的晶体管将在一个未知状态下工作,这是非常危险的。
为了解决这个问题,本文采用了开关电源芯片TPS54310PWP,把1.4V模块的电源输出有效引脚PG (power good)连接到3.3V模块的允许电压输入引脚EN。这样,只有当1.4V电压有效之后,3.3V电压才开始上电,这就保证了DM642的内核电压先于I?O电压上电。
软件设计
在本系统中,图像压缩采用H.264标准。H.264具有很高的编码效率,在相同的重建图像质量下,能够比H.263节约50%左右的码率。H.264的码流结构网络适应性强,增加了差错恢复能力,能够很好地适应IP和无限网络的应用。音频编解码采用G.729算法。网络传输采用RTP/RTCP协议以及组播方式, 这样可以保证传送的质量。在操作系统方面,采用基于DSP/BIOS的TI参考架构5(RF5)。基于RF5操作系统的应用程序模块主要包括:音视频采集模块、压缩编码模块、UART控制模块和网络传输模块。
结语
本方案能在一颗DM642芯片上实现网络摄像机的几乎全部功能,能对音视频进行实时的编解码和实时的网络传输。图像质量高、开发难度低、易于升级,是一种比较理想的网络摄像机解决方案,可广泛应用于视频监控系统中。
关键词: 转帖 基于 TMS320DM642 网络 摄像机
The TMS320C64x™ DSPs (including the TMS320DM642 device) are the highest-performance fixed-point DSP generation in the TMS320C6000™ DSP platform. The TMS320DM642 (DM642) device is based on the second-generation high-performance, advanced VelociTI™ very-long-instruction-word (VLIW) architecture (VelociTI.2™) developed by Texas Instruments (TI), making these DSPs an excellent choice for digital media applications. The C64x™ is a code-compatible member of the C6000™ DSP platform.
With performance of up to 5760 million instructions per second (MIPS) at a clock rate of 720 MHz, the DM642 device offers cost-effective solutions to high-performance DSP programming challenges. The DM642 DSP possesses the operational flexibility of high-speed controllers and the numerical capability of array processors. The C64x™ DSP core processor has 64 general-purpose registers of 32-bit word length and eight highly independent functional units—two multipliers for a 32-bit result and six arithmetic logic units (ALUs)— with VelociTI.2™ extensions. The VelociTI.2™ extensions in the eight functional units include new instructions to accelerate the performance in video and imaging applications and extend the parallelism of the VelociTI™ architecture. The DM642 can produce four 16-bit multiply-accumulates (MACs) per cycle for a total of 2880 million MACs per second (MMACS), or eight 8-bit MACs per cycle for a total of 5760 MMACS. The DM642 DSP also has application-specific hardware logic, on-chip memory, and additional on-chip peripherals similar to the other C6000™ DSP platform devices.
The DM642 uses a two-level cache-based architecture and has a powerful and diverse set of peripherals. The Level 1 program cache (L1P) is a 128-Kbit direct mapped cache and the Level 1 data cache (L1D) is a 128-Kbit 2-way set-associative cache. The Level 2 memory/cache (L2) consists of an 2-Mbit memory space that is shared between program and data space. L2 memory can be configured as mapped memory, cache, or combinations of the two. The peripheral set includes: three configurable video ports; a 10/100 Mb/s Ethernet MAC (EMAC); a management data input/output (MDIO) module; a VCXO interpolated control port (VIC); one multichannel buffered audio serial port (McASP0); an inter-integrated circuit (I2C) Bus module; two multichannel buffered serial ports (McBSPs); three 32-bit general-purpose timers; a user-configurable 16-bit or 32-bit host-port interface (HPI16/HPI32); a peripheral component interconnect (PCI); a 16-pin general-purpose input/output port (GP0) with programmable interrupt/event generation modes; and a 64-bit glueless external memory interface (EMIFA), which is capable of interfacing to synchronous and asynchronous memories and peripherals.
The DM642 device has three configurable video port peripherals (VP0, VP1, and VP2). These video port peripherals provide a glueless interface to common video decoder and encoder devices. The DM642 video port peripherals support multiple resolutions and video standards (e. g., CCIR601, ITU-BT.656, BT.1120, SMPTE 125M, 260M, 274M, and 296M).
These three video port peripherals are configurable and can support either video capture and/or video display modes. Each video port consists of two channels — A and B with a 5120-byte capture/display buffer that is splittable between the two channels.
For more details on the Video Port peripherals, see the TMS320C64x Video Port/VXCO Interpolated Control (VIC) Port Reference Guide (literature number SPRU629).
The McASP0 port supports one transmit and one receive clock zone, with eight serial data pins which can be individually allocated to any of the two zones. The serial port supports time-division multiplexing on each pin from 2 to 32 time slots. The DM642 has sufficient bandwidth to support all 8 serial data pins transmitting a 192-kHz stereo signal. Serial data in each zone may be transmitted and received on multiple serial data pins simultaneously and formatted in a multitude of variations on the Philips Inter-IC Sound (I2S) format.
In addition, the McASP0 transmitter may be programmed to output multiple S/PDIF, IEC60958, AES-3, CP-430 encoded data channels simultaneously, with a single RAM containing the full implementation of user data and channel status fields.
McASP0 also provides extensive error-checking and recovery features, such as the bad clock detection circuit for each high-frequency master clock which verifies that the master clock is within a programmed frequency range.
The VXCO interpolated control port (VIC) provides digital-to-analog conversion with resolution from 9-bits to up to 16-bits. The output of the VIC is a single bit interpolated D/A output. For more details on the VIC port, see the TMS320C64x Video Port/VXCO Interpolated Control (VIC) Port Reference Guide (literature number SPRU629).
The ethernet media access controller (EMAC) provides an efficient interface between the DM642 DSP core processor and the network. The DM642 EMAC support both 10Base-T and 100Base-TX, or 10 Mbits/second (Mbps) and 100 Mbps in either half- or full-duplex, with hardware flow control and quality of service (QOS) support. The DM642 EMAC makes use of a custom interface to the DSP core that allows efficient data transmission and reception. For more details on the EMAC, see the TMS320C6000 DSP Ethernet Media Access Controller (EMAC) / Management Data Input/Output (MDIO) Module Reference Guide (literature number SPRU628).
The management data input/output (MDIO) module continuously polls all 32 MDIO addresses in order to enumerate all PHY devices in the system. Once a PHY candidate has been selected by the DSP, the MDIO module transparently monitors its link state by reading the PHY status register. Link change events are stored in the MDIO module and can optionally interrupt the DSP, allowing the DSP to poll the link status of the device without continuously performing costly MDIO accesses. For more details on the MDIO, see the TMS320C6000 DSP Ethernet Media Access Controller (EMAC) / Management Data Input/Output (MDIO) Module Reference Guide (literature number SPRU628).
The I2C0 port on the TMS320DM642 allows the DSP to easily control peripheral devices, boot from a serial EEPROM, and communicate with a host processor. In addition, the standard multichannel buffered serial port (McBSP) may be used to communicate with serial peripheral interface (SPI) mode peripheral devices.
The DM642 has a complete set of development tools which includes: a new C compiler, an assembly optimizer to simplify programming and scheduling, and a Windows™ debugger interface for visibility into source code execution.
High-Performance Digital Media Processor (TMS320DM642)
2-, 1.67-, 1.39-ns Instruction Cycle Time
500-, 600-, 720-MHz Clock Rate
Eight 32-Bit Instructions/Cycle
4000, 4800, 5760 MIPS
Fully Software-Compatible With C64x™
VelociTI.2™ Extensions to VelociTI™ Advanced Very-Long-Instruction-Word (VLIW) TMS320C64x™ DSP Core
Eight Highly Independent Functional Units With VelociTI.2™ Extensions:
Six ALUs (32-/40-Bit), Each Supports Single 32-Bit, Dual 16-Bit, or Quad 8-Bit Arithmetic per Clock Cycle
Two Multipliers Support Four 16 x 16-Bit Multiplies (32-Bit Results) per Clock Cycle or Eight 8 x 8-Bit Multiplies (16-Bit Results) per Clock Cycle
Load-Store Architecture With Non-Aligned Support
64 32-Bit General-Purpose Registers
Instruction Packing Reduces Code Size
All Instructions Conditional
Instruction Set Features
Byte-Addressable (8-/16-/32-/64-Bit Data)
8-Bit Overflow Protection
Bit-Field Extract, Set, Clear
Normalization, Saturation, Bit-Counting
VelociTI.2™ Increased Orthogonality
L1/L2 Memory Architecture
128K-Bit (16K-Byte) L1P Program Cache (Direct Mapped)
128K-Bit (16K-Byte) L1D Data Cache (2-Way Set-Associative)
2M-Bit (256K-Byte) L2 Unified Mapped RAM/Cache (Flexible RAM/Cache Allocation)
Endianess: Little Endian, Big Endian
64-Bit External Memory Interface (EMIF)
Glueless Interface to Asynchronous Memories (SRAM and EPROM) and Synchronous Memories (SDRAM, SBSRAM, ZBT SRAM, and FIFO)
1024M-Byte Total Addressable External Memory Space
Enhanced Direct-Memory-Access (EDMA) Controller (64 Independent Channels)
10/100 Mb/s Ethernet MAC (EMAC)
IEEE 802.3 Compliant
Media Independent Interface (MII)
8 Independent Transmit (TX) and 8 Independent Receive (RX) Channels
Management Data Input/Output (MDIO)
Three Configurable Video Ports
Providing a Glueless I/F to Common Video Decoder and Encoder Devices
Supports Multiple Resolutions and Video Standards
VCXO Interpolated Control Port (VIC)
Supports Audio/Video Synchronization
Host-Port Interface (HPI) [32-/16-Bit]
32-Bit/66-MHz, 3.3-V Peripheral Component Interconnect (PCI) Master/Slave Interface Conforms to PCI Specification 2.2
Multichannel Audio Serial Port (McASP)
Eight Serial Data Pins
Wide Variety of I2S and Similar Bit Stream Format
Integrated Digital Audio I/F Transmitter Supports S/PDIF, IEC60958-1, AES-3, CP-430 Formats
Inter-Integrated Circuit (I2C) Bus
Two Multichannel Buffered Serial Ports
Three 32-Bit General-Purpose Timers
Sixteen General-Purpose I/O (GPIO) Pins
Flexible PLL Clock Generator
IEEE-1149.1 (JTAG) Boundary-Scan-Compatible
548-Pin Ball Grid Array (BGA) Package (GDK and ZDK Suffix), 0.8-mm Ball Pitch
548-Pin Ball Grid Array (BGA) Package (GNZ and ZNZ Suffixes), 1.0-mm Ball Pitch
0.13-µm/6-Level Cu Metal Process (CMOS)
3.3-V I/O, 1.2-V Internal (-500)
3.3-V I/O, 1.4-V Internal (A-500, -600, -720)
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 | |
【FRDM-MCXN947评测】核间通信MUTEX被打赏50分 |