KWIKSTIK K40 Getting Started

Document created by GUO XIAOLI Employee on Jul 12, 2012Last modified by Eli Hughes on May 30, 2014
Version 8Show Document
  • View in full screen mode

The Kwikstik board is a great board for use in a Freescale Cup car! This page has some videos and example code to get you
up and running quickly. For novice embedded developers it is recommended you use the FRDM-KL25Z for your Freescale Cup car.

Board Tips


The General Purpose TWRPI socket on the Kwikstik K40 board provides access to I2C, SPI, IRQs, GPIOs, timers, analog conversion signals, TWRPI ID signals, reset, and voltage supplies. The pinout for the TWRPI Socket is defined in Kwikstik User's Manual, but the user manual does not describe how to order a connector.

Soldering and directly connecting to the pins on the socket itself is very risky and not recommended. When browsing for connectors that interface with the TWRPI sockets you have two main options.

1. The first is a surface mount chip, that is a female connector to connect with the male pins on the board. There are surface mount lead on the top of the chip which will be easier to solder to. The part number is: SFC-110-T2-L-D-A

2. The second option is a female connector which mates with the male connection on the board and is then terminated with a wire for each pin. This option can greatly simplify your wiring challenges on your car as any additional lengths or wires can easily be trimmed off. The part number is: SFSD-10-28-G-12.00-S

Image of the SFSD-10-28-G-12.00-S with corresponding Kwikstik TWRPI socket.

v5JUx.jpg

Connectors can be ordered from Samtec as samples at this website: [http://www.samtec.com/suddenservice/samples/samples.aspx]

Useful Videos:



Creating a new baremetal project for a Freescale KwikStik
http://www.youtube.com/watch?v=P8X079Qs7cg&feature=g-upl&context=G2f166b6AUAAAAAAADAA


Debugging a bare metal project on the Freescale Kwikstik.
http://www.youtube.com/watch?v=nQhhfNJZL_o&feature=g-upl&context=G2dcfcd5AUAAAAAAAEAA


Importing projects and merging code.
http://www.youtube.com/watch?v=A_h9W-QRHp8&feature=g-upl&context=G2354416AUAAAAAAACAA


A discussion of the header files (and how to use them!) for Kinetis Devices in Codewarrior V10. This is the first of 2 videos. I had to split them up

as I cannot upload videos greater than 15 minutes in length.
http://www.youtube.com/watch?v=EP2FydCX9tY&feature=g-upl&context=G2fdf3fcAUAAAAAAABAA


Second part of the Kinetis Header file discussion
http://www.youtube.com/watch?v=ygjx-OkJuS4&feature=g-upl&context=G2792e97AUAAAAAAAAAA


Discussion on getting the Clock setup on the Kwikstik
http://www.youtube.com/watch?v=_FQzXhLDP2w&feature=youtu.be


How to setup GPIO on the Kinetis. Includes discussion on enabled clocks to peripherals and setting up the pin control registers.
http://www.youtube.com/watch?v=GXjRpsGJJt4&feature=youtu.be


How to use the SysTick peripheral in the Cortex core with interrupts
http://youtu.be/8SRqlDkJwGU


Discussion of how to setup interrupts on the NVIC. The Flex timer is used as an example
http://www.youtube.com/watch?v=_mClHzxm0Wk&feature=youtu.be

 

Example Programs:


All of the programs are bare metal examples for CodeWarrior 10.1 that can be used on the Kwikstik board. Make sure to read all of the comments in the C files!

How to Load Programs In CodeWarrior:
Copy only the source files and header files into a new folder. Import that new folder into CodeWarrior to avoid debug problems.


ClockSetup - Systick
This example will demonstrates how to enable the 4MHz Crystal on the Kwikstik. Early versions of the Kinetis silicon had bug in which the device could crash if the clock dividers are changed while executing from FLASH (errata e2448). This code places clock initialization code in RAM. The clock code is based upon routines from Kinetis Peripheral Module Quick Reference (Freescale document KQRUG.pdf). It also shows how to enable the SysTick module in the Cortex Core. The SysTick is used to provide a delay Function.

 

  FlexTimer_NVIC_IRQ

This code shows how to use the NVIC in the Cortex Core. The Flex Timer module is used to generate a periodic interrupt (similar to the SysTick example).


LCD_Example
This code will turn on segments on the LCD on the Kwikstik. The LCD driver code is derived from the MQX based example on the Kwikstik page.

 

PWM_Test

This code shows how to setup the flex timers to generate different styles of PWM. Note: One of the examples sets up the flex timer for pseudo-complementary PWM. It DOES NOT use the hardware based complementary mode. It writes 2 individual registers in a software routine. One should use this a starting point to enable full hardware based complementary mode.


CameraTest
This example is a basic example on how to interface to the Freescale Linescan Camera. It will display a rough approximation of the output on the LCD.

Note: The code does not run with the camera by default. This is because the AOUT is set to the pin with the pull up resistor (J15 pin 4). Once changed it will work smoothly.

Outcomes