University Programs Knowledge Base

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

University Programs Knowledge Base

Labels

Discussions

Sort by:
1. Overview 2. Hardware 3. Set up the Hardware: Line Scan Camera/Microcontroller Hardware Setup 4. Build the Code 5. Download/Debug/Run 6.Example Code Functions ImageCapture(); ReadADCChannel() Initialize the ADC Header File Definitions Initialize the GPIO Other Tutorials: This tutorial covers the details of obtaining data from the line scan camera on the Kinetis K40 using the TWR-K40X256-KIT evaluation board. General details of the line scan camera not related to the Kinetis can be found in the general Line Scan Camera Theory article. This tutorial will help students familiarize themselves with how to interface the camera with the microcontroller, how to configure GPIO pins to create clock signals and also how to utilize the microcontroller's ADC to read the data from the camera. Outside of control algorithms, configuring the camera is one of the more complex tasks necessary to create a Freescale Cup Vehicle. 1.  Overview In this exercise students will access the line scan camera, create a clock signal and create the initialization pulse which tells the camera to begin the exposure period. This tutorial will not describe line recognition or line following algorithms - these concepts are beyond its scope. Students will: Create the code using Codewarrior Build a project Download the code to the board connect the microcontroller to the camera. Run the program view the camera data, clock and Si pulse on an oscilloscope view the data from the camera in the CodeWarrior Debugger for verification purposes   To successfully complete this exercise, the following software and hardware are required: The K40 Tower card, TWR-K40x256 CodeWarrior for Microcontrollers Freescale Line Scan Camera Motor Board Tower Prototyping board Soldering Iron Solder Tower Elevators USB Cord 2. Hardware   Read the Line Scan Camera Overview article for general information on the camera, ADC, and GPIO microcontroller configuration settings. 3. Set up the Hardware: Line Scan Camera/Microcontroller Hardware Setup It is crucial for an engineer to have the proper test equipment and tools for the job. In this case, without an oscilloscope, students will not be able to verify whether the proper signals are being sent to the camera. 4. Build the Code If there is 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 errors are encountered, look in the Problems view and resolve them. For now ignore any warnings. 5. Download/Debug/Run Download the code to your board, once this process is complete resume the project so that the code runs. If you want more information on how to complete this step see the download debug run section of the Kinetis Blinking Led tutorial. 6.Example Code What will happen: the function ImageCapture() is called in main.c with a pointer to the first element in the array. This function completes the processes necessary to capture images using the camera. To become more familiar with Pointers and Arrays - navigate to the C Programming Tutorial. Knowledge of Pointers and Arrays is a pre-requisite for understanding the Camera Code. Functions The camera code utilizes the following function: within main.c ImageCapture(&Line.RawCameraData[0]); is called to initiate the step of capturing an image into the first position of the array. ImageCapture(); from Camerainterface.c This function captures the images by creating the SI Pulse, and clock signals, capturing the data into an Array using the ADC features of the K40. It calls the function ReadADCChannel() at the proper time which then inputs data from the camera AO line. void ImageCapture(int * ImageData){//this is a pointer to a single character in memory   unsigned char i;   TAOS_SI_HIGH;   TAOS_EXPOSURE_DELAY;   TAOS_CLK_HIGH;   TAOS_EXPOSURE_DELAY;   TAOS_SI_LOW;   TAOS_EXPOSURE_DELAY;   ImageData[0] = (int)ReadADCChannel(19);// inputs data from camera (first pixel)   TAOS_CLK_LOW;   for(i=1;i<128;i++)   {   TAOS_EXPOSURE_DELAY;   TAOS_EXPOSURE_DELAY;   TAOS_CLK_HIGH;   TAOS_EXPOSURE_DELAY;   TAOS_EXPOSURE_DELAY;   ImageData[i] = (int)ReadADCChannel(19); // inputs data from camera (one pixel each time through loop)   TAOS_CLK_LOW;   }   TAOS_EXPOSURE_DELAY;   TAOS_EXPOSURE_DELAY;   TAOS_CLK_HIGH;   TAOS_EXPOSURE_DELAY;   TAOS_EXPOSURE_DELAY;   TAOS_CLK_LOW;  } ReadADCChannel() from readADC.c this function does the analog to digital conversion and returns a value between 0 and 255. It takes the proper ADC channel, in this case 19. Channel 19 corresponds to analog input pin ADC1_DM0 (see page 117 in the K40 Sub-Family Reference Manual). unsigned char ReadADCChannel(unsigned char Channel)   {   ADC1_SC1A = Channel;   while((ADC1_SC1A & ADC_SC1_COCO_MASK) == 0)   {   }   return ADC1_RA;    } Initialize the ADC Before utilizing the ADC it must be calibrated and initialized. The details for how to do this can be found in Chapter 19 Using Peripheral Delay Block (PDB) to Schedule Analog to Digital Converter (ADC) Conversions of the Kinetis Peripheral Module Quick Reference manual. The PDB portions of the code have been removed for the Cup Car Demo Code. Header File Definitions from k40_TOWER_BOARD_SUPPORT.h The following code enables the GPIO on the two pins: #define TAOS_CLK_LOC (1<<28) #define TAOS_SI_LOC (1<<18) Initialize the GPIO From K40_TOWER_BOARD_SUPPORT.c The InitK40GPIO Function sets up the ports for use: Relevant code SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK; //CLK and SI signal PORTC_PCR18 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK; PORTE_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK; //Make Sure the GPIO is setup to be an output GPIOC_PDDR |= LED_E1_LOC | LED_E2_LOC | LED_E3_LOC | TAOS_SI_LOC; GPIOE_PDDR |= TAOS_CLK_LOC; GPIOB_PDDR |= LED_E4_LOC; Other Tutorials: K40:Blinking LED Tutorial K40:Drive DC Motor Tutorial K40:Turning a Servo Tutorial   
View full article
25 student teams from 21 universities coming from 11 countries will meet on 29-30 April for the Freescale Cup EMEA Challenge. Check out the event information at https://www.facebook.com/events/1425416907713292/
View full article
Overview The FRDM-TFC is a convenient "shield" that can drive up to two DC motors (5A per channel), two servos and I/O for the Freescale cup line scan camera and Hall effect sensors.  This board mates with the KL25Z Freedom board for primary usage with a Freescale Cup car. Features: 2 channel Motor Driver ICs (MC33887APVW) 2 channel servo Outputs Dual Linescan Camera interfaces Two inputs for speed sensors Two potentiometers for user functions Two push buttons for user functions 4 Position DIP Switch for user function 4 LEDs (green) for battery indicator or user functions Design Files Rev A is attached to this document. Rev B is attached to this document Code Examples Codewarrior "Bare Metal" Example Code: All Codewarrior based code examples for the FRDM-TFC are hosted on in a Subversion repository on Google Code: frdm-tfc -   Example code for the FRDM-TFC Shield - Google Project Hosting You can check out the code with your favorite SVN client.   Static releases are available in the attachments section of this page.  The current release is "R1.0" mbed.org Example Code: https://mbed.org/components/Freescale-Cup-with-FRDM-KL25Z/ Videos FRDM TFC EXAMPLE CODE GETTING STARTED FRDM-TFC_DEMO 0 and 1 FRDM-TFC_DEMO 2 and 3
View full article
Getting Started with the NXP CUP These pages help you with the question of how to achieve the goal of creating an autonomous vehicle that quickly navigates around a track (timed race) and solves precision tasks (Figure 8, Speed limit zone, Obstacle avoidance) What is a Microcontroller? For information on what a microcontroller is head to the microcontrollers article. Getting Started - Learn to Program a microcontroller First off, you are going to need to know C programming. For a crash-course head to c-programming-for-embedded-systems. The classic first application to learn how to program a microcontroller is to get through the process of Blinking an LED. This wiki contains a tutorial for each of the Cup microprocessors which simplifies the process of setting up the evaluation board, installing the Integrated Development Environment, and programming the board with a simple set of software which blinks a LED. The Blink a LED tutorial is the first of 4 tutorials designed to familiarize students with the process of designing a cup car. These four tutorials will introduce students to many of the fundamentals of robotics, the software used to control the locomotion and sensors on an autonomous line following vehicle, and provide example code which help simplify the process of creating a competitive entry in the NXP CUP. Here is an outline of the Basic Microcontroller Programming Tutorial: Read the microcontroller article Choose a microcontroller Set up the development environment Set up the microcontroller evaluation board Program A LED move to the next tutorial… Course Material from the NXP CUP professors and supporters: Thanks to our professors and NXP CUP supporters we created an exclusive starter kit. It includes lecture material, information on the car, useful tips on the board etc. Download the file below and dive into a huge support portfolio! ARC Ingenierie Files - The Champions Board! ARC Ingenierie has been very generous in providing us with their PCB layout and Gerber files to produce your own NXP CUP board. They also provided sample code and drivers plus instructions (in French) to get you started. How cool is that?! Many thanks to ARC, this is much appreciated! Download the files below. If you want to build your own board, please contact us. When do so please keep in mind to give credit to ARC university. All boards should have "HE-ARC Ingenierie" inscription.   Further support links: Information on Line Scan Camera Use The Book of Eli - Microcontrollers, robotics and warp drives Microcontrollers MCU 101 - C Programming for Embedded Systems NXP CUP Shield for the FRDM KL25Z
View full article
Photos Videos
View full article
This year we are launching the inaugural Global Freescale Cup challenge.  Teams from 9 regions of the world will be competing to see who the best-of-the-best is. Regional student champions will be working hard to create the most intelligent race car to win Global challenge on August 22-24, 2013, held at the Harbin Institute of Technology in China. The challenge will feature Freescale’s 32-bit microprocessors either ARM-based or Power Architecture-based. Important Information 2013 Global Rules Team Registration (closed) Click "Receive email updates" from right navigation to stay informed of changes. Add your own questions below in the comments section. View this page as a PDF - To print Meet the Teams Brazil - Escola Politecnica da Universidade de Sao Paulo China - (Semi-finalist*) University of Science and Technology China - (Semi-finalist*) South-Center University for Nationalities Slovakia - Slovak University of Technology India - Bannari Amman Institute of Technology Japan - The University of Tokyo Malaysia - Swinburne University of Technology Mexico - Instituto Politecnico Nacional Taiwan - National Taiwan University of Science and Technology United States - University of California Berkeley - Team Jolt *Semifinalist teams to compete prior to the global challenge to determine which team will represent the region. Event Agenda (Subject to Change.  All listed times are local time) August 21st Team Arrivals. Transportation arranged for all teams from Airport to Hotel. Look for The Freescale Cup sign. Arrival times provided. August 22nd 07:30 - 12:00 Team Tour - Sun Island 12:00 -13:00 Team Lunch Practice Track A Track B 12:55 - 13:15 University of Science and Technology Beijing South Center University for Nationalities 13:15 - 13:45 Mandatory Team Meeting & Rule Review 13:45 - 14:05 The University of Tokyo National Taiwan University of Science and Technology 14:10 - 14:30 UC Berkeley Swinburne University of Technology 14:35 - 14:55 Bannari Anman Institute of Technology Escola Politecnica da Universidade de Sao Paulo 15:00-15:20 South Center University for Nationalities University of Science and Technology Beijing 15:25 - 15:45 Instituto Politecnico Nacional Slovak University of Technology 15:55 - 16:10 National Taiwan University of Science and Technology The University of Tokyo 16:15 - 16:35 Swinburne University of Technology UC Berkeley 16:40 - 17:00 Escola Politecnica da Universidade de Sao Paulo Bannari Anman Institute of Technology 17:05 - 17:25 Slovak University of Technology Instituto Politecnico Nacional 18:00 - 19:00 Team Dinner August 23rd 8:00 - 8:30 Opening Ceremony 8:30 - 9:00 Final Race China Semi-finalists 9:10 - 9:30 Practice Track C - Slovak University of Technology 9:35 - 9:55 Practice Track C - The University of Tokyo 10:00 - 10:20 Practice Track C - UC Berkeley 10:00 - 10:45 Practice Track C - Bannari Anman Institute of Technology 10:50 - 11:10 Practice Track C - Instituto Politecnico Nacional 12:00 - 13:00 Team Lunch 13:20 - 13:40 Practice Track C - National Taiwan University of Science and Technology 13:45 - 14:05 Practice Track C - Swinburne University of Technology 14:10 - 14:30 Practice Track C - Escola Politecnica da Universidade de Sao Paulo 14:35 - 14:55 Practice Track C - Winner of China Semi-finals 4:00p - 4:30p Track Change 4:30p - 5:30p Final Race 5:30p - 6:00p Awards Ceremony 6:00p - 7:00p Team Dinner August 24th Teams to observe the finals of the China regional. 8:00  - 11:00 China Regional - Final Speed Race 11:00 - 12:00 China Regional - Final Innovation Competition 12:00 - 12:30 China Regional - Awards Ceremony 12:30 - 17:00 Free Time 17:00 - 18:00 Team Dinner Event Hotel Harbin Sinoway Hotel Address: No.2 Yiyuan Street. Harbin China. Contact: Xiaodan Liu Mobile Phone: 15904611007 Current Weather Conditions Link will re-direct to weather.com Race Location Harbin Institute of Technology August 22-24, 2013 Contributing Sponsors    
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. Camera Mount 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
WARNING If you stumble across the "getting started page" FREEDOM BOARD / CORTEX M0+ GETTING STARTED Please take note: While working with a large number of Freedom boards in a course,  it was observed that the Init Clock Routines would *sometimes* not work.    *Some* of the crystals on the freedom boards do NOT like "HIGH_GAIN" mode.   change the line   pll_init(8000000, HIGH_GAIN, CRYSTAL, 4, 24, MCGOUT); to   pll_init(8000000, LOW_POWER, CRYSTAL, 4, 24, MCGOUT);
View full article
Assembly Of The Freescale Cup Car Chassis Before you start building your program for your car, It would be better if you can assemble your car chassis first. With your car correctly assembled, you can easily test it with your different programs in the later tutorials. The followings are all the tutorials about car chassis assembly. A step-by-step car chassis assembly manual & hints (pub)  (PDF) Servo and steering assembly directions DIY Board mounting template for the TRK-MPC5604B DIY Board mounting template for the Tower System Board mounting suggestions for the FRDM-KL25Z with shield DIY Camera Mounts Wiring connections for the TRK-MPC5604B Hints and notes to chassis assembly Freescale Cup Innovation Challenge EMEA Model B car assembly file in attachment below Exploded Assembly Diagrams Chassis Build Directions [PPT] Original Manufacturer Directions [PDF]
View full article
Here is a simple example developed at Politecnico di Torino, to show how the NXP CUP car can be managed using Simulink-generated code. The Simulink model is intended to move the car forward and backward for 20 seconds, or until an obstacle is found. Any comment is welcome.
View full article
This is the 8th year for the China national finals of Freescale Cup intelligent car racing.  In parallel to this years China regional we are hosting the champion teams from regions around the world in a winner take all racing showdown. Today kicked off day one of the event which is mostly practice.   But first, a little international team building and a tour to Sun Island in Harbin, China. (Photo courtesy of Peter Fang) (Photo courtesy of DamarisOchoa) Followed by some down to business practice where we had our first glimpse of all the teams.   All the worldwide teams look very strong and should be a very competitive match-up. (Photo courtesy of DamarisOchoa) If you are at the Global Freescale Cup 2013  add your pictures in the comments section below!!
View full article
This tutorial covers the details of Blinking an LED on the Kinetis K40 using the TWR-K40X256-KIT evaluation board. It will introduce the evaluation board, and some basic CodeWarrior features. Overview 1. Hardware 2. Set up the Software Development Environment A. Download and Install Codewarrior B. Download and Install Drivers 3. Set up the Hardware: Twr K40x256 Hardware Setup 4. Import the LED Project 5. Build the Code 6. Download/Debug/Run 7. Learning Step: LED Code Description Read/Write Functions Variables Header File Definitions Initialize the GPIO Blink the LED: Other K40 Tutorials: K40 Related Pages Credits / References Overview   In this exercise students will explore a Freescale Cup Car application which targets a Freescale K40 board attached to the Tower System.   Students will: Configure the Software Development Environment Configure the evaluation board hardware Learn how to import example files into a CodeWarrior project Build a project Download and run the code on a Kinetis K40 Tower System board Learn how to utilize the GPIO Peripheral to blink a LED     To successfully complete this exercise, students will need the following board and development environment. The K40 Tower card, TWR-K40x256 CodeWarrior for Microcontrollers USB Cord 1. Hardware     Read the Blink LED overview article for general information on LED circuits, GPIO pins and reference manuals.   2. Set up the Software Development Environment   There are several steps necessary to prepare the evaluation board and PC for microcontroller programming and development. Interfacing the evaluation board with a PC requires downloading and Install the CodeWarrior IDE, as well as the device drivers for programming the microcontroller via USB. A. Download and Install Codewarrior   Before completing this example project, download-and-install-codewarrior-10-1 or the latest version compatible with the twr-k40x256-kit.   B. Download and Install Drivers   In addition to CodeWarrior, it may(needs verified) be necessary to install one or both of the following tools: RAppID initialization tool- RAppID comes on the DVD provided with your evaluation board. In the main directory of the DVD, click on the "TRK_MPC5604B.html" file to open the DVD interface which provides user manuals, software, schematics and documentation for the evaluation board. P&E Microcomputer Systems, Inc drivers- P&E is a a computer driver for the TRK-MPC5604B and Kinetis Tower system device, enabling evaluation board programming via USB through the CodeWarrior debug OSJTAG interface. This driver can be downloaded here in case this isn't found on the disk.   3. Set up the Hardware: Twr K40x256 Hardware Setup   There are several Twr K40x256 hardware configuration steps. Follow the twr-k40x256-hardware-setup instructions before importing the LED Project. 4. Import the LED Project   After the software is successfully downloaded and installed, the next step is to import an existing project into your Workspace. in this case, the LED_BLINK_96MHZ Project. Follow the instructions on the codewarrior-project-import page to import the LED_BLINK_96MHZ project into CodeWarrior. If errors are encountered, look in the Problems view and resolve them. Ignore any warnings. 5. Build the Code   If there is 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. By default, the application is set to link to RAM. If you want your program in FLASH, make sure that you have that build configuration enabled:     Make sure you do a "Clean" operation (under the project menu) after you make the configuration change. If you encounter errors, look in the problems view and resolve them. You can ignore any warnings. 6. Download/Debug/Run   If the project builds correctly, it is time to download to the board and watch it work. Ensure that the USB cable that came with the board connects the board to the host computer’s USB port. There are multiple ways to issue the Debug command. Right click the project in the projects view and choose Debug As->CodeWarrior Download. Alternatively, y go to the Run menu and choose Debug (F11). Click the Resume button and your should see the LED blinking! Click the Pause button to stop execution. Click the Terminate button to end debugging. 7. Learning Step: LED Code Description Read/Write   If the LED was on Port C, Bit 7 we might have code like: #define LED_E1_Location(1<<7)   For example, to toggle a pin the following code might be used: GPIOC_PSOR=LED_E1_LOC     "Sets" the LED located at "E1" high.   the syntax means the following GPIOC refers to Port C   "Set" is one of three commonly utilized commands for GPIO control. There are also commands for "Clear" and "Toggle."   Command: "GPIOC_PSOR" literally means PORT SET OUTPUT REGISTER which SETS a pin high Command: "GPIOC_PCOR" clears a pin, PORT CLEAR OUTPUT REGISTER which CLEARS a pin to the "low" state Command: "GPIOC_PTOR" toggles a pin opposite of the current state   the « is a "shift" command which is discussed in the c-programming-for-embedded-systems. You can alter the raw register as well using a MASK but the dedicated set/clear/toggle registers are more straightforward.   **NEEDS UPDATED ** Hardware Chip Port/Pin Comment SW3 PT cell-content SW4 cell-content cell-content Functions   The following functions can access the LED; //Where n is the LED number LED_En_TOGGLE;  //will toggle a LED to a different state LED_En_ON; // turns the LED ON LED_En_OFF // turns the LED OFF Variables   Locations of the LED's LED_E1_LOC LED_E2_LOC LED_E3_LOC LED_E4_LOC Header File Definitions   from k40_TOWER_BOARD_SUPPORT.h //The E1 LED is on Port C, Bit 7 #define LED_E1_LOC (1<<7) #define LED_E2_LOC (1<<8) #define LED_E3_LOC (1<<9) #define LED_E4_LOC (1<<11)    //There are dedicated set and clear registers.    //Write a one to PSOR Sets the Bits, Writing to PCOR clears bits.    //Toggling a bit can be done with the PTOR register    //You can access the raw register as well -> PDOR |= My Bit    //but the dedicated bit set/clear/toggle registers are easier!    //Also, The cathode of the LEDs are towards the port pin! This means    //you have to turn the port off to get the LED to turn the pin on. #define LED_E1_OFF   GPIOC_PSOR=LED_E1_LOC #define LED_E1_ON   GPIOC_PCOR=LED_E1_LOC #define LED_E1_TOGGLE   GPIOC_PTOR=LED_E1_LOC #define LED_E2_OFF   GPIOC_PSOR=LED_E2_LOC #define LED_E2_ON   GPIOC_PCOR=LED_E2_LOC #define LED_E2_TOGGLE   GPIOC_PTOR=LED_E2_LOC #define LED_E3_OFF   GPIOC_PSOR=LED_E3_LOC #define LED_E3_ON   GPIOC_PCOR=LED_E3_LOC #define LED_E3_TOGGLE   GPIOC_PTOR=LED_E3_LOC #define LED_E4_OFF   GPIOB_PSOR=LED_E4_LOC #define LED_E4_ON   GPIOB_PCOR=LED_E4_LOC #define LED_E4_TOGGLE   GPIOB_PTOR=LED_E4_LOC Initialize the GPIO   From K40_TOWER_BOARD_SUPPORT.c void InitK40GPIO() {    SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;    //To use a Port, its Clock must be enabled!!    //Lets just enable the clocks for ALL of the ports    //Important! Each IO pin has a dedicated 32-bit Register to set it up (Selection GPIO vs peripheral, IRQ, Etc.)    //Setup port C7,C8,C9 and B11 as GPIO and enable High Drive Strength    PORTC_PCR7 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;  //Enable GPIO on on the pin    PORTC_PCR8 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;  //Enable GPIO on on the pin    PORTC_PCR9 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;  //Enable GPIO on on the pin    PORTB_PCR11 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;  //Enable GPIO on on the pin    PORTC_PCR18 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;    PORTE_PCR28 = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;    //Make Sure the GPIO is setup to be an output    GPIOC_PDDR |= LED_E1_LOC | LED_E2_LOC | LED_E3_LOC;    GPIOB_PDDR |= LED_E4_LOC;    LED_E1_OFF;    LED_E2_OFF;    LED_E3_OFF;    LED_E4_OFF; } Blink the LED:   Within Main.c or any other C file created, Blink the LED's using the following functions: LED_E1_TOGGLE; LED_E1_ON; LED_E2_OFF; Other K40 Tutorials:   K40 Related Pages   K40: Turning A Servo Tutorial   K40: Drive DC Motor Tutorial Kinetis K40 TWR-K40X256 K40: Blinking LED Credits / References   Some of the content from this tutorial originated from:   Shawn Moffit: Electrical Engineering, Penn State University for - K40 Code   Processor Expert Hands-On Lab Rev. 1.0, 05/2011 by Jim Trudeau, Freescale Semiconductor, Inc. for - some text descriptions of steps Original Attachment has been moved to: LED_BLINK_96MHZ.zip
View full article
CW_SIMPLE_DEBUG.wmv
View full article
For details on how to use the Motors, visit theDC Motor Tutorial Images Boards before 2013 Current Board Rev. 0 Rev. 1 Technical Details Revision 1 (Schematics, design files, sample code, instructional videos) Revision 0 (Schematics) H-Bridge Specifications Freescale MC33931 Datasheet Pro Tips: #1 - Electro-Magnetic Interfence (EMI) This has been mitigated in the rev. 1 board. In many cases the dc drive motors give off much EM interference causing poor data from the camera, and decreasing the servo motor performance substantially. In most cases around a PWM value of 20-25 duty cycle at the drive motors, caused detrimental problems. This problem was remedied in two ways, (1) connecting capacitors between the motor leads, the closer to the drive motor the better; (2) There is a way to connect the camera directly to the kwikstik and bypass the motor board. #2 - Rev. 0 Board workaround to Enable Braking This has been fixed in the rev. 1 board. In order to go forward AND backwards, you have to have control over IN1 and IN2 (see table below). If you look at the schematic, you can see that IN1 is directly connected to GND. In order to enable breaking you need to lift pin 43, solder a wire to it and control it properly. Tutorials General Tutorial on the DC Motor Control Qorivva: DC Motor Tutorial Kinetis Tower: DC Motor Tutorial Design evolution of motor board prior to 2010 - Freescale Cup Cars utilized the MC33932EVB 2010~2012 - Freescale Cup teams migrated to the current Interface/Motor board featuring Dual H-Bridges [Not manufactured] Tower and Trak Compatible Interface/Motor Control Board (Design files if you want to make one!) 2013+ - FRDM-KL25Z shield
View full article
Join the fun and watch the who will be crowned Freescale Cup Champion, LIVE from the Fraunhofer Institute for Integrated Circuits. Check the event info at https://www.facebook.com/events/1425416907713292/ LIVECAST http://p.livecoder.com/Freescale_IIS
View full article
Hardware Servos are specialized dc motors geared to produced high-torques and set at specific angles vs rotating continously. The ability to position the servo at a specific angle over and over makes them ideal for robotics, radio controlled car and other various applications. A typical servo will have range of motion from 180-270 degrees. Most modern servos have a three wire interface, red (V+), black (ground), and white (control). To control a servo you must send it a variable length commands (pulse) in 20ms increments. This type of control is called Pulse Width Modulation. Pulse Width Modulation is a square wave with a set period. By changing the width controlling the proportion of on versus off time, you can obtain a digital ratio from 0-100%. That ratio of on versus off time is called the duty cycle. A microcontroller generates a PWM signal using a timer. The time from the beginning of one sequence to the next is called the period. The main timer registers include: Counter, Modulo, Count Initialization Value, Channel Value, FTM Status & Control, and Channel Status & Control. The Counter will count up from the Count Initialization Value and reset after reaching Modulo. One tradeoff of the design is the Modulo value we set. It represents the count value of a full duty cycle and also the resolution of our servo control. Setting a higher Modulo value allows for more precise variation in the servo, i.e. more accurate steering. The downside is that a higher value requires more time per cycle. It is necessary to configure a timer module for the drive motor separate from the servo because they each require different clock frequencies. Another tradeoff of pulse width modulation is whether it is edge-aligned or center-aligned. Edge-aligned PWM, where the channel is cleared at counter overflow and set at channel match, is simpler to implement in hardware. Center-aligned PWM, where the counter counts up and down, is more difficult to implement but does not give as much noise interference when the channel matches. Servos have 3 wires coming out of them: Ground: Black, Brown Power: Red PWM Signal: White, Yellow, Orange Spec Sheet for Servo used in Freescale Cup Futaba-S-3010 Creating the PWM Signal Much of what is needed to create this signal is discussed in the Motor Control tutorial. Click here to review how to configure a PWM signal on your microcontroller. The same microcontroller configuration utilized to drive a motor can be modified slightly to rotate the arm of a servo. Since the Servo and motor require different clock frequencies, it is necessary to configure a timer module for the servo separate from the motor. Freescale Cup participants will configure the timer modules to output signals that control a steering Servo via varying the Duty Cycle of a PWM signal. Microcontroller Reference Manual: Timer Information You will find high level information about Timer usage in several different areas of a reference manual. See the reference-manual article for more general information. Relevant Chapters: Introduction: Timer modules - lists the memory map and register definitions for the GPIO System Modules: System Integration Modules (SIM) - provides system control and chip configuration registers Chip Configuration: Timers Signal Multiplexing: Port control and interrupts Methods of controlling steering angles Construct a look-up table One way of controlling the steering angles is to construct a look-up table. The input of the look-up table can be the shift distance(in pixels) from the center, and the output could be the steering angles. The look-up table can be put into an excel file. So when you want to use it, just copy and paste the table into your code file. Here is an example of how to construct a look-up table. 1. Set up basic parameters of your car: height of camera(h), angle of camera(theta), velocity of car(v), servo delay(s).. 2. Draw a graph to help you develop a function between your input parameters and your output steering angles 3. Put all paraments into excel. So if you want to change any parameters in the future it will be very convenient. 4. Copy and paste look-up table into code file Note: depending on how you define your parameters, the look-up table may not work as well as you expected. Experiments show that the look-up table works well when the shift distance is small( small turns) and the car tends to go off track when the shift distance is big(sharp turns). Poportional Control (P Control) You can map your servo angle based directly on your line location. Take the derivative of the camera signal and use the derivative peaks as the edges of the line. Take the location of each peak and subtract them from each other to get the line width. Taking the min line peak plus line width will give you the location of the line. Now take that location and map it to your servo. We made Camera.Lock = loc and using this we made Motor.ServoAngle = Camera.Lock»1; This made our line location map directly to our servo and it seemed to work well for us. Additional Theory Training Resources Freescale Motor Control Tutorial Freescale Lecture 1: Introduction and Motor Basics Freescale Lecture 2: Pulse Width Modulaiton Freescale Lecture 3: Control Design Freesacle Lecture 4: Speed and Position Freescale Lecture 5: MPC5607B Overview
View full article
All results of the NXP CUP survey can be found here.
View full article
The Fraunhofer Institute of Integrated Circuits in Erlangen (Germany) is the inventor (with Thomson) of the MP3 files most of use today in our smartphone and media players. They are over 20,000 researchers strong and a force in the R&D community in Germany and around the world. The institute will welcome and host the Freescale Cup 2014 EMEA finals on 29-30 April 2014. It is a great chance for the student teams that will be at the event to get a glimpse of engineering R&D at its best and make contact with talented Fraunhofer Institute engineers shaping the world of tomorrow. See the press release at 20130715_Freescale_2014 - Fraunhofer Institute for Integrated Circuits IIS
View full article
Instructions 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. Install the included battery into the VBAT (RTC) battery holder. Then, connect one end of the USB cable to the PC and the other end to the Power/OSJTAG mini-B connector on the TWRK40x256 module. Allow the PC to automatically configure the USB drivers if needed. Before updating the firmware, it is necessary to start a CodeWarrior Project. Open Codewarrior Navigate to File-> New ->Bareboard Project Select Kinetis K40->MK40X256VMD100 , P&E Open Source Jtag, C Language, No Rapid Application Development ,Finish Click on the main.c To get project focus Selection Project->Build Configurations->MK40X256VMD100_INTERNAL_FLASH Project-»Build All Run->Debug Configurations—> Use the Codewarrior download Filter and Select "PROJECTNAME_MK40XD256VMD100_INTERNAL_FLASH_PnE_OSJTAG" Additional step is required if the firmware is out of date: Firmware Upgrade Instructions (if needed) Firmware may change after an evaluation board has been manufactured and shipped. As a result, an alert will be displayed during the first attempt to download software to the board. Follow the instructions carefully. Unplug the USB cable. Look for the two pins labeled JM60 Boot and put a jumper on those pins Note: As it comes from the factory, the K40 board has a free jumper on the board. . Jumper J13 is labeled "JM60 BOOT." It connects two header pins which set the evaluation board in the firmware programming mode. This jumper is behind the LCD screen, and right next to LED/Touch Sensor "E3". Remove the LCD creen to gain access to the jumper. Reconnect the USB cable and click OK. Wait for the new firmware to download. A new dialog will appear when the process is complete. Unplug the cable, remove the jumper, and reconnect the cable. Then click OK. (You can store the jumper on the board, just set it so that it does not connect pins.) You may or may not encounter the firmware issue, or the multiple configurations issue. Once resolved, you should not see them again. With propertly set up hardware, users can return to Step 3: Import the LED Project of the Blink a LED on Kinetis Tutorial
View full article
Further Reading MCU 101: How does a DC Motor work? MCU 101: Pulse Width Modulation for DC Motors Specifications of Included DC Motor Conditions of Standard Operation Driving Voltage: 7.2V Direction of Rotation: CW viewing from metal housing Position of Motor: Horizontal Operating Temperature: 10 to 30 (Celsius) Operating Humidity: 30%RH to 95%RH Electrical Characteristics No Load Speed: 16000+/- 3200 rpm No Load Current 220mA (max) Mechanical Noise (Distance from housing side A=10cm Background Noise =30dB (max) 75 dB Stall Current: (two points method 1.2&3.9mNm) 3800mA (max) Stall Torque (two points method 1.2&3.9mNm) 80g.cm min End Play of Shaft 0.05~0.60 mm
View full article