Twr K40x256 Hardware Setup

Showing results for 
Search instead for 
Did you mean: 

Twr K40x256 Hardware Setup

No ratings

Twr K40x256 Hardware Setup


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.

  1. Open Codewarrior
  2. Navigate to File-> New ->Bareboard Project
  3. Select Kinetis K40->MK40X256VMD100 , P&E Open Source Jtag, C Language, No Rapid Application Development ,Finish
  4. Click on the main.c To get project focus
  5. Selection Project->Build Configurations->MK40X256VMD100_INTERNAL_FLASH
  6. Project-»Build All
  7. Run->Debug Configurations—> Use the Codewarrior download Filter and Select "PROJECTNAME_MK40XD256VMD100_INTERNAL_FLASH_PnE_OSJTAG"
  8. 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 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.
  3. Reconnect the USB cable and click OK.
  4. Wait for the new firmware to download. A new dialog will appear when the process is complete.


  1. Unplug the cable, remove the jumper, and reconnect the cable.
  2. 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

Labels (1)
Tags (1)

When using CW 10.2, Update 1.0.0, there is no K40 MK40X256VMD100 chip listed.  The closest match would appear to be MK40DX256Z.  Under connections, there are many P&E options, but the only Open Source JTAG does not have the P&E label in front of it.  Similarly other references in above steps to the chip ID and to PnE, etc., do not show up.

The code generated by the bareboard project does work; if someone gets the firmware updated, they might as well continue with this project first to see the "Hello World" print out.

Note that in the above instructions, there is no step 3: Import the LED Project.


Thanks for the feedback.  I would also suggest people look at the LabGuide on the TWR-K40 product page.

To answer your questions though:

MK40DX256Z is the target you want to pick.

Open Source JTAG (OSJTAG) is administered by P&E on Freescale's behalf.  Hence, some people improperly refer to it as P&E OSJTAG.

I will likely revamp this page and maybe consolidate it with another.

Version history
Revision #:
1 of 1
Last update:
‎07-12-2012 02:16 PM
Updated by: