University Programs Knowledge Base

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

University Programs Knowledge Base

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
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
This past Tuesday June 25th, 2013, the UNICAMP E-Racing compete against 19 teams and won the first place with a score of 985 points of a total of 1000. The car used an electric motor of 120 V and a chassis that weighted 250 kg (551.2 lbs). That allows the car with a charging time of 2 hours to be driving for 25 km (15.5 miles) and race up to speeds of 170 km/h (105.6 mph). Check out this video of the car: The official results: http://www.sae.org/images/cds/selfservice/372162833_FSAE_EV_2013%20result.pdf
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
Characteristics of This Book (1) General knowledge and relevant knowledge are well-balanced. From the standpoint of application, this book explains the general principles of the embedded system’s “general knowledge” in a concise but logically lucid way; at the same time, it also pays attention to the coherence between the general knowledge and relevant knowledge about chips. So with the understanding of general principles, the reader can better understand chip application design, which in turn contributes to the understanding of the former. (2) Both hardware and software design are a concern. An embedded system is the efficient integration of hardware and software. So its design should be a design with coordinated, rather than completely separated, hardware and software, like that of a general computer. It is especially true for intellectual embedded application in electronic systems that embedded software cannot be developed well without considering the hardware, and vice versa. (3) Component-based packages of low level drivers are provided. Every module in the book has been furnished with a driver program (in line with the basic principles of the embedded software project and the requirement of a component-based package), detailed, with standard notes and an interface. The supply of low-level driver components for practical application facilitates transplantation and reusability, which saves the reader time for developing his project. (4) Advisable test examples are supplied. Every source program listed in the book has been tested. All test cases are reserved in this book’s CD to free the reader from the trouble caused by design fault or the innate mistake of these example routines, and to facilitate the reader’s confirmation and comprehension. (5) The CD provides all low-level drivers’ component package procedure, texts and test cases. When used, it also contains a chip reference manual, installation and usage about the writing device, tool software (for example, development environment, program writing and reading software, serial ports adjusting tools, USB device, as well as Ethernet tools), related hardware schematic, other technical information, etc. (6) Hardware evaluation, writing adjusting device, and software tools that can solely conduct program writing and reading are supplied to facilitate the reader to practice and apply. Contents There are altogether 16 chapters in this book. The first chapter is an introduction to knowledge system, learning mistakes and learning suggestions on embedded systems. The second and the third chapter describes the characteristics of the ColdFire MCU family, gives the pin function of MCF52233 and the minimum system circuit as well as the first sample program and ColdFire project system to complete the introduction to the first ColdFire project. Chapters 4-10 deal separately with UART, Keyboard,LED and LCD, A/D, Timer,QSPI, I2C and online programming of Flash Memory. And from the eleventh chapter to the fifteenth chapter, information concerning CAN Bus of MCF52235, Ethernet modeling on MCF52233, other modules of MCF52233, USB 2.0 programming of MCF52233, the transplantation and application of μC/OS-Ⅱin ColdFire are provided. The last chapter gives an account of developing methods of embedded systems based on hardware component. Appendix A lists the chip packaging of the ColdFire MCU family used in this book. Complete course files restricted to verified faculty only.  Available for download in the Faculty-Portal
View full article
MathWorks is a proud global sponsor of The NXP Cup If you are a member of a NXP Cup team, you have access to a complimentary Software License for MATLAB / Simulink. Visit the NXP Cup - MathWorks Deutschland website to learn more about the Software offering.  Examples for using Simulink in the NXP Cup are packaged with the Simulink Coder Support Package for  FRDM-KL25Z available from the Hardware Support Page.  Additional examples for reading and analyzing live data from the Line Scan Camera are available in the NXP Cup Companion App available on the MATLAB File Exchange.  Additionally, there is an example which uses the Simulink Coder product from MathWorks to target the FRDM-KL25Z. Feel free to use the forum on MATLAB Answers or here below to ask your questions about MATLAB use with The NXP Cup.  You can also email roboticsarena@mathworks.com with any questions.
View full article
Freescale india and CEDT, IISc organised Smart car race india 2010 winner team from NIT,Surat. Students: Maulik Gandhi , Rikil Shah and Samir Sirohi.
View full article
The first step of starting your TFC project is to get to know your microcontroller. This article serves you as an introduction of Qorivva MPC560xB microcontroller. Qorivva MPC5604B Summary The Qorivva MPC560xB/C/D family of 32-bit microcontrollers (MCUs) includes the latest in integrated devices for automotive electronics applications. These scalable Power Architecture® devices are supported by an enablement ecosystem that includes software drivers, operating systems and configuration code to help you quickly implement your designs.  For the Freescale Cup Challenge, we have provided Tutorials, example code and projects which are based on the trk-mpc5604b StarterTRAK evaluation board. 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's At-a-Glance: 5604B = 512MB Flash; no DMA 5606B = 1MB Flash; Has 16-Channel DMA 5607B = 1.5Mb Flash; Has 16-Channel DMA Getting Started Presentation Getting Started with MPC5600B.pptx (2Mb) Important Resources: e200z0 Core Reference Manual TRK-MPC5604B User's Manual TRK-MPC5604BQuick Reference Guide TRK-MPC5604B Schematics Reference manual Freescale's Qorivva MPC560xB Page Power.Org
View full article
Continue discussion on the line scan camera. A completely interrupt driven approach to the interface will be illustrated.
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by Ram Garlapati
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by Eric Pedersen
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by Ethan Tavan
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Introduction by Prof. James L. Frankel
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by Timothy O'Keefe
View full article
Entrenamiento sobre ADC del Kinetis L Series. Encuentra el material completo en https://community.freescale.com/docs/DOC-95205
View full article
The Freescale Cup has been around the world for the last 9 years. Over 23,000 students work each year on intelligent cars to make then run around the track at fast speed. Find more information on the community. Select the region you are part on and engage in the next season of the challenge.
View full article
In this video, we will examine a commercial of the shelf (COTS) H-Bridge IC. Example code for the FRDM-TFC will also be examined.
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by David Lieberman
View full article
Harvard Extension School CSCI E-251, Fall 2012: Principles of Operating Systems Final Project Presentations Presentation by Kate Fischl
View full article
This video will examine how can design speed sensing into their vehicle platform.   An example of magnet and sensor placement is shown.
View full article