University Programs Knowledge Base

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

University Programs Knowledge Base

Labels

Discussions

Sort by:
One of the finalist vehicles for the Freescale Cup China 2012 event. In 2012, we switched the black lines to the outer edges for a new challenge twist for the students to adapt to.
View full article
This tutorial will introduce you to I 2 C and provide a framework that you can use to start communicating with various devices that use I 2 C. This tutorial is meant for the Kinetis K40 and will probably not work on any other Kinetis chip. DISCLAIMER: This has not been fully tested and may not work for you and for all devices. The header file provided does not handle errors and should not be used for critical projects. 2C signaling I2C header file Example of I2C communication using Freescale MMA8452Q 3-axis accelerometer Introduction to I 2 C signaling I 2 C is a simple two wire communication system used to connect various devices together, such as Sensory devices and microprocessors using 8 bit packets. I 2 C requires two wires: the first is called SDA and is used for transferring data, the second is called SCL and it is the clock used to drive the data to and from devices. I 2 C uses an open drain design which requires a pull up resistor to logic voltage (1.8,3.3,5) on both SDA and SCL for proper operation. I 2 C is a master-slave system where the master drives the clock and initiates communication. The I 2 C protocol has 5 parts. The Start signal which is defined as pulling the SDA line low followed by pulling SCL low. The slave device address including the Read/Write bit The register address that you will be writing to/ reading from the data The acknowledgement signal which is sent from the receiving device after 8 bits of data has been transferred successfully. the Stop signal, which is defined by SDA going high before SCL goes high. 1. The start signal is sent from the Master to intiate communication on the bus. The start and stop signals are the only time that SDA can change out of sync with SCL. Once the start signal is sent no other device can talk on the bus until the stop signal is sent. If for whatever reason another device tries to talk on the bus then there will be an error and the K40 can detect this. 2. The slave device is a 7 bit (sometimes 10bit but this will not be covered in this tutorial) address provided by the device and is specific to the device. The type of data operation (read/write) is determined by the 8 th bit. A 1 will represent a write and a 0 a read operation. 3. The register addresses are provided by the device's specifications. 4. The data you will send to a device if you are writing or the data that you receive from the device when reading. This will always be 8 bits. 5. After 8 bits of data has been transferred successfully the receiving device will pull the SDA line low to signify that it received the data. If the transmitting device does not detect an acknowledgement then there will be an error. The K40 will be able to detect this. 6. The stop signal is sent from the Master to terminate communication on the bus. Some devices require this signal to operate properly but it is required if there will be more than one master on the bus (which will not be covered in this tutorial) I2C header file This header file only has functions for reading and writing one byte at a time. Most devices support reading and writing more than one byte at a time without sending the Stop signal. Typically the device will keep incrementing the register's address to the next one during read/writes when there is no stop signal present. See your device's user manual for more information. /* * i2c.h * * Created on: Apr 5, 2012 * Author: Ian Kellogg  * Credits: Freescale for K40-I2C example */  #ifndef I2C_H_  #define I2C_H_  #include "derivative.h"  #define i2c_EnableAck() I2C1_C1 &= ~I2C_C1_TXAK_MASK #define i2c_DisableAck() I2C1_C1 |= I2C_C1_TXAK_MASK  #define i2c_RepeatedStart() I2C1_C1 |= I2C_C1_RSTA_MASK  #define i2c_Start() I2C1_C1 |= I2C_C1_TX_MASK;\    I2C1_C1 |= I2C_C1_MST_MASK  #define i2c_Stop() I2C1_C1 &= ~I2C_C1_MST_MASK;\    I2C1_C1 &= ~I2C_C1_TX_MASK  #define i2c_EnterRxMode() I2C1_C1 &= ~I2C_C1_TX_MASK;\    I2C1_C1 |= I2C_C1_TXAK_MASK  #define i2c_write_byte(data) I2C1_D = data  #define i2c_read_byte() I2C1_D  #define MWSR 0x00 /* Master write */  #define MRSW 0x01 /* Master read */  /* * Name: init_I2C * Requires: nothing * Returns: nothing * Description: Initalizes I2C and Port E for I2C1 as well as sets the I2C bus clock */  void init_I2C()  {    SIM_SCGC4 |= SIM_SCGC4_I2C1_MASK; //Turn on clock to I2C1 module    SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK; // turn on Port E which is used for I2C1    /* Configure GPIO for I2C1 function */    PORTE_PCR1 = PORT_PCR_MUX(6) | PORT_PCR_DSE_MASK;    PORTE_PCR0 = PORT_PCR_MUX(6) | PORT_PCR_DSE_MASK;    I2C1_F = 0xEF; /* set MULT and ICR This is roughly 10khz See manual for different settings*/    I2C1_C1 |= I2C_C1_IICEN_MASK; /* enable interrupt for timing signals*/  }  /* * Name: i2c_Wait * Requires: nothing * Returns: boolean, 1 if acknowledgement was received and 0 elsewise  * Description: waits until 8 bits of data has been transmitted or recieved */  short i2c_Wait() {    while((I2C1_S & I2C_S_IICIF_MASK)==0) {    }     // Clear the interrupt flag    I2C1_S |= I2C_S_IICIF_MASK;  }  /* * Name: I2C_WriteRegister * Requires: Device Address, Device Register address, Data for register * Returns: nothing * Description: Writes the data to the device's register */  void I2C_WriteRegister (unsigned char u8Address, unsigned char u8Register, unsigned char u8Data) {    /* shift ID in right position */    u8Address = (u8Address << 1)| MWSR;    /* send start signal */    i2c_Start();    /* send ID with W/R bit */    i2c_write_byte(u8Address);    i2c_Wait();    // write the register address    i2c_write_byte(u8Register);    i2c_Wait();    // write the data to the register    i2c_write_byte(u8Data);    i2c_Wait();    i2c_Stop();  }  /* * Name: I2C_ReadRegister_uc * Requires: Device Address, Device Register address * Returns: unsigned char 8 bit data received from device * Description: Reads 8 bits of data from device register and returns it */  unsigned char I2C_ReadRegister_uc (unsigned char u8Address, unsigned char u8Register ){    unsigned char u8Data;    unsigned char u8AddressW, u8AddressR;    /* shift ID in right possition */    u8AddressW = (u8Address << 1) | MWSR; // Write Address    u8AddressR = (u8Address << 1) | MRSW; // Read Address    /* send start signal */    i2c_Start();    /* send ID with Write bit */    i2c_write_byte(u8AddressW);    i2c_Wait();    // send Register address    i2c_write_byte(u8Register);    i2c_Wait();    // send repeated start to switch to read mode    i2c_RepeatedStart();    // re send device address with read bit    i2c_write_byte(u8AddressR);    i2c_Wait();    // set K40 in read mode    i2c_EnterRxMode();    u8Data = i2c_read_byte();    // send stop signal so we only read 8 bits    i2c_Stop();    return u8Data;  }  /* * Name: I2C_ReadRegister * Requires: Device Address, Device Register address, Pointer for returned data * Returns: nothing * Description: Reads device register and puts it in pointer's variable */  void I2C_ReadRegister (unsigned char u8Address, unsigned char u8Register, unsigned char *u8Data ){    /* shift ID in right possition */    u8Address = (u8Address << 1) | MWSR; // write address    u8Address = (u8Address << 1) | MRSW; // read address    /* send start signal */    i2c_Start();    /* send ID with W bit */    i2c_write_byte(u8Address);    i2c_Wait();    // send device register    i2c_write_byte(u8Register);    i2c_Wait();    // repeated start for read mode    i2c_RepeatedStart();    // resend device address for reading    i2c_write_byte(u8Address);    i2c_Wait();    // put K40 in read mode    i2c_EnterRxMode();    // clear data register for reading    *u8Data = i2c_read_byte();    i2c_Wait();    // send stop signal so we only read 8 bits    i2c_Stop();    }  #endif  Example of I2C communication using Freescale MMA8452Q 3-axis accelerometer This example is very simplistic and will do nothing more than read the WHO AM I register to make sure that I 2 C is working correctly. To see more check out the Freescale MMA8452Q Example /* Main. C */ #include <stdio.h> #include "derivative.h" /* include peripheral declarations */ #include "i2c.h" int main(void) {      // checking the WHO AM I register is a great way to test if communication is working      // The MMA8452Q has a selectable address which is either 0X1D or 0X1C depending on the SA0 pin      // For the MMA8452Q The WHO AM I register should always return 0X2A      if (I2C_ReadRegister_uc (0x1D,0x0D) != 0x2A {           printf ("Device was not found\n");      } else {           printf ("Device was found! \n");      } }
View full article
Connection Diagram for TRK-MPC5604B to Rev. 1 Motor Control "Shield" Board Connection Diagram for TRK-MPC5604B to Rev. 0 Motor Control Board For the TRK-MPC5604, connect the flat ribbon cable to PortB as seen in the picture below. Make the cable connections as shown below for dual motor with independent drive connection Make the cable connections as shown below for dual motor with series drive connection Make the cable connections as shown below for Single motor connection Protect your electronics 1. Try not to stop the wheels while in motion.  This can cause current spikes. 2. Don’t disconnect or connect any cable when board is powered [ON]. 3. Don’t discharge the battery below 5.5V 4. Don’t hit stationary objects
View full article
These are the 2015 Freescale Cup Worldwide Challenge Rules. The Finals will take place in Erlangen Germany on September 14-15, 2015. The Worldwide Rules are to be used for all challenges unless the University Programs Coordinator modifies the rules for your specific region. Update on Rules V6: highlighted the fact that no wireless connectivity is allowed during the race. Any wireless connectivity module must be removed before the technical inspection
View full article
Congratulations to all the teams to making it this far.  Last minute tweaks made and broke a few teams shooting for the top spot. Best times: (in seconds) 14.89 - Beijing University of Science and Technology [China] 17.60 - Swinburne University of Technology [Malaysia] 19.08 - National Taiwan University of Science and Technology [Taiwan] 19.57 - Escola Politecnica da Universidade de Sao Paulo [Brazil] 20.54 - University of California Berkeley [USA] 22.14 - Slovak University of Technology [Slovakia] DNF - The University of Tokyo [Japan] DNF - Bannari Amman Institute of Technology [India] DNF - Instituto Politecnico Nacional [Mexico] Read more: Day 1: Freescale Cup 2013 Worldwide Championship and China Regional Finals Day 2:  (coming soon)
View full article
Congratulations to all teams of the inaugural West Coast Freescale Cup event!  Our three fastest times, covering a total distance of 147 feet.  Full collection of event photos and videos!! Top 3 Teams: * First Place - UC Berkeley - 21.27 seconds Second Place - UC Davis - 27.92 seconds Third Place -  UC Davis - 28.00 seconds
View full article
Congratulations to all the East Coast teams and to UC-Berkeley for the overall fastest car in the USA!  More photos/videos from the event. West vs. East Winner: Jolt - UC-Berekley 17:35 East Coast Teams: First Place: Relativistic Robotic Racers - University of Rhode Island - 22.04 seconds Second Place: Vulcar - California University of Pennsylvania - 25.15 seconds Third Place: Temple Made - Temple University - 25.72 seconds See complete results
View full article
Instructions There are several main hardware configuration steps. 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. Then, connect one end of the USB cable to the PC and the other end to the Power/OSJTAG mini-B connector on the TWRK60N512 module. Allow the PC to automatically configure the USB drivers if needed. Before updating the firmware, it is necessary to start a CodeWarrior Project. In this case, the easiest way to do this is to actually navigate to the sample project and click on the Sample.mcp file. This will open CodeWarior 2.8. 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. 1.     Unplug the USB cable.   2.     Look for the jumper (On the REV B Board) labeled "OSBDM_IRQ" - it is jumper 35. It will be found between the on/off switch and to the right of the the white "Lin" connectors. Remove one of the "LED Enable" jumpers for this if you don't have a   header jumper handy and put the jumper on the OSBDM_IRQ header These LED Jumpers are just above the blue potentiometer knob and marked as "J27."   3.    Reconnect the USB cable and click OK.   4.     Wait for the new firmware to download. 5.     A new dialog will appear when the process is complete.  6.    Unplug the cable, remove the jumper, return it to the location it was "borrowed from" and reconnect the cable. 7.    Then click OK.
View full article
Recommend accessories or post your own designs.  For the community by the community! Add your contributions in the comments section below.  As I filter through them I will move them up into this main document, so it is easier to browse. TFC Camera Mounts Designed by Wave Number Print these on demand via Shapeways.com Base Board Hinge Two Position Tower Elevator TWR-ELEV-2 — Wavenumber LLC - Link to the Store
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
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
The Freescale Cup East China 2013 challenge video 2 After formal competition finished in East China, we gave a challenge and asked teams to try a hill with >30 angle, some cars successes
View full article
Video Highlights of 2012 Competition Photographs from the Freescale Cup Japan 2012 competition.
View full article
Photos Videos
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
In this training video we will examine some concepts in approaching a vehicle control system.  This includes the stages in data flow and update rates of the control software.   The concept of differential steering will be introduced.
View full article
In this video we will look at the example code provided for the FRDM-TFC for use with Codewarrior.  
View full article
How does a DC Motor work? The DC motor is a machine that transforms electric energy into mechanical energy in form of rotation. Its movement is produced by the physical behavior of electromagnetism. DC motors have inductors inside, which produce the magnetic field used to generate movement. But how does this magnetic field changes if DC current is being used? An electromagnet, which is a piece of iron wrapped with a wire coil that has voltage applied in its terminals. If two fixed magnets are added in both sides of this electromagnet, the repulsive and attractive forces will produce a torque. Then, there are two problems to solve: feeding the current to the rotating electromagnet without the wires getting twisted, and changing the direction of the current at the appropriate time. Both of these problems are solved using two devices: a split-ring commutator, and a pair of brushes. As it can be seen, the commutator has two segments which are connected to each terminal of the electromagnet, besides the two arrows are the brushes which apply electric current to the rotary electromagnet. In real DC motors it can be found three slots instead of two and two brushes. This way, as the electromagnet is moving its polarity is changing and the shaft may keep rotating. Even if it is simple and sounds that it will work great there are some issues which make these motors energy inefficient and mechanically unstable, the principal problem is due to the timing between each polarity inversion. Since polarity in the electromagnet is changed mechanically, at some velocities polarity is changing too soon, which result in reverse impulses and sometimes in changing too late, generating instantaneous “stops” in rotation. Whatever the case, these issues produce current peaks and mechanical instability. How a DC motor can be controlled? DC motors have only two terminals. If you apply a voltage to these terminals the motor will run, if you invert the terminals position the motor will change its direction. If the motor is running and you suddenly disconnect both terminals the motor will keep rotating but slowing down until stopping. Finally if the motor is running and you suddenly short-circuit both terminals the motor will stop. So there is not a third wire to control a DC motor, but knowing the previous behaviors it can be designed a way to control it, and the solution is an H-bridge. Look at the last evolution of the DC Motor above, you can observe that there are four gates and a motor connected between them. This is the simplest H-bridge, where the four gates represent for transistors. By manipulating these gates and connecting the upper and lower terminals to a voltage supply, you can control the motor in all the behaviors as below. Things to Consider When Using Motors With the Motor and Line scan Camera hooked up to the same board there is a significant problem with noise. The higher you turn the PWM on your drive motors the noise produced and the worse the data will appear from the camera. TO significantly reduce this noise you can simply solder an inductor directly across the 2 drive motors. This will allow you to increase the speed of the car without significantly affecting the data you receive back from the camera.
View full article
On September 14-15, 2015, The Freescale Cup Worldwide Finals will be held at the Fraunhofer Institute of Integrated Circuits (Fraunhofer IIS) in Erlangen, Germany You can follow along and see the regional champion teams from South Korea, China, India, Taiwan, Malaysia, Mexico, Brazil, USA and Switzerland train and compete for the World Title. Agenda of the event covered by the LiveCast is (all times are Central Europe Time): September 14th 14:00 - 15:00 Opening Ceremony 15:00 - 17:30 Training Session 17:30 - 18:00 High Schools and Innovation Challenge Demonstrations September 15th 9:00 - 13:00 Training Session 13:00 - 14:30 Technical Inspection and preparation for the Finals Race 14:30 - 15:00 Finals Race 15:00 - 15:45 Preparation for the Awards 15:45 - 17:30 Awards Ceremony Download and print the attached poster with the embedded QR-Code for posting the link of the LiveCast Direct LiveCast URL is http://www2.iis.fraunhofer.de/freescale
View full article