A11L: 78K0R Low Power MCU Hands-On Lab Renesas Electronics America Inc. Bob Proctor Staff Engineer 12 & 13 October 2010 Version 1.0 1
Bob Proctor Staff Applications Engineer in Durham, NC 3-years at Renesas Primary support duties for R8C products Worked with many customers with Low Power and LCD Segment applications BSEE Formerly a Design Engineer in industrial motor control and a distributor FAE 2 2
Renesas Technology and Solution Portfolio Microcontrollers & Microprocessors #1 Market share worldwide * ASIC, ASSP & Memory Advanced and proven technologies Solutions for Innovation Analog and Power Devices #1 Market share in low-voltage MOSFET** * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis). 3 In the session 110C, Renesas Next Generation Microcontroller and Microprocessor Technology Roadmap, Ritesh Tyagi introduces this high level image of where the Renesas Products fit. The big picture. 3
Renesas Technology and Solution Portfolio Microcontrollers & Microprocessors #1 Market share worldwide * ASIC, ASSP & Memory Advanced and proven technologies Solutions for Innovation Analog and Power Devices #1 Market share in low-voltage MOSFET** * MCU: 31% revenue basis from Gartner "Semiconductor Applications Worldwide Annual Market Share: Database" 25 March 2010 ** Power MOSFET: 17.1% on unit basis from Marketing Eye 2009 (17.1% on unit basis). 4 This is where our session, A11L, is focused within the Big picture of Renesas Products, Microcontroller and Microprocessors. 4
Microcontroller and Microprocessor Line-up Superscalar, MMU, Multimedia Up to 1200 DMIPS, 45, 65 & 90nm process Video and audio processing on Linux Server, Industrial & Automotive High Performance CPU, Low Power Up to 500 DMIPS, 150 & 90nm process 600uA/MHz, 1.5 ua standby Medical, Automotive & Industrial High Performance CPU, FPU, DSC Up to 165 DMIPS, 90nm process 500uA/MHz, 2.5 ua standby Ethernet, CAN, USB, Motor Control, TFT Display Legacy Cores Next-generation migration to RX General Purpose Up to 10 DMIPS, 130nm process 350 ua/mhz, 1uA standby Capacitive touch Ultra Low Power Up to 25 DMIPS, 150nm process 190 ua/mhz, 0.3uA standby Application-specific integration Embedded Security Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 5 Here are the MCU and MPU Product Lines, I am not going to cover any specific information on these families, but rather I want to show you where this session is focused 5
Microcontroller and Microprocessor Line-up Superscalar, MMU, Multimedia 78K Up to 1200 DMIPS, 45, 65 & 90nm process Video and audio processing on Linux Server, Industrial & Automotive ULTRA LOW POWER! High Performance CPU, Easy Low to program Power Low Cost Great IDE High Performance CPU, The Cube FPU, DSC is Suite! Up to 500 DMIPS, 150 & 90nm process 600uA/MHz, 1.5 ua standby Medical, Automotive & Industrial Up to 165 DMIPS, 90nm process 500uA/MHz, 2.5 ua standby Ethernet, CAN, USB, Motor Control, TFT Display Legacy Cores Next-generation migration to RX General Purpose Up to 10 DMIPS, 130nm process 350 ua/mhz, 1uA standby Capacitive touch Ultra Low Power Up to 25 DMIPS, 150nm process 190 ua/mhz, 0.3uA standby Application-specific integration Embedded Security Up to 25 DMIPS, 180, 90nm process 1mA/MHz, 100uA standby Crypto engine, Hardware security 6 These are the products where this presentation applies 6
Low Power Innovations 7 7
Renesas Low Power Solutions Low Power Operation is demanded in all kinds of remote, battery-powered and hand-held applications. The 78K0R microcontroller family offers superior Low power Performance. 8 8
Agenda 78K0R MCU overview The 78K0R-KE3L Evaluation Board overview Low Power Lab Techniques Hands-on Lab 60 minutes Q&A 9 9
78K0R MCU Overview 10 10
78K0R/Kx3 Features Rich peripheral set Serial array unit (up to 6ch SPI/CSI, I2C, UART serial ports) Timer array unit (up to 8ch) Real-time counter (time-of-day updates in HW <1uA current drain) Watchdog timer (windowed function) Clock/buzzer outputs (2ch) Low-Voltage-Indicator (brown-out) circuit Power-On-Clear (well behaved Power-On-RESET) circuit Reduce system parts count/cost with high flexibility 11 <Click to step though the chip features> 11
78K0R/Kx3 Block Diagram Timer Array: 8ch, 16-bit Timer 78K0R 16-bit core 20MHz (13DMIPS) 1.8V - 5.5V -40 to +85C DMA Controller 2ch, 8/16-bit Serial Array Unit 3-4ch UART/SPI/I2C Clock/Buzzer Output (256Hz 10MHz) Flash 16KB-64KB RAM 1KB-3KB Multi-Master I2C 1ch Real-Time Counter: (Clock/Calendar Functions) Watch Dog Timer 10-bit ADC 10 12ch Program Gain Amp 5 gain levels Comparators 2ch Internal OSC (1MHz +/-5%, 8MHz +/-1%, 20MHz +/-1%) Int. WDT OSC: (30kHz) Sub-Clock: (32.768kHz) 64 pin LQFP, TQFP, FBGA 52 pin LQFP 48 pin LQFP 44 pin LQFP, TQFP 16x16 Multiplier 32/32 Divider On chip Debug/ Programming POC (Power On Clear) LVI Low Voltage Indicator 1.91V-4.22V Key Interrupt 12 Here is the block diagram of the 78K0R/KE3L family. They are available in 44, 48, 52 and 64 pin packages, including TQFP, LQFP and FBGA. Flash sizes range from 16k to 64k, and RAM from 1k to 3k. The K series are the general purpose family, where other families such as the L series includes an segment LCD controller. We ll look next at some of these in more detail. 12
78K0R/Kx3 CPU Core Digital Processing 16-bit K0R CPU core Up to 17 DMIPS at 20-MHz clock Most instructions run in a single CPU cycle Complex Instruction Set (CISC) on a RISC-like 3-stage pipeline Full 16-bit arithmetic and logical instruction set High performance and low-power operation Hardware assist 16 x 16 HW multiply in one CPU cycle 32 x 32 HW divide in 16 CPU cycles (compares to some DSPs!) 1- to 15-bit shift instruction in one CPU cycle (similar to barrel-shift instruction on 32-bit V850E/ES family) The K0R CPU core is very efficient for digital processing of real-world analog signals Efficient addressing modes Supports both 64KB and 1MB linear address space, using extension/pre-fix instruction (no bank switching!) RAM and special function registers are efficiently addressed Most efficient use of available flash memory instruction space 13 <Click to show the core features> 13
Evaluation Board Overview 14 14
DM-78K0R-KE3L Low Power Kit EB-USB-DA USB debug adapter board EB-78K0R-KE3L Low Power Demo Board Digital Multimeter 15 These are the parts that come in the Low Power kit that you will get to run the lab. We ll talk about each in detail. 15
EB-78K0R-78 Low Power Demo Board Key Features Supports 78K0R/KE3-L and 78K0R/KG3-L devices Standard debug/programming interface Support MINICUBE2 and USB Debug Adapter Board Test terminals for current consumption measurement Measures CPU core current, CPU core + peripheral current, and peripheral current On-board coin cell battery socket for stand-alone operation (on back) On-board clock supply 20MHz and 32.768kHz crystal Simple user interface 2 switches, 2 LEDs and 1 trimmer port Expansion IOs for all device pins 16 <Click to show animation where each section is highlighted with the description> 16
EB-USB-DA USB Debug Adapter Board Key Features Direct USB connection to PC Renesas upd78f0730 8-bit USB MCU used Debug and flash programming interface Supports On-Chip Debug and Flash programming Supports three power supply options 5V, 3.3V and Target power supply LED indicators for Power ON, RUN and BREAK modes Selectable debug/programming and normal modes Easy to update debug firmware QBEZUTL utility software is provided Easy to program target device WriteEZ software is provided 17 The Debug Adapter board that is included with the kit provides the debugging features of the MiniCube2, but the one included with this kit is dedicated to the 78K0R. The board provides capabilities to supply 3.3 or 5V to the target. It can also allow the target to run off its own power, or it can power the target from USB without debugging. The dip-switches on the board allow the flexible configurations. For this lab, we will use it in only one setting, but be aware that, like the MiniCube2, it is pretty flexible. For flash programming to a prototype target, the WriteEZ is a simple utility to do that. 17
Low Power Kit Demo Set Up The Low Power kit comes with a small DMM You will use it to make current measurements When you do this during the lab, follow the directions carefully for the Meter and Jumper settings, in order to get the proper results. The shunt resistor in the meter will create a voltage drop so use the highest amp scale setting as practical. 18 This is the setup that is normal for the Demo kit. It is also exactly what we will do for our tests. Keep in mind that most Digital Multimeters, when used to measure current, use a shunt resistor of some value to convert this to a voltage internally. This resistance causes a voltage drop that may be large compared to your VCC. I recommend always keeping this voltage drop to a minimum by keeping the meter scale setting at the highest level and still get a couple significant digits. In your own lab, for highest accuracy, you may want to use active current meters that compensate for voltage drop. In this lab, despite using a simple meter, we will still be within a few percent, which may be good enough for comparison purposes. 18
Low Power Techniques 19 19
Power Use Profiles Active Clocks stay at steady rate Limited Active Clock or peripherals throttled back when not necessary Real Time Clock Core is halted much of the time, but awaken at regular intervals Our lab will use this profile, which allows calculable power consumption Standby Core is halted most of the time, but awaken by an external event 20 At a high level, any application can fit roughly into one of these categories. It is important to understand that not every low power application will need to use the most drastic measures. Some applications what don t need to worry about power might just leave everything on, and here the MCU may use 10 s of milliamps. For line powered system, and even automotive, this may be no problem at all. The first stage at reducing power may need only to reduce clock frequencies, or to turn off some peripherals one in a while. This basic technique may reduce average current to a few milliamps or less. Taking advantage of a timer, like a RTC, is a great way to maintain system control, but allow the CPU and peripherals to be asleep most of the time. This is what we will explore in this lab. With this, it is usually possible to get average currents down to 10 s or 100 s of microamps. Finally, when a system is allowed to be completely inactive until needed, then Standby mode, where an interrupt will wake up the chip, can allow MCU currents to be less than a microamp. It is hard to predict average current and battery life, unless one has an idea of how often it will be interrupted. But, the standby current may be low enough that the lifetime is limited more on the shelf life of the battery than by the load itself. 20
Power Use Profiles For maximum power efficiency: Avoid floating I/O pins. Keep DC loads on for minimum amount of time These include ADC, DAC, Low Voltage Detectors, Comparators, external sensors, radios, etc. Keep digital loads off until needed These include the Core, Timers, Serial peripherals, or anything else that has power in proportion to frequency Use stabilization time to do other things Example: When ADC is becoming active or doing a conversion, do calculations for last conversion 21 It may be common sense, but I have to throw this in. Floating I/O pins can account for a huge percentage of power loss. Be sure to always account for each pin of the MCU, to be sure it is tied to a clear logic level, or is set to an output. Any floating input pins that are not tied can each add several microamps to the total MCU current draw, and this adds up very quickly in battery powered systems. For analog peripherals, they often have resistor ladders or other static power drain which is independent of clock rate. For these loads, the principle is to turn them on, use them quickly, and turn them off. Because of stabilization time of analog peripherals that care must be taken on when they are enabled and disabled, as it may not be immediately ready for use. Digital peripherals, such as timers/counters, serial interfaces, or other that are cycling from a clock will use power in proportion to the clock frequency. These may be small, but could get large quickly if interacting with external loads. Here, the same principle applies, use them as needed, but they may not be a concern if the clock to each can be halted and re-enabled quckly as needed. 21
Organize power uses into discrete units Process 1: ADC setup ADC Stabilization time 20us ADC Stabilization Current 200uA Process 2: ADC Sampling ADC Sample time 15 clocks ADC Current 200uA Process average current is the process current, multiplied by the time it operates, divided by the period over which it is repeated. System average current is the sum of each individual process average currents. System peak current is found as the sum of each individual process current that run concurrently. 22 To get a handle on the whole system power consumption, which is necessary to calculate if a certain battery or power supply will be sufficient, it is necessary to add up the individual pieces in the system. For the MCU and code portion, this is often the processes that it runs in getting the job done. These processes are usually organized by what the core is doing, and what peripherals are running at the time. The processes themselves may be derived from inspection for a simple project, or it may help to look at the flowchart to see the different process that will be running if it is more complex, but the plan for a low power design should aim for minimizing both the number of processes and the time they are running. Ultimately, we care about average power consumption, because this is the primary indicator of battery life. We care about peak power consumption, because we may not get full capacity from a battery if we have large voltage drops caused by large peak currents, even for short periods of time. The end goal is to balance these for maximum life. 22
Power transition Diagram 100 10 1 Current ma 0.1 0.01 0.001 0.0001 Time 23 The power transition diagram allows you to see the big picture for the times when the MCU and nearby devices are active. It is here that you can try to get the average or area under the curve to as little as possible. You will create a chart like this during the lab. We used a logarithmic vertical scale here, because the active and inactive power levels are so different from each other, log scaling is really the only way to see it all on one chart. The horizontal scale is time, which we show without units here. Similar to the vertical scale, your time from one stage to another may vary a lot. For the diagram, it is really only necessary to get a sense of proportion. Accurate calculations would likely be done in a spreadsheet or other math tool. Today, we will stick to pencil and paper to show the principles. 23
Calculating Average Current Average Current Calculation for periodic systems: Iave = (I1*Time1 + I2*Time2 )/Period The individual times must add up to equal the time period. Example: Wake current is 1mA, for 150ms and standby mode is 3uA for the rest of the time (850ms), repeated every second. Average current = [(1000uA*0.15s) + (3uA*0.85s)]/1s = 152uA Note that we changed units! 24 We calculate the average current as a sum of all the currents in the system. Since most currents are not continuous, we have to weigh each one with the time that it is active. The basic formula shown allows us to do that. We use this math in the lab. In your real-life applications, you will likely have to deal with many such sources, and it makes sense to use tools like a spreadsheet to track the currents and active times for each of the stages. A simple change to one can easily be calculated out to give a new total, so you can compare one technique versus another. 24
Calculating Battery Life Battery Life = Capacity / Load The CR2032 coin cell has a capacity of 230mAH From the previous slide, our load was 152uA average 230mAH / 0.152mA = 1513 Hours 1513 Hours/(24Hours/Day)= 63 Days Again, be careful with the units! 25 Because we have a system that has a periodic wakeup, and which has a predictable average current, it is pretty straightforward to calculate battery life. Not only should you look at average current, it is also recommended to look at peak current, just to be sure your battery choice is sufficient to keep running during the brief periods when it is awake. This is another formula to stick into a spreadsheet for your application analysis. 25
Low Power Lab We will now run the lab, where we will study a sample case. Our sample application is a Data Logger, requires an RTC for periodic wakeup, ADC for data measurement, and SPI for simulating transmitted data to a radio. We will presume our battery voltage is 3V, we will use the 3.3V provided by the Debug Adapter. We have supplied some of the time and current measurements, but will let you measure the rest. Your goal is to setup the system to be most efficient, calculate current consumption, and determine battery life. 26 This lab shows the low power techniques we have just talked about. We simulate a life-like application, let you measure some of the numbers, and provide the rest. With this, you will be able to get a good handle on power consumption and battery life. 26
Lab Application Block Diagram Lab Application Example: Wireless Sensor Calendar/ Calendar/ Alarm Alarm time time (run (run in in HALT HALT mode) mode) Sensor Sensor Timer Array Unit 0: 8ch, 16-bit Timer Timer Array Unit 1: 4ch, 16-bit Timer (only for 80-/100-pin) Clock/Buzzer Output (256Hz 10MHz) Real-Time Counter: (Clock/Calendar Functions) Watch Dog Timer 10-bit ADC 10 16ch Program Gain Amp (only 44- to 64-pin Comparators 2ch (only 44- to 64-pin) 78K0R 16-bit core 20MHz (13DMIPS) 1.8V - 5.5V -40 to +85C Flash 16KB-128KB Internal OSC (1MHz +/-5%, 8MHz +/-1%, 20MHz +/-1%) Int. WDT OSC: (30kHz) Sub-Clock: (32.768kHz) 100 pin LQFP 80 pin LQFP 64 pin LQFP 52 pin LQFP 48 pin LQFP 44 pin LQFP RAM 1KB-8KB DMA Controller 2ch, 8/16-bit Serial Array Unit 3-5ch UART/SPI/I2C Multi-Master I2C 1ch 16x16 Multiplier 32/32 Divider On chip Debug/ Programming POC (Power On Clear) LVI Low Voltage Indicator 1.91V-4.22V Key Interrupt 2.4GHz 2.4GHz radio radio Power Power supply/ supply/ Battery Battery monitor/ monitor/ management management 27 In our lab today, we will work with a project similar to what we see here. The lab code allows you to work out the time and current necessary to do various tasks, including reading ADC data, writing SPI data like to a radio, and using CPU halt modes. You will be able to control various aspects of the project, make static power measurements, and then to make predictions on the average system power and predict battery life. 27
Start the Lab Keep your dice turned to the section of the lab you are on. (Instructions are provided in the lab handout) Please refer to the Lab Handout and let s get started! 28 28
Checking Progress We are using the die to keep track of where everyone is in the lab. Make sure to update it as you change sections. When done with the lab, your die will have the 6 pointing up as shown here. 29 29
Questions? 30 30
Low Power Innovations 31 31
Thank You 32 32
Renesas Electronics America Inc. 33