420 likes | 713 Views
Cypress PSoC 可配置混合信号片上系统 简介. Luo Sai (keith @ BBS) 科大 11 系博 2005.3.27. Agenda. 嵌入式系统简介 PSoC 可配置混合信号片上系统 开发环境和开发流程 回顾 & 展望. 感性认识: What’s PSoC. What’s PSoC ? PSoC = Programmable System-on-Chip 可配置(混合信号)片上系统 是 Cypress 生产的一种面向嵌入式应用的芯片 用单片就可以构成一个系统,即 SoC(System on Chip)
E N D
Cypress PSoC 可配置混合信号片上系统简介 Luo Sai (keith @ BBS) 科大11系博 2005.3.27
Agenda • 嵌入式系统简介 • PSoC 可配置混合信号片上系统 • 开发环境和开发流程 • 回顾 & 展望
感性认识:What’s PSoC • What’s PSoC ? • PSoC = Programmable System-on-Chip 可配置(混合信号)片上系统 • 是Cypress生产的一种面向嵌入式应用的芯片 • 用单片就可以构成一个系统,即SoC(System on Chip) • 低成本(几个$),用于替代C51等8位机系统 • PSoC的特点 • 混合信号处理 • 可配置的互连通路 • 运行时动态配置 • 软/硬件设计方法
嵌入式系统 简介 • 嵌入式系统 • 执行专用功能 • 并被内部计算机控制的设备或者系统 • 为什么叫“嵌入”? • 早期:专用的大型设备和机房 • 70年代:出现微处理器和微型计算机,小、价廉、可靠 • 其数值计算能力和智能化水平引起控制专业人士注意,被电气加固和机械加固,并配以外围接口,“嵌入”到控制系统中。
比较(追求的目标不同) • 通用计算机系统 • 高速:8086286386…P4 • 海量存储:640KB预言 • 易用性:Windows… • 嵌入式系统 • “嵌入”(体积小):如买学生票的那个纸片 • 智能化控制:51、PIC、68k等指令集 • 高可靠性:看门狗、一些编程技术 • 低功耗:手机的待机时间 • 安全:如一卡通 • ……
嵌入式系统的两个基本特征 • 首先,是专用的,解决现实世界的真实问题 • 大自然是模拟的连续的,必须要能够处理模拟信号 • 其次,是智能的,带一定的计算能力 • 计算能力依靠离散的数字电路完成 CPU
PSoC的单芯片解决方案: • PSoC=M8C CPU核+模拟阵列+数字阵列+其它 • 数字阵列+M8C:数值计算和通信 • 模拟阵列:处理模拟信号 • PSoC的设计如同搭积木般,将不同功能的模块安放到不同的位置上,并用线连接起来 • 低成本
更低的成本:一个报警器的例子 Traditional Solution Cypress Solution PSoC BOM =$4.80 System BOM =$6.07
设计过程 • IDE工具:PSoC Designer,图形界面(GUI) • 硬件设计方法 • 在IDE中配置数字块和模拟块,并设置互联通道 • IDE自动生成硬件的初始化代码,以及所配置功能的编程库 • 软件设计方法 • C语言,以及汇编 • 进入main()之前,系统自动配置并初始化硬件 • C程序可使用前面生成的编程库 • 特点 • 软硬件都在同一个环境中完成设计 • 硬件可以动态改变(这些代码也是自动生成的)
PSoC • 可配置混合信号片上系统
PSoC = Programmable System-on-Chip • PSoC is a configurable mixed signal array with an on board controller. • Create your customized chip. User Defines: WhatFunctions Appear WhenThey Appear HowThey Interconnect
Example of “What Functions Appear” • PSoC can be defined to meet customer requirements with Countless configuration possibilities • Both of these devices are made from the same chip! Device 1 Device 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 Amplifiers • 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 Delta-Sigma A/D • One 6-Bit D/A • One 8-Bit D/A • Two Low-Pass Filters
“When Functions Appear”In-Application Reuse of Resources • Dynamic Reconfiguration allows multiple function sets to operate on the SAME CHIP at DIFFERENT TIMES in the SAME APPLICATION • Example: • 23 Hours 59 minutes per day • Accepts Money • Distributes Beverages • A few seconds each night • Dynamically reconfigures into a 300 baud Modem • Transmits coin, beverage and maintenance status to central office • Benefits • Only cost delta is phone interface • Increased machine profitability
How They Interconnect • Define connections between pins and function blocks • Define connections between function blocks • Define clock paths • Change connections dynamically too!
Digital PSoC Blocks • Eight 8-bit Digital PSoC Blocks Available • Two Types: • Basic (4) • Communications (4) • - Programmed at the • Functional Level • - Not Programmed at the • Gate Level
Analog PSoC Blocks • Twelve Analog PSoC Blocks Available • Three Types: • Continuous Time (4) • Switch Capacitor C (4) • Switch Capacitor D (4) Continuous Time Switched Capacitor D Switched Capacitor C
User Modules • Pre-configured and Pre-characterized Digital • and Analog PSoC Blocks • Analogous to On-chip Peripherals • Timer- Counters – PWM’s • UART – SPI • A/D –DAC’s - SAR • Defines the Register Bits for Initial Configuration • Selected via Double Click in IDE • User Modules Include • Application Programmer Interfaces (APIs) • Interrupt Service Routines (ISRs) • Specific UM Data Sheets
Digital User Modules • 8, 16, 24, 32-bit Timer • 8, 16, 24, 32-bit Counter • 8, 16-bit PWM • 8, 16-bit Dead Band Generator • (2 Phase Underlapped Clock) • Pseudo Random Source (PRS) • Cyclic Redundancy Check (CRC) Generator • I2C Master • I2C Slave • SPI Master • SPI Slave • Full Duplex UART • IrDA receiver and transmitter
Analog User Modules • A/D Converters • 8-bit Successive Approximation • 8-bit Delta Sigma • 11-bit Delta Sigma • 12-bit Incremental • 7-13 bit Variable Incremental • Dual input 7-13 bit Variable Incremental • Tri input 7-13 bit Variable Incremental • D/A Converters • 6, 8, and 9-bit • 6 and 8 bit multiplying • Filters • 2-pole Low-pass filter • 2-pole Band-pass filter • Amplifiers • Programmable Gain Amplifier • Instrumentation Amplifier • Inverting Amplifier • Programmable Threshold Comparator • DTMF Dialer
Software User Modules • I2C Master • EEPROM • LCD – Interface for Hitachi HD44780 controller
集成开发环境 • (PSoC Designer) • 和开发流程
Integrated Development Environment • Device Editor • Application Editor • C Compiler • Assembler • Librarian • Debugger
PSoC Design Flow • Determine system requirements • User Modules • Choose User Modules • Place User Modules • Set global and User Module parameters • Define the pin-out/interconnect for the device • Generate the application • Review generated code • Demonstrate working configuration
Requirements & Implementation —— Example —— Pup 需求:闪动2个LED灯,2Hz,duty cycle分别是40%和20% PSoC 16-bit PWM ÷ 65535 P2[0] (1.4Hz) (94kHz) (1.5MHz) 24MHz ÷16 ÷16 VC1 VC2 16-bit PWM ÷ 65535 P2[1] (1.4Hz)
PSoC Designer Device Editor – Selection Mode • Selecting 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 consumed resources 选择的功能模块 可用的硬件资源 功能框图 该功能模块的手册
PSoC DesignerDevice Editor – Combined Place & Pinout View • Placing 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 • Select desired placement option for UM • Select UM and resource interconnections • Select/configure UM and global device resources • Define clocking for UMs
Configure Global Resources CPU_Clock: 24MHz 32K_Select: Internal PLL_MODE: Disable VC1 = SysClk/N: N=16 ……
Configure User Modules • PWM16_1: We want to generate a 1/5 duty cycle • Set Clock to VC2 (94kHz) • Set Enable • Set Period to 65535 (1.4Hz) • Set PulseWidth to 13107 • ……
Interconnect Blocks to Resources • Route PWM16_1 to pin: • Connect PWM16_1 output to Row_0_Output_0 • Connect Row_0_Output_0 to GlobalOutEven_0 Left Click Left Click
Define the Pin-out Route PWM16_2 output to pin
Time to Create Application Code 按下这个按钮 生成这些代码 所有的API和ISR都可修改 对比WinCE的生成(Platform Builder)和Linux的生成(make menuconfig): PSoC 配置/控制硬件的代码 WinCE/Linux 纯软件(OS)
PSoC DesignerApplication Editor • For Users to Write Code • For Users to Assemble/Compile Code • View and 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 pointer *The C compiler needs to be enabled for use.
PSoC Designer C Compiler • The CY3202-C compiler. • Features Include: • ANSI C Compiler • Supports Inline 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 • Librarian • C Interrupts are Supported • #pragma interrupt_handler <name> *
回顾 • PSoC硬件组成 • M8C 8位CPU • 数字阵列 • 模拟阵列 • 其他外围 • 设计方法 • 在PSoC Designer中选择并配置用户功能模块 • 设置互联和引脚 • 系统生成 • 用C或汇编编写其他代码
思想的魅力 • 组成方式——功能级可配置的数字/模拟阵列 • 以数值计算的方式去解决模拟世界中的问题 • PSoC同时拥有数/模阵列,单片就可以构成一个系统 • MCU也有模拟部分,但其功能固定,不使用时成为摆设。PSoC总有一种功能会让你用到,利用率高,因而价格低。 • 动态可变的系统构成 • 硬件适应任务:任务不同,则硬件也不同。 • 设计方法 • 在同一环境内同时完成硬件和软件的开发 • 并自动生成相关代码
嵌入式系统展望 • 廉价 • 将更多的数/模功能集成到单片上,如PSoC • 要仔细权衡好成本与功能的矛盾 • 高性能 • 成本已不太重要,可以接受多片系统的价格 • 多片,因此数字/模拟电路可独立发展 • 如DSP、高速运放、高精度ADC • 二者的折衷——现在是一个空白 • PSoC 8位机,性能太弱,应用受限 • 能否再设计出一种16/32位的类PSoC系统?应用将会更加广泛。
谢谢! • 详情参考Cypress网站的On-line Training