PSoC Short Course Day 1 INTRODUCTION TO PSoC - MIT

Transcription

PSoC Short CourseDay 1INTRODUCTION TOPSoC Q1 2013CYPRESS CONFIDENTIAL

Before we beginInstall PSoC Creator (if you haven’t already)§ Copy PSoCCreatorSetup 2.1.exe from thumbdrive ontolocal machine§ Launch PSoCCreatorSetup 2.1.exe§ Follow installation prompts (typical)§ Raise hands for issues / questionsLoad Presentation and Labs§ Copy Intro To PSoC5.Bundle01.cywrk.Archive01.zip tolocal machine§ Unzip file to preferred folders§ Double Click “Intro To PSoC5.Bundle01.cywrk”CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 52

AgendaTimeTopic10:00 – 10:15 amCourse Introduction and Overview10:15 – 11:45 amPSoC Architecture Overview11:45 – 1:00 pmLunch1:00 – 2:00 pmSW Demo and ArchitectureOverview Lab2:00 – 2:30 pmSystem Resources2:30 – 3:00 pmSystem Resources Lab3:00 – 3:30 pmBreak3:30 – 4:00 pmDigital Peripherals4:00 – 4:30 pmDigital Peripherals Lab4:30 – 5:00 pmAnalog Peripherals10:00 – 10:45 am (Wed.)CYPRESSAnalog Peripherals LabINTRODUCTION TO PSOC 3 AND PSOC 53

Section ObjectivesAt the end of this section you will be able to§ Understand the major differences between PSoC 1/3/5§ Understand the high-level architecture of PSoC 3/5§ Understand the CPU, Digital, Analog and ProgrammableRouting / Interconnect Systems of PSoC 5CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 54

WHAT IS PSoC ?10 years of explosive PSoC growthThousands of active PSoC customersOver One billion PSoC units shippedPSoC is Everywhere!(including over 700 universities)PSoC is a true programmable embedded SoC integratingconfigurable analog and digital peripheral functions,memory and a microcontroller on a single chip.CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 55

PSoC Is Everywhere!HANDHELD PHYSPORTS/FITNESSINDUSTRIALCOMPUTERSINTRODUCTION TO PSOC 3 AND PSOC 5ENTERTAINMENT/ SECURITY/DISPLAYSMONITORINGPRESENTERTOOLSHOME THEATER6

PSoC - Future of Embedded DesignPSoC 1PSoC 3PSoC 5PSoC is the world’s only programmable embedded SoCintegrating configurable analog and digital peripheralfunctions, memory and a microcontroller on a single chip.CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 57

PSoC 1 Device OverviewM8C MicrocontrollerUp to 24 MHz, 4 MIPSFlash Memory4 KB to 32 KB for programstorageSRAM256B to 2 KB for data storageConfigurable Analog FunctionsImplement ADCs, DACs, filters, amplifiers, comparators, etc.Configurable Digital FunctionsImplement timers, counters, PWMs, UART, SPI, IrDA, etc.USES PSOC DESIGNER SOFTWARECYPRESSINTRODUCTION TO PSOC 3 AND PSOC 58

PSoC 1 ArchitectureUSES PSOC DESIGNER SOFTWARECYPRESSINTRODUCTION TO PSOC 3 AND PSOC 59

INTRODUCTION TO PSOC 3/5ARCHITECTURE OVERVIEW10

PSoC 3 / PSoC 5 Platform ArchitectureUSES PSOC CREATOR SOFTWARECYPRESSINTRODUCTION TO PSOC 3 AND PSOC 511

CPU SubsystemARM Cortex-M3§§§§§§§§Industry’s leading embedded CPU companyBroad support for middleware and applicationsUpto 67 MHz; 83 DMIPSEnhanced v7 ARM architectureThumb2 Instruction Set16- and 32-bit Instructions (no mode switching)32-bit ALU; Hardware multiply and divideSingle cycle 3-stage pipeline; Harvard architecture8051§ Broad base of existing code and support§ Upto 67 Mhz; 33 MIPS§ Single cycle instruction setCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 512

CPU SubsystemHigh Performance Memory§ Flash Memory with ECC§ High ratio of SRAM to flash§ EEPROMPowerful DMA Engine§ 24-Channel Direct Memory Access§ Access to all Digital and Analog Peripherals§ CPU and DMA simultaneous access toindependent SRAM blocksOn-Chip Debug and Trace§ Industry standard JTAG/SWD (Serial WireDebug)§ On-chip traceCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 513

CPU SubsystemClocking System§ Multiple Clock Sources Internal Main Oscillator External clock crystal input External clock oscillator inputs Clock doubler output Internal low speed oscillator External 32 kHZ crystal input Dedicated 48 MHz USB clock PLL output§ 16-bit Clock Dividers 8 Digital Domain 4 Analog Domain§ PSoC Creator Configuration Wizard§ PSoC Creator auto-derives clocking sources / dividersCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 514

CPU SubsystemDedicated Communication Peripherals§ Full Speed USB Device 8 bi-directional data end points 1 controlend point No external crystal required Drivers in PSoC Creator for HID classdevices§ Full CAN 2.0b 16 RX buffers and 8 TX buffers§ I2C master or slave Data rate up to 400 kbps Additional I2C slaves may be implementedin UDB arrayCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 515

CPU SubsystemPower Management§ Industry’s Widest Operating Voltage 0.5V to 5.5V with full analog/digitalcapability§ High Performance at 0.5V PSoC 3 @ 67 MHz§ 4 Power Modes (Active, AlternateActive, Sleep and Hibernate)CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 516

Designed for Low Power / Low VoltageHighly configurable clock treeFlexible, automated clock gatingOn-board DMA ControllerDirect Memory transfer betweenperipherals offloads CPU operation,lowering power consumptionUniversal DigitalBlocksImplement features inhardware that reduceCPU processingrequirements, loweringpower consumptionCached OperationsExecution from flashmemory is improved bycaching instructions(PSoC 5 only)Precise CPU FrequenciesPLL allows 4032 differentfrequencies, tunable powerconsumptionCYPRESSIntegrated Analog, Digital andCommunications PeripheralsReduce external component countsand lower overall system powerconsumptionINTRODUCTION TO PSOC 3 AND PSOC 517

Low Power ModesPSoC 3PSoC ableWakeupSourcesResetSourcesActive1.2 mA@ 6 VDXRES,LVD,WDRXRESSleep1 uANoI2CComparatorILO/kHzECOHibernate200 ve3.1 mA@ 6 MHzYesAllAllAllN/AAllSleep2 uANoNoneNoneILOCTWXRESHibernate300 nANoNoneNoneNoneN/AXRESPower Management enabled in PSoC Creator§ Provides easy to use control APIs for quick power management§ Allows code and register manipulation for in-depth controlCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 518

Digital SubsystemUniversal Digital Block Arrays(UDBs)§ Flexibility of a PLD integrated with a CPU§ Provides hardware capability to implementcomponents from a rich library of pre-built,documented and characterizedcomponents in PSoC Creator§ PSoC Creator will synthesize, place androute components automatically as well asprovide static timing analysis§ Fine configuration granularity enables highsilicon utilization§ DSI routing mesh allows any function inthe UDBs to communicate with any otheron-chip function/GPIO pin with 8- to 32-bitdata busesCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 532-bit PWMGP LOGIC16-bit PWMUART # 1GP LOGICGPLOGICUART # 3GPLOGICUART#2LCD Segment DriveGP LOGICI2C Slave16-bit Shift RegGP LOGICSPI Master19

Digital SubsystemOrganized 8/16-bit Timer/Counter/PWM Blocks§ Provides nearly all of the features of a UDB basedtimer, counter or PWM§ PSoC Creator provides easy access to theseflexible blocks§ Each block may be configured as either a fullfeatured 8-bitTimer, Counter or PWM. Two blocksmay be combined to make it 16-bit§ Programmable options§ Clock, enable, reset, capture, kill from any pinor digital signal on chip§ Independent control of terminal count,interrupt, compare, reset, enable, capture andkill synchronization§ Plus§ Configurable to measure pulse-widths orperiods§ Buffered PWM with dead band and killCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 520

Analog SubsystemConfigurable Analog System§ Flexible Routing: All GPIO are AnalogInput/Output§ /- 0.1% Internal Reference Voltage§ Delta-Sigma ADC: Up to 20-bit resolution§ 16-bit at 48 ksps or 12-bit at 192 ksps§ SAR ADC: 12-bit at 700 ksps§ DAC’s: 8-bit resolution, current and voltage mode§ Low Power Comparators§ Opamps (25 mA output buffers)§ Programmable Analog Blocks§ Configurable PGA (up to X50), Mixer, TransImpedance Amplifier, Sample and Hold§ Digital Filter Block: Implement HW IIR and FIRfilters§ CapSense Touch Sensing enabledCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 521

Programmable Routing/InterconnectInput / Output System§ Three types of I/O GPIO, SIO, USBIO§ Any GPIO to any peripheral routing§ Wakeup from sleep on analog, digital or I2Cevents§ Programmable slew rate reduces power andnoise§ Eight different configurable drive modes§ Programmable input threshold capability for SIO§ Automatic and custom/lock-able routing in PSoCCreatorFour separate I/O voltage domains§ Interface with multiple devices using one PSoC 3/ PSoC 5 deviceCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 522

ReviewYou should now be able to:§ Understand PSoC Architecture§ Understand the CPU, Digital, Analog and ProgrammableRouting and Interconnect SubsystemsCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 523

INTRODUCTION TO PSOC 3 AND PSOC 5ARCHITECTURE OVERVIEWLAB24

PSoC Creator 2.0 InterfaceSchematic fileCypress ComponentCatalogWire toolWorkspace ExplorerCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 525

Architecture Overview LabLab Objective§ To make LED4 on your PSoC 3 Development Kit blink.§ To learn how to place and configure components in PSoCCreatorCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 526

Architecture Overview Lab1. Open LAB 1 from theflash drive2. Expand the “ ” sign tothe left of Project 2title to view projectfiles. Double-click theschematic file“TopDesign.cysch” toopen itCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 527

Architecture Overview Lab3. From the “Component catalog” on the right side of the screen,drag & drop “Digital Output Pin” under “Ports and Pins” into thebox (as shown above)ComponentCatalog BoxTop DesignSchematicfilePin ComponentDrag and DropCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 528

Architecture Overview Lab4. Double-click the component to open it in configurationmode and check the configuration as follows:Analog UncheckedDigital Input –UncheckedDigital Output –CheckedHW Connection –UncheckedOutput Enable –UncheckedBidirectional –UncheckedCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 529

Architecture Overview Lab5. In the Workspace Explorer double click on the .cydwr file toopen Design Wide ResourcesDesign Wide Resources“.cydwr” fileCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 530

Architecture Overview Lab6.7.8.Within the Design Wide Resources tab, select the Pins tab (below the chip)On the right hand side of the screen, make sure that Pin 1 is set to port 6pin 3 or P6[3]. This will set your digital output to LED4 on the PSoCDevelopment Board.Build the Project by going to the Build menu and in the drop down click“Build Overview Lab”. This will take a minute to build the project.Design Wide Resources tabBuild Overview LabConfirm Pin 1 is set toport 6 pin 3 or P6[3]Pins tabCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 531

Architecture Overview Lab9.Program the board by going to the Debug menu and click Program fromthe drop down list. Programming should take just a minute. You may haveto select your kit and follow the steps to click on “Port Acquire”.10. Push the Reset button on your board located near Port DVerify that you see LED 4 Blinking.CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 532

Architecture Overview Lab9.Program the board by going to the Debug menu and click Program fromthe drop down list. Programming should take just a minute. You may haveto select your kit and follow the steps to click on “Port Acquire”.10. Push the Reset button on your board located near Port DVerify that you see LED 4 Blinking.CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 533

Architecture Overview LabThis LED will blinkCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 534

INTRODUCTION TO PSOC 3 AND PSOC 5SYSTEMRESOURCES35

Section ObjectivesAt the end of this section you will be able to§ Understand the system block diagram of PSoC 3 / PSoC 5 devices§ Understand and use the PSoC 3 / PSoC 5 System Resources, including: Power System Programming and debugging Configuration and boot process Resets Clocking Memory and Mapping DMA and PHUB I/O InterruptsCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 536

System Block DiagramCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 537

Power System and Supplies (no boost)Standard Power Configuration§ No boost pump§ Vdda Vddd Vddio0/1/2/3§ Vdda 1.8 – 5.5VSupply Rules and Usage§ Vdda: Must be highest voltage in system.Supplies analog high voltage domain and coreregulator§ Vddd: Supplies digital system core regulators§ Vcca: Output of the analog core regulator.External 1.1uF capacitance to ground is required.§ Vccd: Output of the digital core regulator.External 1.1uF capacitance to ground is required.Both Vccd pins must be tied together on the PCBand share the 1.1uF capacitance to ground§ Vddio0/1/2/3: Independent I/O supplies. May beany voltage in the range of 1.8V to VddaCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 538

Power System (with boost) (Only PSoC 3)Boost Converter Configuration§ Used to generate up to 5.0 V (Vout)§ Battery voltage as low as 0.5 V(Vbat)§ Output voltage and current limit based on inputvoltage and boost ratio§ 75 mA max current§ 0.5 – 0.8 V Vbat provides max of 1.95 V Vout§ Schottky diode required when Vout is 3.6V§ Synchronous rectification maximizes efficiency§ Boost may be used to power external circuits§ Only supported for PSoC 3If boost not used§ Vssb, Vbat and Vboost must be tied to ground§ Ind left floatingCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 539

Programming and Debug InterfacesJTAG§ Legacy 4-wire Interface§ Supports all programming and debug featuresSerial Wire Debug (SWD)§ Standard 2-wire interface for all CY tools and kits§ Supports all programming and debug features wthsame performance of JTAG§ Default debug interface in PSoC CreatorCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 540

Programming and General FeaturesFlash operations§§§§Erase allErase block – 256 blocks per device, independent of Flash sizeProgram blockSet block security§ Unprotected – No protection§ Factory Upgrade – Prevents external read§ Field Upgrade – Prevents external read and write§ Full Protection – Prevents external read and write as well as internalwriteGeneral Features available through JTAG/SWD§ I/O boundary scan through JTAG interface§ Enable/Disable JTAG and SWD interfaces§ On Chip Debug features enabled/disabled by firmwareCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 541

Reset Sources§ PPOR – Power on Reset§ XRES – External Reset§ PRES – Under Voltage on external supplies Vddd, Vdda(Precise Low Voltage Reset)§ PRES – Under Voltage on internal supplies Vccd, Vcca§ AHVI – Over Voltage on Vdda (Analog High VoltageInterrupt)§ HRES – Hibernate mode under voltage detect§ SRES – User software and/or hardware generated reset§ WRES – Watchdog Timer reset§ JTAG or SWD interface generated resetCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 542

Clocking Sources§§§§§§§Internal Main Oscillator (PSoC 3): 3-62 MHz ( /-1% at 3 MHz; /-7% at 62 MHz)Internal Main Oscillator (PSoC 5): 3-74 MHz ( /-1% at 3 MHz; /-7% at 74 MHz)PLL Output: 12.67 MHz (can not use 32 KHz crystal)External clock crystal input: 4-33 MHzExternal clock oscillator inputs: 0-33 MHzClock doubler output: 12-48 MHzInternal Low speed Oscillator: 1 kHz, 33 kHz and 100 kHz§ External 32 kHz crystal input for RTCCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 543

Clock DistributionClock Dividers§§§§16-bit dividers8 clock source inputs8 digital domain clock dividers4 analog domain clock dividers§ Provide skew control to reducedigital switching noise§ 1 CPU dividerUDB’s can be used to createadditional digital clocksCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 544

System Clock SetupEasy to configure clockoptions using graphicalconfiguration toolCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 545

Clock ManagementClocks allocated to dividers in clock treeClocks have software APIs to dynamically change frequencyNote: Reuse existing clocks to preserve resourcesDouble click clock to seecomponent windowCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 546

Clock DistributionEMIF Supports:§§§§Sync SRAMAsync SRAMCellular RAMNOR FlashEMIF Usage:§§§§Data only8- or 16-bit data bus8-, 16- or 24-bit address busMax throughput 11-16 MHzdepending on configurationdetailsCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 547

FlashFlash Blocks§ 256 blocks in all devices – 64 KB flash has 256-byte block size§ Each block may be set to 1 of 4 protection levels of increasing security Unprotected – Allows internal and external reads and writes Factory Upgrade – Prevents external read Field Upgrade – Prevents external read and write Full Protection – Prevents external read and write as well as internal write§ Flash is erased and programmed in block unitsSpecs§§§§§Code executes out of FlashFlash-writes block CPU unless executing from cache20 year minimum retention10 K minimum endurance15 ms block erase write timeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 548

Error Correcting Code (ECC)ECC Flash Memory Error Correction§§§§§§Required for some high reliability designs (e.g. automotive and medical)Detects and corrects 1 bit of error per 8 bitsDetects but does not correct 2 bits of errorCorrection is automatic; interrupt and flag bit are set1 byte of ECC data for each 8 bytes of Flash data (1 row)64 KB device includes 8 KB of ECC memory for 72 KB total8 KB is used for configuration data storage if ECC not used (default)§ ECC memory is mapped into contiguous region in peripheral space§ ECC memory may also hold user data§ Code cannot execute out of ECC memoryCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 549

EEPROM2 KB of EEPROM are providedCode cannot execute out of EEPROMEEPROM Specs:§§§§EEPROM writes do not block CPU execution20 year minimum retention100K minimum endurance2 ms single byte erase write time Supports single byte erase and writes (read / modify / write row) May erase or write up to 16 consecutive bytes (1 row) at the same timeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 550

BootloadersSingle Bootloader Supports§§§§I2CUARTUSBOthers as requiredBootloader Integration§ Bootloader platform allows easy customization§ No bootloader programmed in parts at factory§ PSoC Creator integrates bootloader support seamlessly; just another componentBootLoader mingINTRODUCTION TO PSOC 3 AND PSOC 551

Direct Memory Access (DMA)§ 24 hardware channels§ 8 priority levels with minimum bandwidth guarantees§ 128 Transaction Descriptors (TD) tell channel what to do 2kB of dedicated SRAM holds all TD data§ Multiple channels or TDs may be chained or nested§ Configurable burst size§ DMA between peripherals on same spoke limited to 1-byte burst lengthCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 552

GPIO - I/O Digital FeaturesIndependent supply rails§ Each quadrant of device hasseparate Vddio supply§ GPIO Vddio must be VddaLogic level maximum current§ 8 mA sink§ 4 mA sourcePin maximum current§ 25 mA sink§ 25 mA sourceCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 553

GPIO - I/O Digital FeaturesCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 554

GPIO - InterruptsEach GPIO port has:§ Port Interrupt Control Unit (PICU)§ Dedicated Interrupt vectorInterrupt on:§ Rising edge§ Falling dege§ Any edgeStatus Rgister§ Latches which pin triggered interrupt§ Available for firmware read§ Read clearCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 555

GPIO - I/O Analog Features§ All pins inputs and outputs§ Supports two independent analogconnections at each pin§ CapSense Touch Sensing§ LCD char/segment drive§ Hardware controlled analog mux atpin§ Some pins have additional routingfeatures: OpAmps High Current DAC modeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 556

SIO (Special I/O) FeaturesSame as GPIO with exceptions:§ 5.5 V tolerant at all Vdda levels Hot Swap Overvoltage tolerance§ Configurable drive and sense voltagelevels Basic DAC output High Speed CMP input§ Logic level max current 25 mA sink 4 mA source§ Pin max current 50 mA sink 25 mA source§ No Analog§ No LCD char/segment drive§ No CapSense touch sensingCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 557

Pin ManagementPSoC Creator can select pins automatically§ Lock pins when device pin out is finalizedManual override in DWR fileCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 558

InterruptsInterrupt Controller§ 32 interrupt vectors§ Dynamically adjustable vectoraddresses§ 8 priority levels§ Each vector supports one of thesesources Fixed function DMA, DSI (UDB)routePSoC 8051§ 32 interrupt vectors vs. standard 8051is fiveARM Cortex-M3§ 32 interrupts 15 exceptions§ Tail chainingCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 559

Interrupt ComponentGUI-based ConfigurationDouble click clock to seecomponent windowAPIisr 1 Start() – Configures and enables the interrupt. Typically the only API requiredto be calledAdvanced APIs§§§§§§§§isr 1 SetVector() – Dynamically change vector addressisr 1 SetPriority() – Dynamically change vector priorityisr 1 GetPriority() – Read current priorityisr 1 Enable() – Enable interrupt vectorisr 1 GetState() – Return current state of interrupt vector enableisr 1 Disable() – Disable interrupt vectorisr 1 SetPending() – Force a pending interruptisr 1 ClearPending() – Clear a pending interruptCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 560

ReviewYou should now be able to:§ Understand the system block diagram of PSoC 3 / PSoC 5 devices§ Understand and use the PSoC 3 / PSoC 5 System Resources,including: Power system Programming and debugging Configuration and boot process Resets Clocking Memory and Mapping DMA and PHUB I/O InterruptsCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 561

INTRODUCTION TO PSOC 3 AND PSOC 5SYSTEM RESOURCES LAB62

System Resources LabLab Objective§ To convert an output from the potentiometer into a digitalnumber using the ADC§ To display the digital number on the LCD Screen on PSoCDevelopment KitCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 563

System Resources LabInstructions:1.Open LAB 22.Place the Analog Pin from Component Catalog as shownhere in the adjacent box3.Place the Delta Sigma ADC in the box as shown below.4.Double-click on the component to open it in the configuration mode andmake the following changes:Set Properties to:Conversion Mode: 1-MultiSampleInput Mode: SingleResolution: 12-BitsInput Range: Vssa to VddaConversion Rate: 1000 SPS Buffer Gain: 1Clock Frequency: 131 kHz(Calculated value)CYPRESSBuffer Mode: Rail to RailINTRODUCTION TO PSOC 3 AND PSOC 564

System Resources Lab5. Use the wire tool found on the left side of the worksheet (shown in slide23) to connect Pin 1 to the ADC input. To use the wire tool hover overthe connections until an ‘X’ appears, then click to make the connection.6. Your final schematic should look like this when completeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 565

System Resources Lab7. In the Workspace Explorer double click on the .cydwr file to openDesign wide Resources (as explained in Overview lab)8. In the Design wide Resources tab locate the section for pins on the right9. Connect the LCD to Port 2 by assigning LCDPort[6:0] to P2[6:0].Connect Pin 1 to the potentiometer (Port 6, Pin 5) by assigning Pin 1 toP6(5).ConfirmLCD is set to Port 2 orLCDPort [6:0] to P2[6:0]Pin 1 is set to P6[3]CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 566

System Resources Lab10. Build the project by going to the Build menu selecting Build SystemResources Lab. This will take some time to build the project.11. Program the board by going to the Debug menu and in the drop downclick Program12. Push the Reset button on your board located near Port DVerify: When you turn the POT you should see the ADC values changeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 567

System Resources LabPOT (Potentiometer)CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 568

INTRODUCTION TO PSOC 3 AND PSOC 5DIGITAL PERIPHERALS69

Section ObjectivesAt the end of this section you should be able to:§ Understand Universal Digital Blocks (UDBs) in PSoC 3 /PSoC 5§ Use and implement digital peripherals with PSoC CreatorCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 570

Digital SubsystemsFixed-function Peripherals§ Counter/Timer/PWMs, I2C,USB, CANUniversal Digital BlocksDigital Interconnects Between§ Clocks§ IO pins§ Interrupts§ DMA§ External Memory§ Analog systemCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 571

UDB ArrayCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 572

Digital Signal Interconnects (DSI)Routing Example:§ Single UDB Pair§ 7000 DSI registersCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 573

DSI, AutomatedPSoC Creatorenables:§ Schematic entry§ Automatic placeand route§ Optimizations foranalog and digitalroutingCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 574

UDB Block DiagramCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 575

Digital PeripheralsSample of DigitalPeripherals:§ Counter§ Timer§ PWM§ PRS§ I2C§ USB§ UART§ SPI§ CAN§ Char/Segment LCD DriveCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 576

CounterFixed/UDB Counters:§ General-Purpose counter§ Continuous, reload on reset,terminal count, or one shot mode§ Compare options: § Enable, reset, capture inputs§ Compare, TC, interrupt outputs§ Interrupts on various eventsFixed-Function Counters:§ 4 Available§ 8- or 16-bit§ Down counter only§ Single capture registerUDB-Based:§ 8-, 16-, 24- or 32-bit§ Many options: Enable, count, capture,compare 4-deep capture FIFODouble ClickCounter to configureCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 577

TimerFixed/UDB Timers:Fixed-Function Counters:§ General-Purpose timer for measuringtime between H/W events§ Capturing times of events§ Periodic pulse or interrupt§ Continuous, reload on reset, terminalcount or one shot mode§ Enable, reset, capture and triggerinputs§ Compare, terminal count, interruptoutputs§ Interrupts on various events§§§§4 Available8- or 16-bitCapture on rising edge onlySingle capture registerUDB-Based:§ 8-, 16-, 24- or 32-bit§ Many options: Enable, trigger, capture Capture counter and captureinterrupt CTs 4-deep capture FIFODouble Click Timerto configureCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 578

PWMFixed/UDB PWMs:Fixed-Function PWMs:§ General-Purpose PWM for motorcontrol, LED brightness, etc.§ 8- or 16-bit§ Compare options: § Configurable deadbands§ Enable, trigger and kill inputs§ Biphase, TC and interrupt outputs§ Interrupts on various events§§§§4 Available1 PWM outputLeft-alignedHardware deadband and output killUDB-Based:§ 1 or 2 PWM outputs§ Left, right, center or dual-edge align§ Many options: Enable, trigger, kill and compareDouble Click PWMto configureCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 579

I2CFixed/UDB I2Cs:Fixed-Function I2C:§§§§§§§§ 1 Available§ Standard 100 Kbps or Fast 400 Kbps§ Responds Sleep Low-Power mode ifdedicated SIO connections usedI2C slave, master or multi-masterHardware or firmware address decode7- or 10-bit addressing (10-bit F/W only)Bus stalling / clock stretchingSMBus supported w/additonal firmwareRoutes SDA/SCL to any GPIO/SIO pinsInterrupts for variety of bus eventsUDB-Based:§ Adds high-speed mode; up to 3.4MbpsDouble Click I2C to configureCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 580

Pseudo Random SequencerPseudo Random Sequencer (PRS)Specs:§§§§§§2- to 64-bit sequence lengthSerial output bit streamContinuous or single step run modesStandard or custom polynomialDouble Click PRSStandard or custom seed valueEnable input provides synchronized to configureoperation with other components§ Computed pseudo-random number canbe read directly from the linear feedbackshift register (LFSR)CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 581

USBSpecs:§ Fixed-function, USB 2.0 Full Speed (12Mbps) peripheral§ 8 unidirectional endpoints§ Shared 512 byte buffer§ Transfer Types: Control, Interrupt, Bulk,Isochronous§ DMA access / capable§ Wake from sleepDouble Click USB to configureCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 582

UARTSpecs:§ Full-Duplex, Tx only and Rx only§ 5- to 9-data bits§ 110- to 921600-bps or arbitrary up to 4Mbps§ Rx and Tx buffers 1- to 255-bytes§ Framing, Parity and Overrun errorDouble Click UARTdetectionto configure§ 9-bit address mode with hardwareaddress detection§ Optional Tx enable for RS-485CYPRESSINTRODUCTION TO PSOC 3 AND PSOC 583

SPISpecs:§§§§§§§§Master or SlaveData rates to 33 Mbps2- to 16-bit data widthDouble Click SPI to4 SPI modesconfigureLSB or MSB first1- to 255-byte Rx and Tx buffersHardware Slave Select generationSupports 3-wire modeCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 584

CANSpecs:§ CAN 2.0A/B spec. compliant Remote Transmission Request (RTR) support Programmable bit rate up to 1Mbps External CAN PHY connects to any GPIO§ Transmit path: 8 transmit message buffers Programmable priority for each§ Receive path: 16 receive message buffers 16 acceptance filters/masks DeviceNet addressing support Option to link multiple receive buffers to/froma hardware FIFOCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 5Double Click CAN toconfigure85

LCD DriveSpecs:§ Drives up to 736-segments (16-commons/46-frontplane)§ Up to 62 total LCD drive pins; commons andsegment lines mapped to any GPIO§ High multiplex ratio of up to 1/16 for max 16segments§ Type A (standard) and Type B (low power)waveforms supported§ Wide operating voltage range supported (2V to5.2V) for LCD panels§ Static, ½, 1/3, ¼, 1/5 bias voltage levels§ Vias voltage generation using dedicated DAC, andinternal resistor leader§ Up to 128 levels of software controlled contrast§ Ability to move display data from memory to LCDvia DMA§ Adjustable LCD refresh rate from 10 Hz to 150 HzCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 5Double Click LCD toconfigure86

ReviewYou should now be able to:§ Understand Universal Digital Blocks (UDBs) in PSoC 3 /PSoC 5§ Use and implement digital peripherals with PSoC CreatorCYPRESSINTRODUCTION TO PSOC 3 AND PSOC 587

INTRODUCTION TO PSOC 3 AND PSOC 5DIGITAL PERIPHERALSLAB88

Digital Peripherals LabLab Objective§ To use two PWMs to change the

§PSoC Creator provides easy access to these flexible blocks §Each block may be configured as either a full featured 8-bitTimer, Counter or PWM. Two blocks may be combined to make it 16-bit §Programmable options §Clock, enable, re