1、Cypress PSoC 可配置混合信号片上系统可配置混合信号片上系统简介简介Luo Sai(keith BBS)科大11系博2005.3.272Agenda 嵌入式系统简介 PSoC 可配置混合信号片上系统 开发环境和开发流程 回顾&展望3感性认识:感性认识:Whats PSoCWhats PSoC?PSoC=Programmable System-on-Chip 可配置(混合信号)片上系统 是Cypress生产的一种面向嵌入式应用的芯片 用单片就可以构成一个系统,即SoC(System on Chip)低成本(几个$),用于替代C51等8位机系统PSoC的特点 混合信号处理 可配置的互连通
2、路 运行时动态配置 软/硬件设计方法4嵌入式系统简介5嵌入式系统嵌入式系统 简介简介嵌入式系统 执行专用功能 并被内部计算机控制的设备或者系统为什么叫“嵌入”?早期:专用的大型设备和机房 70年代:出现微处理器和微型计算机,小、价廉、可靠 其数值计算能力和智能化水平引起控制专业人士注意,被电气加固和机械加固,并配以外围接口,“嵌入”到控制系统中。6比较(追求的目标不同)通用计算机系统 高速:8086286386P4 海量存储:640KB预言 易用性:Windows 嵌入式系统“嵌入”(体积小):如买学生票的那个纸片 智能化控制:51、PIC、68k等指令集 高可靠性:看门狗、一些编程技术 低功
3、耗:手机的待机时间 安全:如一卡通 7嵌入式系统的两个基本特征 首先,是专用的,解决现实世界的真实问题 大自然是模拟的连续的,必须要能够处理模拟信号 其次,是智能的,带一定的计算能力 计算能力依靠离散的数字电路完成CPU8PSoC的单芯片解决方案:PSoC=M8C CPU核+模拟阵列+数字阵列+其它 数字阵列+M8C:数值计算和通信 模拟阵列:处理模拟信号 PSoC的设计如同搭积木般,将不同功能的模块安放到不同的位置上,并用线连接起来 低成本9更低的成本:一个报警器的例子更低的成本:一个报警器的例子8-bit Micro$2.00Crystal+Caps$0.57Filters$0.30Amp
4、s$0.20Speaker Driver$0.15LED Drivers$0.05Circuit Board$1.20Assembly$1.60PSoC Micro.$2.50Circuit Board$0.90Assembly$1.40System BOM=$6.07PSoC BOM=$4.80Traditional Solution Cypress Solution 10设计过程 IDE工具:PSoC Designer,图形界面(GUI)硬件设计方法 在IDE中配置数字块和模拟块,并设置互联通道 IDE自动生成硬件的初始化代码,以及所配置功能的编程库 软件设计方法 C语言,以及汇编 进入m
5、ain()之前,系统自动配置并初始化硬件 C程序可使用前面生成的编程库 特点 软硬件都在同一个环境中完成设计 硬件可以动态改变(这些代码也是自动生成的)11PSoC 可配置混合信号片上系统12PSoC=Programmable System-on-Chip PSoC is a configurable mixed signal array with an on board controller.Create your customized chip.User Defines:What Functions AppearWhen They AppearHow They Interconnect13
6、Example of“What Functions Appear”PSoC can be defined to meet customer requirements with Countless configuration possibilitiesBoth of these devices are made from the same chip!One 8-Bit Counter One 16-Bit Timer One Full-Duplex UART w/Baud Rate Generator One SPI Slave(Full Duplex)One 4-Input 8-Bit Del
7、ta-Sigma A/D One 6-Bit D/A One 8-Bit D/A Two Low-Pass FiltersDevice 1Device 2 One 16-Bit Counter One 8-Bit PWM One Half-Duplex UART One SPI Master One 12-Bit Incremental A/D One Low-Pass Filter One 8-Bit D/A Two Instrumentation Amplifiers14“When Functions Appear”In-Application Reuse of ResourcesDyna
8、mic Reconfiguration allows multiple function sets to operate on the SAME CHIP at DIFFERENT TIMES in the SAME APPLICATIONExample:23 Hours 59 minutes per day Accepts Money Distributes BeveragesA few seconds each night Dynamically reconfigures into a 300 baud Modem Transmits coin,beverage and maintenan
9、ce status to central officeBenefits Only cost delta is phone interface Increased machine profitability15How They InterconnectDefine connections between pins and function blocksDefine connections between function blocksDefine clock pathsChange connections dynamically too!16PSoC BlocksInterruptControl
10、lerLVDSupervisorWatchdogSleep TimerDecimatorSMPI2CSRAMMemoryM8CCPUCoreMAC MultiplyAccumulateFlashProgramMemorySystemClockingGenerator24 MHzInternalOscillatorDigital PSoC Block ArrayAnalog PSoC Block ArrayProgrammableInterconnectand LogicAnalog InputMuxingAnalog OutputDriversPort 5Port 4Port 3Port 2P
11、ort 1Port 0Configurable I/O PortsSystem BusBBBBBBBBCBCBCBCBCTCTCTCTSCSCSCSCSCSCSCSCClocks17Digital PSoC BlocksDR1DR2DR0CLKCLKCLKOUTPROCINPROCDATACLKSCR1INPUTREGCONFIGTIME,CTR,CRCPRS,UART,ETCDBDBDBDODBDIDODR1DR0DITXDRXDCOMMONLYTXDRXDCOMMONLYEight 8-bit Digital PSoC Blocks AvailableTwo Types:Basic(4)C
12、ommunications(4)-Programmed at the Functional Level-Not Programmed at the Gate Level18Analog PSoC BlocksCA InputsREF InputsSNOBUSCBUSA.INC.INCCInputsCB InputsA.SIGNA.REFB.INCC0-31 CCB0-31 CCA0-31 CCF16-32 C 1*!AZ 2 2 2+AZ 1*AZ 12+!AZ)*F.IN1 1*F.IN0PWROS*2BCS 1Continuous TimeTwelve Analog PSoC Blocks
13、 Available Three Types:Continuous Time(4)Switch Capacitor C(4)Switch Capacitor D(4)Switched Capacitor DSwitched Capacitor C19User ModulesPre-configured and Pre-characterized Digital and Analog PSoC BlocksAnalogous to On-chip Peripherals Timer-Counters PWMs UART SPI A/D DACs-SARDefines the Register B
14、its for Initial ConfigurationSelected via Double Click in IDE User Modules Include Application Programmer Interfaces(APIs)Interrupt Service Routines(ISRs)Specific UM Data Sheets20Digital User Modules8,16,24,32-bit Timer8,16,24,32-bit Counter8,16-bit PWM8,16-bit Dead Band Generator(2 Phase Underlappe
15、d Clock)Pseudo Random Source(PRS)Cyclic Redundancy Check(CRC)GeneratorI2C MasterI2C Slave SPI MasterSPI SlaveFull Duplex UARTIrDA receiver and transmitter21Analog User ModulesA/D Converters 8-bit Successive Approximation 8-bit Delta Sigma 11-bit Delta Sigma 12-bit Incremental 7-13 bit Variable Incre
16、mental Dual input 7-13 bit Variable Incremental Tri input 7-13 bit Variable IncrementalD/A Converters 6,8,and 9-bit 6 and 8 bit multiplying Filters 2-pole Low-pass filter 2-pole Band-pass filterAmplifiers Programmable Gain Amplifier Instrumentation Amplifier Inverting AmplifierProgrammable Threshold
17、 ComparatorDTMF Dialer22Software User ModulesI2C MasterEEPROMLCD Interface for Hitachi HD44780 controller23集成开发环境(PSoC Designer)和开发流程24Integrated Development Environment Device Editor Application Editor C Compiler Assembler Librarian Debugger25PSoC Design Flow Determine system requirements User Modu
18、lesChoose User ModulesPlace User ModulesSet global and User Module parameters Define the pin-out/interconnect for the device Generate the application Review generated code Demonstrate working configuration26Requirements&Implementation161616-bit PWM 6553516-bit PWM 6553524MHzVC1VC2(1.5MHz)(94kHz)P20P
19、21(1.4Hz)(1.4Hz)PSoC Pup需求:闪动2个LED灯,2Hz,duty cycle分别是40%和20%Example 27PSoC Designer Device Editor Selection ModeSelecting User Modules View Lists of User Modules in catalog View datasheet for each user module Select user modules and include in current project View a running total of available and co
20、nsumed resources选择的功能模块功能框图可用的硬件资源该功能模块的手册28PSoC DesignerDevice Editor Combined Place&Pinout ViewPlacing User Modules View Block architecture with combined UM&port views Generates routed block to block schematic Routed global I/O connection schematic Step through potential UM placement options Selec
21、t desired placement option for UM Select UM and resource interconnections Select/configure UM and global device resources Define clocking for UMs29Configure Global ResourcesCPU_Clock:24MHz32K_Select:InternalPLL_MODE:DisableVC1=SysClk/N:N=1630Configure User ModulesPWM16_1:We want to generate a 1/5 du
22、ty cycle Set Clock to VC2(94kHz)Set Enable Set Period to 65535(1.4Hz)Set PulseWidth to 13107 31Interconnect Blocks to ResourcesRoute PWM16_1 to pin:Connect PWM16_1 output to Row_0_Output_0 Connect Row_0_Output_0 to GlobalOutEven_0Left ClickLeft Click32Define the Pin-outRoute PWM16_2 output to pin33P
23、in layout:34Time to Create Application Code按下这个按钮生成这些代码所有的API和ISR都可修改对比WinCE的生成(Platform Builder)和Linux的生成(make menuconfig):PSoC 配置/控制硬件的代码WinCE/Linux 纯软件(OS)35PSoC DesignerApplication EditorFor Users to Write CodeFor Users to Assemble/Compile Code*The C compiler needs to be enabled for use.View and
24、 edit individual source files Set and remove bookmarks(Editing tool)Assemble/compile individual files Build entire project including assemble/compile*all files in project Source line error pointer36Build&Debug37PSoC Designer C CompilerThe CY3202-C compiler.Features Include:ANSI C Compiler Supports I
25、nline Assembly and can Interface with Assembly Modules Integrated code compressor Modern Stack-Based Architecture 7 Basic Data Types Including IEEE 32-Bit Floating Point Assembler and Linker Math and String Libraries C Interrupt Service Routines LibrarianC Interrupts are Supported#pragma interrupt_h
26、andler *38回顾&展望39回顾回顾PSoC硬件组成 M8C 8位CPU 数字阵列 模拟阵列 其他外围设计方法 在PSoC Designer中选择并配置用户功能模块 设置互联和引脚 系统生成 用C或汇编编写其他代码40思想的魅力思想的魅力组成方式功能级可配置的数字/模拟阵列 以数值计算的方式去解决模拟世界中的问题 PSoC同时拥有数/模阵列,单片就可以构成一个系统 MCU也有模拟部分,但其功能固定,不使用时成为摆设。PSoC总有一种功能会让你用到,利用率高,因而价格低。动态可变的系统构成 硬件适应任务:任务不同,则硬件也不同。设计方法 在同一环境内同时完成硬件和软件的开发 并自动生成相关代码41嵌入式系统展望嵌入式系统展望廉价 将更多的数/模功能集成到单片上,如PSoC 要仔细权衡好成本与功能的矛盾高性能 成本已不太重要,可以接受多片系统的价格 多片,因此数字/模拟电路可独立发展 如DSP、高速运放、高精度ADC二者的折衷现在是一个空白 PSoC 8位机,性能太弱,应用受限 能否再设计出一种16/32位的类PSoC系统?应用将会更加广泛。42谢谢!详情参考Cypress网站的On-line Training