Cypress PSoC 可配置混合信号片上系统 简介

Post on 12-Jan-2016

102 views 1 download

description

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) - PowerPoint PPT Presentation

Transcript of Cypress PSoC 可配置混合信号片上系统 简介

Cypress PSoC 可配置混合信号片上系统

简介

Luo Sai

(keith @ BBS)

科大 11 系博

2005.3.27

2

Agenda

• 嵌入式系统简介

• PSoC 可配置混合信号片上系统

• 开发环境和开发流程

• 回顾 & 展望

3

感性认识: What’s PSoC

What’s PSoC ?• PSoC = Programmable System-on-Chip 可配置(混

合信号)片上系统• 是 Cypress 生产的一种面向嵌入式应用的芯片• 用单片就可以构成一个系统,即 SoC(System on Chip)• 低成本 ( 几个 $) ,用于替代 C51等 8 位机系统

PSoC 的特点• 混合信号处理• 可配置的互连通路• 运行时动态配置• 软 / 硬件设计方法

4

嵌入式系统简介

5

嵌入式系统 简介

嵌入式系统• 执行专用功能• 并被内部计算机控制的设备或者系统

为什么叫“嵌入”?• 早期:专用的大型设备和机房• 70 年代:出现微处理器和微型计算机,小、价廉、可

靠• 其数值计算能力和智能化水平引起控制专业人士注意,

被电气加固和机械加固,并配以外围接口,“嵌入”到控制系统中。

6

比较(追求的目标不同)• 通用计算机系统

• 高速: 8086286386…P4• 海量存储: 640KB 预言• 易用性: Windows…

• 嵌入式系统• “ 嵌入”(体积小):如买学生票的那个纸片• 智能化控制: 51、 PIC、 68k 等指令集• 高可靠性:看门狗、一些编程技术• 低功耗:手机的待机时间• 安全:如一卡通• ……

7

嵌入式系统的两个基本特征• 首先,是专用的,解决现实世界的真实问题

• 大自然是模拟的连续的,必须要能够处理模拟信号• 其次,是智能的,带一定的计算能力

• 计算能力依靠离散的数字电路完成

CPU

8

PSoC 的单芯片解决方案:• PSoC=M8C CPU核 + 模拟阵列 + 数字阵列 + 其它• 数字阵列 +M8C :数值计算和通信• 模拟阵列:处理模拟信号

• PSoC 的设计如同搭积木般,将不同功能的模块安放到不同的位置上,并用线连接起来

• 低成本

9

更低的成本:一个报警器的例子

8-bit Micro $2.00

Crystal + Caps $0.57

Filters $0.30

Amps $0.20

Speaker Driver $0.15

LED Drivers $0.05

Circuit Board $1.20

Assembly $1.60

PSoC Micro. $2.50

Circuit Board $0.90

Assembly $1.40

System BOM = $6.07 PSoC BOM = $4.80

Traditional Solution Cypress Solution

10

设计过程• IDE 工具: PSoC Designer ,图形界面( GUI )• 硬件设计方法

• 在 IDE 中配置数字块和模拟块,并设置互联通道• IDE 自动生成硬件的初始化代码,以及所配置功能的编程库

• 软件设计方法• C 语言,以及汇编• 进入 main() 之前,系统自动配置并初始化硬件• C 程序可使用前面生成的编程库

• 特点• 软硬件都在同一个环境中完成设计• 硬件可以动态改变(这些代码也是自动生成的)

11

PSoC 可配置混合信号片上系统

12

PSoC = 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 Interconnect

13

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!

•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

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

14

“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

15

How They Interconnect

• Define connections between pins and function blocks

• Define connections between function blocks

• Define clock paths• Change connections

dynamically too!

16

PSoC Blocks

InterruptController

LVDSupervisor

WatchdogSleep Timer

Decimator

SMPI2C

SRAMMemory

M8CCPUCore

MAC MultiplyAccumulate

FlashProgramMemory

SystemClocking

Generator

24 MHzInternal

Oscillator

Digital PSoC Block Array

Analog PSoC Block Array

ProgrammableInterconnect

and Logic

Analog InputMuxing

Analog OutputDrivers

Port 5

Port 4

Port 3

Port 2

Port 1

Port 0

Configurable I/O

Ports

System

Bus

BB

BB

BB

BB

CB

CB CB

CB

CT CT CT CT

SC

SC

SC SC

SC SC

SC

SC

Clocks

17

Digital PSoC Blocks

DR1 DR2DR0

CLK CLK

CLK OUTPROC

INPROC

DATA

CLKS

CR1

INPUTREG CONFIG

TIME, CTR, CRCPRS, UART, ETC

DB DB

DB

DO

DB

DIDODR1

DR0

DI

TXD

RXD

COMMONLY

TXD

RXD

COMMONLY

Eight 8-bit Digital PSoC Blocks Available

Two Types:• Basic (4)• Communications (4)

- Programmed at the Functional Level- Not Programmed at the Gate Level

18

Analog PSoC Blocks

CA Inputs

REF Inputs

SN

OBUS

CBUS

A.IN

C.IN

CCInputs

CB Inputs

A.SIGN

A.REF

B.IN

CC0-31 C

CB0-31 C

CA0-31 C

CF16-32 C

1*!AZ2

2

2+AZ

1*AZ

1

2+!AZ)*F.IN1

1*F.IN0

PWR

OS*2B

CS

1

Port Inputs

Bloc Outputs

VDD

CBUS

Bloc Inputs

P[2:0]

AGND

RE

SIS

TO

RM

AT

RIX

CENAGND

OBUS

VREF

N[2:0]

OBUS

VREFS

PWR

CC

G

CT Bloc

AGND VSS

SCBloc

F2

T[2:0]

R

VREF+

AGND

CP

CK

F[1:0]

OSG

OUT

GOUT

LOUT

P(IN)

VREF-

Co

nti

nu

ou

s T

ime

Twelve Analog PSoC Blocks Available

Three Types:• Continuous Time (4)• Switch Capacitor C (4)• Switch Capacitor D (4)

CA Inputs

REF Inputs

OBUS

CBUS

A.IN

CARR

CB Inputs

A.SIGN

A.REF

B.IN

CC0-31 C

CB0-31 C

CA0-31 C

CF16-32 C

2

1*AZ

1 2+!AZ)*F.IN1

1*F.IN0

PWR

OS*2B

CS

1*!AZ

2+AZ

1*B.SW

2+!B.SW

1*B.SW

2+!B.SW

Sw

itch

ed C

apac

ito

r D

Sw

itch

ed C

apac

ito

r C

19

User Modules

Pre-configured and Pre-characterized Digital and Analog PSoC BlocksAnalogous to On-chip Peripherals

• Timer- Counters – PWM’s• UART – SPI • A/D –DAC’s - SAR

Defines the Register Bits for Initial ConfigurationSelected via Double Click in IDE User Modules Include

• Application Programmer Interfaces (APIs)• Interrupt Service Routines (ISRs)• Specific UM Data Sheets

20

Digital User Modules

8, 16, 24, 32-bit Timer8, 16, 24, 32-bit Counter8, 16-bit PWM8, 16-bit Dead Band Generator

• (2 Phase Underlapped Clock)Pseudo Random Source (PRS)Cyclic Redundancy Check (CRC) Generator

I2C MasterI2C Slave SPI MasterSPI SlaveFull Duplex UARTIrDA receiver and transmitter

21

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 ComparatorDTMF Dialer

22

Software User Modules

I2C Master

EEPROM

LCD – Interface for Hitachi HD44780 controller

23

集成开发环境( PSoC Designer )

和开发流程

24

Integrated Development Environment

• Device Editor • Application Editor • C Compiler• Assembler• Librarian• Debugger

25

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

26

Requirements & Implementation

÷16 ÷16

16-bit PWM

÷ 65535

16-bit PWM

÷ 65535

24MHzVC1 VC2

(1.5MHz) (94kHz)

P2[0]

P2[1]

(1.4Hz)

(1.4Hz)

PSoC

Pup需求:闪动 2 个 LED

灯, 2Hz, duty cycle分别是40%和 20%

—— Example ——

27

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

选择的功能模块

功能框图 可用的硬件资源

该功能模块的手册

28

PSoC 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

• Select desired placement option for UM

• Select UM and resource interconnections

• Select/configure UM and global device resources

• Define clocking for UMs

29

Configure Global Resources

CPU_Clock: 24MHz32K_Select: InternalPLL_MODE: Disable

VC1 = SysClk/N: N=16……

30

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• ……

31

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

32

Define the Pin-out

Route PWM16_2 output to pin

33

Pin layout:

34

Time to Create Application Code

按下这个按钮生成这些代码所有的 API和 ISR 都可修改

对比 WinCE 的生成( Platform Builder)和 Linux 的生成( make menuconfig):PSoC 配置 / 控制硬件的代码WinCE/Linux 纯软件( OS )

35

PSoC DesignerApplication Editor

For Users to Write CodeFor Users to Assemble/Compile Code

*The C compiler needs to be enabled for use.

• 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

36

Build & Debug

37

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> *

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