University Programs Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

University Programs Knowledge Base

Labels

Discussions

Sort by:
TFC2015 UCDavis Team Young Tortoise Final Report Thanks for sharing Lance Halsted​
View full article
A Livecast has been set up for you to enjoy The Freescale Cup EMEA Finals on 28-29 April that are hosted at the Politecnico of Torino. Connect on Freescale Cup 2015 live streaming - SeLM - Politecnico di Torino
View full article
MCU 101 - Beginners Concepts https://community.nxp.com/docs/DOC-1241 Blink LED Drive a DC Motor Turn a Servo Line Scan Camera Glossary of Terms Software Tools CodeWarrior Software Development Tools & IDE (recommend you download the Special Edition) CodeWarrior Beginners Tutorial (videos)   TWR K40X256 Hardware setup   Creating a new bareboard project   Debugging a bareboard project   Importing projects and merging code   Discussion of the header files (part 1)   Discussion of the header files (part 2) (Code) Beginners Hands-on Tutorials Introduction to Microcontroller Programming Blink LED Drive DC Motor Turn A Servo LIne Scan Camera Sample Codes LED BLINK 96MHZ Hardware DIY Tower System Mounting DIY Camera Mounting Batteries Advanced Tutorial Series Push-Buttons https://community.nxp.com/docs/DOC-1034 Miscellaneous Topics Reading a Reference Manual PCB design tips
View full article
TFC2015 UCDavis Team DKnight Final Report Thanks for sharing Lance Halsted
View full article
This tutorial covers the details of Driving a motor on the Qorivva TRK-MPC5604B: MPC5604B StarterTRAK evaluation board. Overview 1. Put together the Car Chassis: Motor Controller Board Version A. 2. Import the Sample Project 3. Build the Code 4. Download/Debug/Run 5. Learning Step: DC Motor Code Description Functions Motor_Right () & Motor_Left() Motor_Right_Current () & Motor_Left_Current() Sample Code Download Link Alternative Examples: Other Qorivva Tutorials: Useful Technical Links Overview In this exercise students will utilize the sample project to turn a DC motor on an off using the Qorivva TRK-MPC5604B board. Students will: Put together the car chassis Open the Sample Project Make changes to main.c to call the motor functions Build the Motor function code Download and run the code on a Qorivva TRK-MPC5604B board. Learn how the code works To successfully complete this exercise students will need the following board and development environment. Qorivva TRK-MPC5604B board. Freescale Cup Chassis (connector for the motor/board) Motor Drive Version A board Kit Cables and interconnects 7.2v Nicad Battery CodeWarrior for Microcontrollers V2.8 Recommend completing the the Blink LED Tutorial Motor Example code 1. Put together the Car Chassis:   There are several steps in this process: Build the Freescale Cup Car Chassis Add the Qorivva-Mpc560xb version components to the chassis The first step of this tutorial is to gain background information on background information on motors, timer modules, PWM signals and counters. To learn more about these general topics read the Drive A DC Motor overview article. You will need to connect your motor to the microcontroller via the Motor Drive board. This board is connected to the battery, and serves to power the motors. separate power source. This is an easy process using the provided Motor Controller Board. Motor Controller Board Version A. The Freescale Cup Motor Drive VA board uses the following connector type: white 3 pin connectors (for motor) (Molex 3-pin .100") white 2 pin connector (for battery) (Molex 2-pin .100") Schematics Wiring Connections for the TRK-MPC5604B 2. Import the Sample Project The next step is to import an existing project into your Workspace. in this case, the TRK-MPC5604B Sample project. Follow the instructions on the codewarrior project import page if you can't remember how to to import the project into CodeWarrior. 3. Build the Code If you have more than one project in your project view, make sure the proper project is the focus. The most reliable way to do this is to right click the project and choose Build Project as shown below. You can also go to the Project menu and choose the same command. If you encounter errors, look in the Problems view and resolve them. You can ignore any warnings. 4. Download/Debug/Run 5. Learning Step: DC Motor Code Description What will happen: This demo is setup for two motors (one left and one right). You will then independently turn on and off each motor Functions This file sets up the Pulse Width Modulation Timer Module for use by a DC Motor. It is set to utilize Edge-Aligned PWM, and this file properly configures the period, and pulse width for use by the other modules Motor_Right () & Motor_Left() void MOTOR_LEFT(void) {   TransmitData("****Left Drive Motor Test****\n\r");   SIU.PCR[16].R = 0x0200; /* Program the drive enable pin of Left Motor as output*/   SIU.PGPDO[0].R = 0x00008000; /* Enable Left the motors */   Delaywait();   SIU.PGPDO[0].R = 0x00000000; /* Disable Left the motors */ } void MOTOR_RIGHT(void) {   TransmitData("****Right Drive Motor Test****\n\r");   SIU.PCR[17].R = 0x0200; /* Program the drive enable pin of Right Motor as output*/   SIU.PGPDO[0].R = 0x00004000; /* Enable Right the motors */   Delaywait();   SIU.PGPDO[0].R = 0x00000000; /* Disable Right the motors */ } Motor_Right_Current () & Motor_Left_Current() void RIGHT_MOTOR_CURRENT(void) {   TransmitData("****Right Motor Current****\n\r");   SIU.PGPDO[0].R = 0x00004000; /* Enable Right the motors */   Delaywait();   for (i=0;i <10;i++)   {   ADC.MCR.B.NSTART=1; /* Trigger normal conversions for ADC0 */   while (ADC.MSR.B.NSTART == 1) {};   curdata = ADC.CDR[2].B.CDATA;   printserialsingned(curdata);    }   SIU.PGPDO[0].R = 0x00000000; /* Disable Right the motors */ } void LEFT_MOTOR_CURRENT(void) {   TransmitData("****Left Motor Current****\n\r");   SIU.PGPDO[0].R = 0x00008000; /* Enable Right the motors */   Delaywait();   for (i=0;i <10;i++)   {   ADC.MCR.B.NSTART=1; /* Trigger normal conversions for ADC0 */   while (ADC.MSR.B.NSTART == 1) {};   curdata = ADC.CDR[1].B.CDATA;   printserialsingned(curdata);    }   SIU.PGPDO[0].R = 0x00000000; /* Disable Right the motors */ } Sample Code Download Link Qorivva Sample Code Download Link Alternative Examples: Application Note 4251 and Software. Other Qorivva Tutorials: Qorivva: Blink a Led Tutorial Qorivva: Turning a Servo Tutorial Qorivva: Line Scan Camera Tutorial Useful Technical Links TRK-MPC5064B Freescale Webpage TRK-MPC5064B Freescale Reference Manual TRK-MPC5064B Freescale Schematic
View full article
Freescale Cup 2016 Worldwide Rules
View full article
Students from the University Applied Sciences TDU Deggendorf gave yesterday a demonstration of their Freescale Cup cars. 10 teams had worked during the semester in getting their cars running on their homemade Freescale Cup track based on Tower K60 kits. They ran them with lights on, lights off, in both directions on the track. Solid performance overall. HDU Deggendorf's teams are led by Prof. Gerald Kupris and have enrolled for the 3rd consecutive season into the Freescale Cup EMEA Challenge 2014. They are preparing another set of cars to compete in the upcoming racing season.
View full article
How to use the SysTick peripheral in the Cortex core with interrupts
View full article
Depending on which MCU Devlopment board you have chosen, you will need to figure out a way to mount this to the chassis. I have seen everything from cardboard, to aluminum, to wood. Below is a template complete with CAD drawings to mount the Qorivva TRK-MPC5604B board and the Motor Board onto the chassis. We use plexiglass for ours, but any other millable material is appropriate. The large hole in the middle is for cables from the servo. We attach the board to the car using the plastic standoffs (you will need them 55 mm long, so in our case, we used the combination of 40 + 15 mm) - see an example (SOS code 10260). To attach both the processor and interface boards the simillar 5mm plastic standoffs were used. Preview (.pdf) CAD file (.dxf)
View full article
Clock setup on the Kwikstik
View full article
INTRODUCTION Hi everyone, Making/Developing/Porting a Bootloader is a tedious task for newbies (even for professionals) and inexperienced hobbyists who wish to use them on their custom hardware for rapid prototyping. After searching a lot on different forums I came to a conclusion that I cant develop a bootloader just like that so my next option was porting ,that too wasnt easy if you are going with old bootloaders with limited support. I then found a very easy and efficient way of rapid software development platform that can be used on almost any IDE (Keil,Codewarrior,KDS,etc.) and can be used to develop softwares like USB MSD Bootloaders,Serial Bootloaders and other applications for almost all Freedom Development Boards ,Freescale Kinetis MCUs (on a Custom Development Board ) with minimal ARM Programming Knowledge, which is perfect for newbies like me who are just starting with ARM Development using freescale or other boards.See Welcome to the homepage of the µTasker operating system with integrated TCP/IP stack, USB and target device simulator Now my project was to make custom board using MK22DX256VLF5 (48 LQFP) MCU ,my board is a rather a simple one using basic filtering circuits for powering the MCU and almost all the pinouts given as hardware pins on the dev board.Somehow I was able to flash my first blink code using Keil IDE using the OpenSDA circuitry of FRDM-KL25Z (J-11 trace cut ) with CMSIS-DAP firmware (OpenSDA app ) loaded on to it using SWD Programming. With the steps mentioned below I'll show you how to port a Mass Storage Device (MSD) Bootloader using uTasker project from scratch. REQUIREMENTS Programmer(Hardware) or Emulated Programmer(OpenSDA apps): Segger Jlink, P&E Multilink ,OpenSDA Emulators (Jlink-SDA, CMSIS-DAP,USBDM ) IDE :Keil,Codewarrior, Kinetis Design Studio etc. (I prefer CW 10.6 ) Target MCU: Choose any MCU between Kinetis,Coldfire V2,STM32  (I am using Freescale Kinetis MK22DX256VLF5 ,48 LQFP ) refer - http://www.utasker.com/ PROCEDURE 1. Lets start by downloading the uTasker project/framwork (for Kinetis ) from µTasker Kinetis Developer's Page . Then extract and copy the folder to your CW workspace ,import the project to CodeWarrior IDE, It should look like this. (I am using version 14-9-2015)   2.Next Select "uTaskerSerialLoader_Flash" from the Five build configurations (refer http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF  ).uTaskerBM_Loader is described in http://www.utasker.com/docs/uTasker/uTasker_BM_Loader.pdf This is a very small loader alternative that works together with an initial application. uTaskerV1.4_BM_FLASH is the application to build so that it can be loaded to a loader (including the USB-MSD one). uTaskerV1.4 is a 'stand-alone' version of the application that doesn't work together with a loader (and doesn't need a loader).If you want to build application to load using the USB-MSD loader you need to use uTaskerV1.4_BM_FLASH. after that find the files config.h and ap_hw_kinetis.h.These files define the type of MCU you use. 3.In config.h Select your board or MCU type or the closest MCU resembling the architecture of your own MCU. My MCU  MK22DX256VLF5 was not there so with a little help from mjbcswitzerland  I chose TWR_K21D50M Board settings as TWR-K21D50M module is a development board for the Freescale Kinetis K11, K12, K21 and K22 MCUs. (Note : Be sure to remove or comment any other defined boards ) After Selecting the Board/MCU scroll down to find USB_INTERFACE and USB_MSD_LOADER and make sure that these two are defined (not commented ).This is necessary to enable USB enumeration as Mass storage device. Also comment the following if already defined : HID_LOADER KBOOT_HID_LOADER USB_MSD_HOST This is necessary as we are using our Bootloader in MSD Device Mode not in MSD Host Mode. Also we arent using HID_LOADER and KBOOT. Now open  ap_hw_kinetis.h and Find your selected MCU (in my case its TWR_K21D50M ) So, Find the String "TWR_K21D50M" (or whatever your MCU is ) and see if the follwing lines are defined. #define OSC_LOW_GAIN_MODE #define CRYSTAL_FREQUENCY    8000000  #define _EXTERNAL_CLOCK      CRYSTAL_FREQUENCY #define CLOCK_DIV            4                                      or    #if(..........)         #define CLOCK_MUL        48                                            #define SYSTEM_CLOCK_DIVIDE 2                                      #else         #define CLOCK_MUL        24 #endif     #define USB_CLOCK_GENERATED_INTERNALLY Here comes an integral part of USB MSD Bootloading/Programming.You must be wondering about CRYSTAL_FREQUENCY  8000000 and  CLOCK_DIV   4  .This is the frequency of an external crystal oscillator  (8mhz) connected between EXTAL0 and XTAL0 pins of the Target MCU.If your MCU has an internal oscillator then check whether the latter is defined. refer- https://cache.freescale.com/files/microcontrollers/doc/app_note/AN4905.pdf          http://www.utasker.com/kinetis/MCG.html There are two ways to be able to use USB: 1. Use a crystal between EXTAL0 and XTAL0 - usually 8MHz is used. (with or without load capacitor -both worked for me ) 2. Use a 48MHz oscillator on the USB-CLKIN pin. First one is easier and it worked for me.Since my MCU doesnt have an internal oscillator I have used and External 8Mhz crystal. If you want to use a 16Mhz crystal then just make the following changes : #define CRYSTAL_FREQUENCY    8000000 #define _EXTERNAL_CLOCK      CRYSTAL_FREQUENCY #define CLOCK_DIV            4                                 TO #define CRYSTAL_FREQUENCY    16000000 #define _EXTERNAL_CLOCK      CRYSTAL_FREQUENCY #define CLOCK_DIV            8 Note: The CLOCK_DIV should be such that it prescales the crystal frequency to range of 2-4MHz. Here is the clocking diagram of My MCU.The next diagram shows an oscillator crystal connected externally to my dev board. Next search for "PIN_COUNT" under your corresponding MCU/Board (mine is TWR_K21D50M).My MCU is 48 LQFP with 256kb flash and 32kb SRAM (you have to change them according to your MCU ).So I have changed the following lines                              from   #define PIN_COUNT           PIN_COUNT_121_PIN                         #define SIZE_OF_FLASH       (512 * 1024)                          #define SIZE_OF_RAM          (64 * 1024)                              to   #define PIN_COUNT           PIN_COUNT_48_PIN                      #define SIZE_OF_FLASH       (256 * 1024)                              #define SIZE_OF_RAM          (32 * 1024)  Next if you search for your MCU/Board (in this case TWR_K21D50M) ,you will find this line : #define UART2_ON_E This defines the alternative port for UART2,since many boards doesnt have PORTE ,it can be chaned to other ports. [its not important though] Note : When building the serial loader for a device with small RAM size reduce the define #define TX_BUFFER_SIZE (5512) to 512 bytes so the buffer can be allocated (the large size was used only for some debugging output on a larger device) [loader version :14.9.2015] Now search for the String "BLINK_LED" under your corresponding MCU/Board ( mine is TWR_K21D50M ) .The uTasker Bootloader has a special function ,whenever it is in MSD/LOADER mode it blinks a test LED on the board.This is not important but it can be used for debugging purposes.I have a test LED on my board at PORTB16 .You can also specify hardare pins to force bootloader mode and to stop watchdog timer if you pull SWITCH_3 and SWITCH_2 down to ground respectively.I am setting SWITCH_3 and SWITCH_2 as PORTD7 and PORTD6 respectively. Now on the toolbars go to Project > Properties > C/C++ Build > Settings > Tool Settings > Target Processor :Change it to your MCU type (mine is cortex-m4 ) .Next go to Linker >General and change the linker script file to match your MCU's flash,RAM,Type.I have set mine to K_256_32.ld (Kinetis K type processor with 256kb flash and 32 kb RAM) Apply your changes.Now you are ready to go. 4.  Build your project under SerialLoader_FLASH configuration .If there are no compilation errors then you have done it! (if there are then recheck everything with this guide ) Now Click the Flash programmer icon a and Select Flash File to Target. (if your not getting the icon switch to "DEBUG" perspective view ) Now you may choose your Programmer (or emulated programmer )[connection tab] ,select the correct Flash configuration file ,then browse for the binary file that has been generated under C:\Users\<computer user>\workspace\Kinetis_14-9-2015\Applications\uTaskerSerialBoot\KinetisCodeWarrior\uTaskerSerialBoot_FLASH\uTaskerSerialBoot.bin and Click on "Erase and Program". You may skip Step 5 and go to Step 6. 5.I am using the OpenSDA circuitry of my FRDM-KL25Z (J-11 trace cut ) as a programmer using J-link OpenSDA app. Download the app from SEGGER - The Embedded Experts for RTOS and Middleware, Debug Probes and Production Programmers - OpenSDA / OpenSDA V2 depending on your OpenSDA version (FRDM KL25Z has OpenSDAv1). Refer - Using the Freedom Board as SWD Programmer | MCU on Eclipse 5.1.First Enter bootloader mode and Flash the Jlink sda app into it.Connect the SWD wires from the board to your  Target MCU/Board ,also connect the target board        to the external oscillator.Also connect the FRDM's OpenSDA through USB. (A drive with the name JLINK Should come )                                          5.2. Go to Flash File to target and under connections tab click new. give any name and click new under Target Tab.Then select the target type (your target MCU ,mine is                      K22DX256M5).Then check Execute Reset under Initialization Tab. Click finish.    Now you'll get the option to select connection type ,then choose J-Link/J-Trace for ARM and change the Debug port interface to SWD .If you get the error :connection name is not        unique then just change the name (I have used jlink1).Click Finish.     Now I have set up my connections so I can flash the MCU with Jlink app on my OpenSDA circuitry. 6. Now to verify USB Enumeration of your Custom Board ,connect it to PC using USB and you should get a drive with the name UPLOAD_DISK.
View full article
TFC2015 UCDavis Team Chucksgon Final Report Thanks for sharing Lance Halsted​
View full article
The TRK-MPC560xB: MPC560xB StarterTRAK (Development Kit) is a Freescale evaluation board powered by the qorivva chip. The Qorivva microcontrollers family is a set of 32 bit Power Architecture chips. Which Chip do you have? The chipset mounted on the boards for the Freescale Cup can vary. Always validate your chipset to know it's full capabilities. MPC560xB Product Information Page Difference Highlights: 5604B = 512MB Code Flash; no DMA 5606B = 1MB Code Flash; Has 16-Channel DMA 5607B = 1.5Mb Code Flash; Has 16-Channel DMA TRK-MPC5604B Hardware Setup There are several main hardware configuration steps. After installing the battery, once the USB cable has been connected between the evaluation board and PC, it may be necessary to update the chip firmware which requires moving a jumper pin on the evaluation board. TRK-MPC5604B Hardware Setup Instructions Lectures: The Freescale Cup – Lecture 5: MPC5607B Overview Overview Slides from lecture Overview Slides from Lecture (PDF) other Lectures from the Freescale Cup Lecture Series Other Qorivva Tutorials: qorivva-blink-led qorivva-drive-dc-motor qorivva-turn-a-servo qorivva-line-scan-camera Board Tips Important Documents TRK-MPC5604B User's Manual TRK-MPC5604BQuick Reference Guide TRK-MPC5604B Schematics Reference manual External Links TRK-MPC5604B Webpage
View full article
                                                       Robô Explorador      O sistema de investigação feita por robôs através da análise de imagens capturadas está sendo utilizado nas pequenas e grandes empresas. Através da análise de imagens, é possível verificar se um produto está com defeito ou não. Dependendo da imagem, ou até mesmo se a peça estiver em mãos, um operador poderá analisar e qualificar como peça boa, mas através da conversão de uma figura em matriz binária, será possível encontrar um erro. Desta forma o produto final poderá ser adquirido pelo consumidor com mais qualidade e com custo reduzido.      Para sistemas de segurança, é possível analisar um espaço, fotografar o local e saber se existe perigo para o operador, ou até mesmo localizar pessoas em situações de risco de vida.
View full article
Below is one example process of creating a PCB. Create a Bill of Materials (BOM) In other words, decide which devices you want to use and what you will need to construct your circuit. If space is a constraint, picking the right device package is crucial. Create a Pin List Once you have all your devices. Create a simple Excel sheet of the various pin-outs from each of these devices. The goal here is to create a reference of which pin goes to which. This will greatly increase your accuracy in the next step… Create a Schematic You will need to download and install a schematic-and-layout-program. Using your schematic program create any needed device libraries and then create the schematic for the board. Create a Layout Once your done with the schematic, layout is just routing the traces around the PCB as efficiently as possible. Some tips for good routing. Use a ground plane (aka solid fill) - This helps with transient signals, and reduces trace congestion. Keep any noisy signals away from data signals (keep the motor driving lines away from data lines) Generate Gerbers and Drill Files Read the website of the Manufacturer that will be building your boards. Most of them do a good job of explaining what format the design needs to be in for them to do the job correctly. Some manufactures support the layout files from certain software toolsets (usually their own). Gerbers are pretty much the universal language though. Send to Board Manufacturer and order your BOM. Below are some of the most popular ones in the USA. If you have a resource in your area please add to the list below. pcbexpress.com sunstonecircuits.com Related Links Training by Freescale on Effective PCB Design General PCB design Engineering Articles from Quick-teck PCBs
View full article
The Tower System is a simple concept. Take basic hardware modules, connect them together and start designing. There are two types of hardware modules, MCU/MPU and peripheral (i.e. serial, memory, LCD, etc.), which plug into backplane "elevator" boards. The Tower System supports up to four prototyping boards. The boards are installed into one of the slots in the Tower System, the signals from each installed module are shared between modules and made easily accessible through exterior headers on the Tower System. For an overview of the Tower System and some of the available modules for use, read the fact sheet here. Notes The Tower System has a "Primary" and a "Secondary" side. Most of the Tower Modules only send signals through the primary side. Many of the signals within your chip are not brought out to the tower pins. During the Hardware design process, be careful of this fact. Most often people plug the USB directly into the module, instead of using the tower USB port. You can use the Tower System modules without the tower. Designing your own Tower Module: Due to the common PCI Express standard pinouts for the tower connector, it is easy to fabricate your own tower module. See the external links section for examples. Important Documents Tower System Data Sheet Rev. 4, 5/2000 Tower Mechanical Drawing Tower System Schematics External Links Tower System Freescale Webpage Tower Geeks Website
View full article
Option #1 Camera Mount Designed by Eli Hughes of WaveNumber LLC. You can order these parts through Shapeway.com which 3D prints on demand. You can choose from all sorts of materials depending on how much you want to spend. Option #2 To attach the camera we found useful to prepare two metal L-shaped pieces made from aluminium. With the help of black plastic distance posts (already available in the kit) and these metal stands, you may freely change the position of the camera over the surface. You may use following files to cut the required shapes (drawing was made using the QCad program): Preview (.pdf) CAD file (.dxf)
View full article
Thanks Team Jolt @ UC Berkeley for this awesome first-person perspective of the Freescale Cup car going around the track!
View full article
Pulse-width modulation (PWM), is a technique utilized in robotics for controlling motors and servos. Through the use of internal counters, the microcontroller modulates the duty cycle of a square wave to control the amount of power delivered to a device. The Duty Cycle referes to the porportion of time the square wave is 'on' as compared to the repeating signal period. The higher the duty cycle the higher the power carried in the signal. Duty cycle is expressed as a percentage of time the signal is 'on', with 100% being consistently on. Configuring the Timer The generation of a PWM signal using is based on hardware comparisons between register values and free running hardware counters. The timer module offers similar hardware comparison in the form of output compare circuitry. The contents of a register are continually compared to the master free-running timer. When a match occurs, a hardware output event can be configured to take place and an interrupt can then call a service routine. Timer I/O The Timer I/O port control registers are located in the Port Integration Module (PIM). Each port can be configured on a pin-by-pin basis and each timer input capture/output compare channel is associated with a single pin. On reset, timer modules are disabled and the appropriate I/O port defaults to a high impedance input. The initial state of a pin can be defined by configuring the appropriate general purpose I/O pin as an output in the Data Direction Register (DDRT) and writing the Port Data Register (PTx) to the appropriate state. An external pull device is required to control the level during reset.Setting the Timer Enable (TEN) bit in the Timer System Control Register (TSCR1) enables the timer module. The output compare functionality is disabled in the default module reset state. In this mode, the Data Direction bits (DDRTx) control the I/O state of the pins while the Input Compare logic monitors transitions on the pins. Setting the appropriate bit in the Timer Input Capture/Output Compare Select (TIOS) register enables a timer channel for output compare, as needed for PWM generation. In output compare mode, the Output Mode (OMn) and Output Level (OLn) bits in the Timer Control Registers (TCTL1/2) simultaneously select the compare event action and enable the connection of the output compare output logic to the relevant pin. If the OMn:OLn control bits for a channel are both zero the DDRTx and PTx bits control the state of the I/O pin. Setting either (or both) of the OMn:OLn bits connects the output compare circuitry to the pin, over-riding the DDRTx and PTx settings. Following a reset, the output state for each output compare circuit is zero. For PWM generation, the OM bit is set (= 1) so that the output compare output follows the state of the associated OL bit on each compare event. The state of the OL bit is inverted every time the timer channel interrupt is serviced to produce a toggling output. Clearing or setting the TEN bit disables or enables the timer module respectively, but does not modify the contents of any other timer control registers or the state of the output compare output logic A number of considerations have to be made when configuring the timer module for PWM. From a high-level point of view, the main considerations are: • PWM Frequency • PWM Duty Cycle In order to generate the required PWM frequency, the bus clock frequency must be known, and the timer prescaler must be set. These values will depend on the range of PWM frequencies that will be generated and the degree of resolution of the PWM signal. Maximum resolution and PWM frequency are limited by the maximum timer clock frequency. Lower PWM frequencies are limited by the minimum timer clock frequency. This can sometimes result in a trade-off and can be evaluated as shown in Figure 1. Once the timer channel is configured, the PWM signal can be generated using the timer channel interrupt. This should be configured to call an interrupt service routine (ISR) to load the timer compare register with the appropriate compare value (mark or space). This is achieved by identifying whether the last action was a negative or a positive edge transition, switching the transition status and loading the compare register with the next appropriate value. References to the master timer count register can be avoided by simply adding consecutive mark and space values to the timer compare register on successive ISR function calls as shown in Figure 3. Timer roll-over is seamless when using unsigned integer addition. Using the previous compare value as a reference for generating the next compare value allows precise output timing even though the ISR latency may vary. Starting the PWM is a task that requires careful consideration. In order to start the PWM generation using the interrupt, it is necessary to configure the first compare event manually. It is necessary to configure a forced compare by setting a compare to switch the output pin to the first transition state. After the initial compare event, interrupts will handle the PWM generation. The HCS12 does not support hardware forced compare, but a forced compare can be configured by setting a normal compare a few cycles ahead of the current free-running timer value. The cycles are necessary to compensate for internal latency within the MCU. The number of cycles will vary depending on the core and module clocks. When stopping the PWM generation, it is important to consider runt pulses (pulses with width shorter than the prescribed mark or space ratio as appropriate). To avoid these pulses, disable the PWM generation by setting the appropriate local interrupt mask within the associated interrupt service routine. The appropriate state of the pin at stop time can be set by disabling the interrupt in either part of the ISR; either the rising or falling edge portion. Additional Tutorial Resource: Introduction to DC Motor Control - Part II Lecture 2: Pulse Width Modulation
View full article
Which Platform to use?  Qorivva or Kinetis? Both are 32-bit devices. The Qorivva products, a Power architecture, are used widely in the automotive industry.  It has specialized peripherals such as CAN and LIN.  Automotive products are built tough, to high industry standards. The Kinetis products, ARM M4 architecture, are widely used.  You will find it in lots of everyday devices and industrial automation (such as robotics). It can support a lot of consumer peripherals such as USB, WiFi, and Graphical Displays. Which platform is more powerful or easy to use? Both supported processors are powerful 32 bit microcontrollers with similar software peripherals. Take an hour or two to research the evaluation boards on the Freescale sites and their underlying technologies. Think through the design and implementation process of connecting various components like the motor, battery and servo, to the evaluation board. The Tower System provides a modular prototyping platform, and the TRK evaluation board has many features. What level of support does a technology have? For the Cup Challenge, you may use any Freescale microcontroller. There are reference designs here on the wiki and TONS of code and examples on the Freescale site. Students should speak with their professor, and check out their respective documentation and software examples to make a choice. Having on campus support is invaluable in this case. There are online communities for the respective technologies as well. Research which technologies are have more active user communities which best complement the teams design approach? Obviously the Freescale Cup Wiki itself is a resource, and provides details on how to use two different microcontrollers - so it might be best to limit choices to one of these two supported platforms.
View full article