750 likes | 1.12k Views
Processor Expert™ Tips and Tricks. Ruth Rhoades Sr. Product Manager. Agenda. Processor Expert Overview What is Processor Expert? CodeWarrior / Processor Expert Support Processor Expert Terminology/Windows LAB1—Blinking LED (Timer and I/O) LAB2— Keyboard Interrupt (KBI)
E N D
Processor Expert™ Tips and Tricks Ruth Rhoades Sr. Product Manager
Agenda • Processor Expert Overview • What is Processor Expert? • CodeWarrior / Processor Expert Support • Processor Expert Terminology/Windows • LAB1—Blinking LED (Timer and I/O) • LAB2— Keyboard Interrupt (KBI) • LAB3— Analog (ADC) and Pulse Width Modulation (PWM) • Managing Code Generation • Using External Libraries • Embedded Bean Store
What is Processor Expert? A rapid application design tool with … • Graphical User Interface which allows an application to be specified by the functionality needed • Automatic code generator which creates tested, optimized C code tuned to the application needs and selected Freescale MCU • Built-in knowledgebase, which immediately flags resource conflicts and incorrect settings Creating… • Hardware Abstraction Layer (HAL) – hardware-dependent, low-level drivers with a known application programming interface (API) Benefits • Eases migration between Freescale devices • Designers don’t have to be intimately familiar with every page of a specification • Errors are caught early in design cycle; therefore, designers get to market faster with higher quality product
Unique in the Market • Processor Expert delivers functionality that is unique in the market. * Software support for ARM competitors
Processor Expert Tools Several approaches • Low level • Use ASM/C (Assembler Support Routines) • Code is specialized • Classical approach • Use primarily C • Reuse of existing code • Use SDK (Software Development Kit) and libraries • Components • Abstraction • Formal description of the algorithm • Modeling (State charts) Device Initialization Processor Expert State Builder
CodeWarrior / Processor Expert Support Processor Expert is integrated into the following CodeWarrior tool suites with support for the indicated Freescale silicon families. • CodeWarrior Development Studio for Microcontrollers • RS08:KA, SA • HC08:AB, AP, AS, AZ, BD, EY, GP, GR, GT, GZ, JB, JG, JK, JL, KX, LB, LD, LJ, LK, LT, LV, MR, QB, QC, QL, QT, QY, RF, SR • HCS08:MC1321x, AC, AW, DE, DN, DV, DZ, EL, EN, GB, GT, JM, JR, JS, LA, LC, LL, QA, QB, QD, QE, QG, RC, RD, RE, RG, SG, SH, SL • ColdFire V1:AC, JM, QE • CodeWarrior Development Studio for HCS12(X) • HCS12: A, B, C, D, DB, DG, DJ, DP, DT, E, GC, H, KG, KT, NE, Q, P, UF • HCS12X: A, D, DG, DP, DQ, DT, EA, EG, EP, EQ, ES, ET, F, HZ, S
CodeWarrior / Processor Expert Support Processor Expert is integrated into the following CodeWarrior tool suites with support for the indicated Freescale silicon families. • CodeWarrior Development Studio for 56800e Digital Signal Controllers • 56800: 5680x, 5682x, 5685x • 56800e:56801x, 56802x, 56803x, 5681xx, 5683xx • CodeWarrior Development Studio for ColdFire Architectures • V2: MCF520x, MCF521x, MCF5221x, MCF5222x, MCF5223x, MCF5225x • V3: MCF532x, MCF5301x, • V4: MCF545x
Processor Expert Terminology What is an Embedded Bean? • Embedded Beans encapsulate the initialization and functionality of an embedded system’s basic elements, such as CPU core, CPU on-chip peripherals, FPGAs, stand-alone peripherals, virtual devices and pure software algorithms. • Embedded Beans provide a hardware abstraction layer (HAL), which eases migration between devices. What is a template? • Templates are Embedded Beans, which have already been either partially or completely configured • Templates can be used to share pre-defined settings with a team of designers
Processor Expert™ Windows Processor Expert is integrated into the HC(S)08/RS08, HCS12(X) and DSC CodeWarrior tool suites. It adds the following windows to those tool suites: • Processor Expert Panel in Project Manager • Target CPU • Bean Selector • Bean Inspector
Processor Expert™ Windows • Target CPU Window: • Displays selected target microcontroller with its peripherals and pins • Displays current resource usage by selected beans (i.e. peripherals, pins) • Data directions of single pins are indicated by blue arrows when configured by a bean • Pins associated with a peripheral are highlighted when mouse hovers over a peripheral • Help is available for pins and peripherals by moving the mouse over the item • Several display modes are supported. To change mode - push a button in the left side menu.
Processor Expert™ Windows • Bean Selector Window: • Shows supported Embedded Beans including CPU beans and bean templates. • Allows an Embedded Bean or template to be added to the project. • Embedded Beans can be listed by categories, alphabetically or on-chip peripherals. • Right-click on a bean to add it to the project or to get help. • An assistant is also available to guide bean selection
Processor Expert™ Windows • Bean Inspector Window – Properties Tab: • Double-clicking on an Embedded Bean opens the Bean Inspector window • A red exclamation point means one of the bean’s properties is either blank or in conflict with another. • Help is available for the fields by moving the mouse over them. • The Basic, Advanced and Expert buttons at the bottom of the window control the level of detail visible.
Processor Expert™ Windows • Bean Inspector Window – Methods Tab: • Shows functions available for the Embedded Bean • Allows designer to select functions to be included in his application • Code is only generated for • selectedfunctions • The code will appear in the .c file • for this Embedded Bean in the “Generated Code” folder • Holding the mouse over a • “method” causes a description • of the function’s parameters and return values to be displayed
Processor Expert™ Windows • Bean Inspector Window – Events Tab: • Shows the events for the current Embedded Bean • Allows events to be renamed • Events are usually called by interrupts • Events are defined in Events.c in the “User Modules” folder
Lab 1 Blinking LED (Timer and I/O)
LAB 1 – Blinking LED • This demonstration shows how to create a project with Processor Expert. It shows how to… • Add and configure Embedded Beans to support selected peripherals • Generate the code • Test the functionality on a simple application • The demonstration uses a DEMOQE128 board. • The application uses a timer to blink a LED every 250 ms. • Set Timer (TPM10) to generate an interrupt every 250ms • Configure output on LED1 (PTC0)
Processor Expert Project Design Workflow Select Embedded Beans from library and add them to project Configure it Create a new project Build and debug Write application code … and verify settings Generate source code
LAB 1 - Blinking LED • Click “Create New Project”
LAB 1 - Blinking LED • Select “MC9S08QE128” • Select “P&E Multilink/Cyclone Pro • Click “Next” • Type “Lab1.mcp” in the Project name box • Set the Sub-Directory in the Location box • Click “Next”
LAB 1 - Blinking LED • Select “Processor Expert” • Click “Next” • Leave everything as default • Click “Next”
LAB 1 - Blinking LED • Leave as default • Click “Finish” • Wait for CW to bring up the Project Windows • Check all the boxes as shown • Click “OK”
LAB 1 - Blinking LED • You should have a screen that looks like this at this time
LAB 1 - Blinking LED • Select the “TimerInt” bean in the Bean Selector Window • Select “TPM10” for the Period interrupt source
LAB 1 - Blinking LED • Select the pre-calculated value of 250ms • Click “OK” • In the Bean Inspector window, you should see Interrupt period has been updated with 250ms
LAB 1 - Blinking LED • Select “BitIO” bean in the Bean Selector window • Configure as shown: PTC0_TPM3CH0 No Pull-up Drive Strength = High Direction = Output • Select “Methods” tab • Select “Generate code” for the “NegVal” function
LAB 1 - Blinking LED • Click “Generate Code” from the Processor Expert tab
LAB 1 - Blinking LED • Select “Files” tab • Open the “Event.c” file • Scroll down to function TI1_OnInterrupt
LAB 1 - Blinking LED • Select “Processor Expert ” tab • Expand the “Bit1:BitIO” bean • Drag and Drop the “NegVal” function over to here
LAB 1 - Blinking LED • Click the “Debug” button This will launch the Debugger • Click “Connect” to connect to the P&E Multilink BDM
LAB 1 - Blinking LED • Click “Yes” to load image • Click green “Run” button • Is your Demo Board light blinking?
LAB 2 Keyboard Interrupt (KBI)
LAB 2 – KBI • This demonstration shows how to create a project with Processor Expert. It shows how to… • Add and configure Embedded Beans to support selected peripherals • Generate the code • Test the functionality on a simple application • The demonstration uses a DEMOQE128 board. • The application uses a switch to toggle the LED. • Configure keyboard interrupt on PTA2 • Configure output on LED2 (PTC2)
LAB 2 – KBI • Select “KBI” bean in the Bean Selector window • Enable Pin 2 (PTA2) • Enable Pull-up • Interrupt Polarity set for Low level/Falling Edge • Enable KBI request
LAB 2 – KBI • Select “BitIO” bean in the Bean Selector window • Configure as shown: PTC2_TPM3CH2 No Pull-up Drive Strength = High Direction = Output • Select “Methods” tab • Select “Generate code” for the “NegVal” method
LAB 2 – KBI • Select CPU bean in the Project window • Select the Methods Tab • Select generate code for Delay100US
LAB 2 – KBI • Click “Generate Code” in the Processor Expert menu
LAB 3 – ADC & PWM • Select “Files” tab • Open “Event.c” • Scroll to “KBI_OnInterrupt”
LAB 2 – KBI • Select Processor Expert Tab • Expand CPU bean • Drag and drop Delay100US • Enter 30 as the delay parameter Cpu_Delay100uS(30); • Expand the BitIO bean • Drag and drop NegVal
LAB 2- KBI • Click the “Debug” button. This will launch the Debugger • Click “Connect” to connect to the P&E Multilink BDM
LAB 2 – KBI • Click “Yes” to load image • Click green “Run” button • Press the SW (PTA2) to see LED (PTC2) toggle
LAB 3 Analog (ADC) and Pulse Width Modulation (PWM)
LAB 3 – ADC & PWM • This demonstration shows how to create a project with Processor Expert. It shows how to… • Add and configure Embedded Beans to support selected peripherals • Generate the code • Test the functionality on a simple application • The demonstration uses a DEMOQE128 board. • The application uses apotentiometer to dim/brighten an LED. • Configure ADC input to Port A0 (Blue POT). • Configure the PWM to LED (Port C1). • Use the ACD value to configure the duty cycle of the PWM.
LAB 3 – ADC & PWM • Select “ADC” Bean from Bean Selector Window.
LAB 3 – ADC & PWM • Select Port A0 • Use 5.7uSec for Conversion time.
LAB 3 – ADC & PWM • Select the “Method” Tab • Toggle to “Generated Code” to “Start” (Continuous Mode)
LAB 3 – ADC & PWM • Select Port C1 • Use “1ms” for Period. • Use “1uSec” for Starting Pulse width
LAB 3 – ADC & PWM • Click “Generate Code” in the Processor Expert menu
LAB 3 – ADC & PWM • Select “Files” tab • Open “Event.c” • Scroll to “AD1_OnEnd”
LAB 3 – ADC & PWM • Select “Processor Expert” tab • Add code to “AD1_OnEnd” • Drag n Drop AD1_GetValue16(&x)