Project Description

A port of the .Net MicroFramework to the Freescale Kinetis K60 microprocessor, specifically the TWR-K60N512 development module. Currently the following is supported:

  • GPIO
  • USART Ports 1 to 4 (COM4 is the port used on TWR-SER)
  • USB client - setup for debugging currently.
  • I2C
  • SPI

NOTE - It is possible to permanently brick a Kinetis if certain values are programmed at locations 0x400 to 0x410, using this port is very much at your own risk. Always check the linker map file when you are programming unknown software to your development board.

Installing

Download and install the Microsoft Porting Kit: here

Download this projects source and unzip over the porting kit, i've had to modify some of the base source of the Microframework as some of it needs to be tweaked to work the Cortex way.

Download and install Codesourcery Lite 4.5: here  (best to install it to a short path e.g. c:\gcc45).

Setting USB PID/VID

I've left the PID & VID as ???? characters, you will have to set them to something, for development purposes you can just set them to some arbitrary value. If you develop a product then obviously your going to have to obtain a VID from USB-IF. The file to modify is Solutions\K60\DeviceCode\USB_PAL\usbconfig.cpp

Also modify the PID & VID's in the inf file in the seperate driver download, they are all set to zeros, set them to the values you have picked.

Compiling

Start a command prompt and navigate to Microframework directory, type the following:

setenv_gcc4.5 c:\gcc45

where "C:\gcc45" is the path you installed Codesourcery Lite to.

navigate to the Solutions\K60\Tinybooter folder and type the following:

msbuild /t:build /p:flavor=release

it will take a little while to compile

navigate to the Solutions\K60\Tinyclr folder and type the following

msbuild /t:build /p:flavor=release

Deploying

This is where it gets a little tricky, you need to find a way to get the Tinybooter onto the board. Easiest is to use the evaluation version of Codesourcery Kinetis and deploy the .axf file, other Kinetis development environments may well deploy it as well.

If your on 64 bit windows you will now need to test sign the USB driver to get it to install, theres some instructions on that here.

Once Tinybooter is on the board and running, windows will be asking you for the driver, point it to the inf file you have modified and the driver should install.

To deploy the TinyCLR to the board, run up MfDeploy (which comes with the standard microframework SDK) switch it to USB and select the ER_CONFIG and ER_FLASH files in the

BuildOutput\THUMB2\GCC4.5\le\FLASH\release\K60\bin\tinyclr.hex

folder and click Deploy. You should now be able to download software from Visual Studio 2010/Express to the board. Heres a simple app that will flash an LED on the board.

OutputPort port = new OutputPort((Cpu.Pin)28, true);

while (true)
{
	port.Write(true);
	Thread.Sleep(500);
	port.Write(false);
	Thread.Sleep(500);            
}

Last edited Jul 9, 2011 at 7:09 PM by Roceh, version 13