Engr 355 Embedded Systems Design mbed and LPC11U24 Overview Dr. Curtis Nelson* *Original lecture written by Tim Kyle ARM Produces 32-bit processor core designs Licenses cores to fabrication companies (Freescale, Motorola, TI, NXP, etc.) Fabrication companies bundle additional features (ADC, DAC, DSP, Radios, etc.) 1
ARM Cortex-M M Microcontroller ARM Cortex-R R Real Time Data Processing 2
ARM Cortex-A A - Application ARM Cortex M0 The core in the mbed Physically smallest Lowest power Lowest cost Single clock cycle for most instructions 56 Instructions (RISC) 3
NXP 11u24 The processor in the mbed Contains a Cortex M0 Core 48 MHz Clock 8 KB RAM, 32 KB Flash USB Host or USB Device, 2xSPI, I2C, UART 6xADC, GPIO 3.3V Logic $4 for a standalone processor GPIO Rated for 4mA mbed Several versions of mbeds Class model contains the NXP 11u24 + Magic Chip NXP 11u24 model has a yellow PCB Magic chip Additional flash storage for programming Serial over USB for easy debugging CMSIS-DAP for in-circuit debugging 4 amber LEDs connected to GPIO Reset button Other versions of mbed have different functionalities 4
mbed - Power 5V power from USB Onboard 3.3V voltage regulator 3.3V on Vout Pin, 5V on VB Use an external power supply for > 500mA Drawing too much current causes a USB reset and the power light to extinguish or flash mbed Communications Later in the quarter we will learn about these in more detail Communication between IC s 2x SCI/SSI 1x I2C/TWI USB Host (ie. Computer) Device (ie. Keyboard) UART Natively TTL Simple driver ICs can produce RS232, RS485, Bluetooth 5
Bricking Your mbed Drawing too much current (> 500mA) Overdriving pins 9V max Vin Bending/breaking IC ins Driving coils (inductors) without a protection diode Relays, speakers, electromagnets mbed - Libraries Great resource to prevent brain damage Not always super space or speed efficient Bigger designs will require customization Cookbook libraries vary wildly in quality Problems may not arise until code gets complicated 6
mbed - Programming mbed.org online compiler Drop compiled file on USB drive and click reset button to run Offline using Keil No libraries One button program Additional debugging features Programming in C++ or assembly (if you are brave) mbed Common Programming Mistakes Non-descriptive variable names - Makes troubleshooting more difficult. int jim = 5; float bob = 0.75; int pwmfrequency = 5; float dutycycle = 0.75; 7
mbed Common Programming Mistakes Defining variables inside a loop - the compiler won t throw an error, but it won t behave as expected either. do until (x=10) { int y = x+10; x++; } int y=0; do until (x=10) { y = x+10; x++; } mbed Common Programming Mistakes Using type Float when it isn t needed Loss of precision Processor intensive Worse on 8/16 bit processors Wrap around Don t let the simplicity of C++ fool you. Think about the assembly happening behind the scenes. 8
mbed Common Programming Mistakes Not all commands take the same number of clock cycles Writing to serial, I2C & LCD destinations uses a huge number of clock cycles The command wait(1); utilizes 48 million clock cycles Driving an I/O pin and many other simple tasks take only one or two clock cycles mbed Common Programming Mistakes Timer pins are not identical A good reference for this can be found here: http://mbed.org/handbook/pwmout#lpc11u24 9
Engr355 Achieving Success Test Equipment Debugging Collaboration of ideas mbed web resources Datasheet Think at the assembly level Divide and conquer Comments/documentation 10