A first project with FRDM-K64F and Kinetis Design Studio

FRDM K64F

Today, I thought I’d have a go at running one of the simple demonstrations I saw at the recent Freescale Tech Day in Milton Keynes. I have a FRDM-K64F development board which I bought a few weeks ago, and my fresh installation of the KDS IDE. The K64F is a lovely board with a powerful ARM Cortex M4F CPU running at up to 120MHz, has built-in ethernet and debugger support, and was used for several of the demonstrations, so it seems a reasonable choice. Getting started is a lot more tricky than with an Arduino, though.

Here’s what I did, mostly following the script of the demonstration to get me started.

Replace the mbed bootloader with one more suited to debugging a C program

Bodybuilding: teams spain europages testogel for sale naked tv host – naked bodybuilding muscle women – spanish videos.

  1. Download the Segger J-Link firmware from a link at the bottom of http://www.segger.com/opensda.html
  2. Install the J-Link firmware as described in http://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/

Create a project in KDS

  1. Open KDS, dismiss the welcome screen if you see it, then right click in the “project explorer” panel on the left. Select New Project and choose “Kinetis Design Studio Project”
  2. Name the project, e.g. K64F-example
  3. Select MK64FN1M0xx12 as the processor type
  4. Deselect ‘Use Kinetis SDK’
  5. Select ‘Processor Expert’
  6. Click Finish
  7. If you do not see any extra panels, choose “Show Views” from the “Processor Expert” menu

Add a Processor Expert component

  1. Go to the Components Library tab/li>
  2. Switch to Alphabetical View
  3. Find BitIO and drag it to the Components folder in the Components view
  4. Right Click on BitIO component and select Inspector
  5. It should show a red box indicating a missing value for the pin to use
  6. Select “advanced mode” from the bar above the inspector window
  7. Give the pin a name (eg. LED)
  8. Click in the top red box and start typing, watch as the big list of pins is filtered. Enter PTB22
  9. Set “Direction” to output and “Initial value” to 1
  10. In the “Project Explorer” panel expand your new project if it is not already, then right-click ProcessorExpert.pe and select “Generate Processor Expert Code”
  11. Now expand Sources and open “main.c”
  12. Look for the bit where you are supposed to “write your code here” and insert:
    for(;;) {
      LED_ClrVal();
      LED_SetVal();
    }
    
  13. save the file and click the “hammer” icon to build the project

Run the new program using the debugger

  1. Set up the project to use the J-Link debugger: click the little triangle next to the beetle icon on the top bar and select “debug configurations”
  2. Double-click GDB SEGGER J-Link Debugging
  3. The annoying bit: open the “Debugger” tab and enter “MK64FN1M0xxx12” in the device name and click apply
  4. Open the “Startup” tab and un-check the “ENable SWO” box
  5. Click “debug” at the bottom of this pop-up window
  6. If all goes well it will switch to the “debug” perspective. If it asks permission, feel free to check the little box so it does not ask next time
  7. If you see a “terms of use” message from Segger, accept it
  8. By default the debugger will have placed a breakpoint at the start of “main”. Double-click in the left margin next to the two LED lines to set two more
  9. Now you can click the green “play forward” arrow in the top bar to advance to the next breakpoint
  10. Press “play forward” several times and watch in amazement as the red LED on the board toggles on and off

That feels like quite a slog, but by this point we have made sure that the IDE is working OK, and is configured for the correct board, installed and tested the Segger J-Link debugger firmware on the board, and used Processor Expert to implement a (manual) blinking LED. This is a great jumping-off point for future projects. If you follow these steps, I recommend saving the project in your favourite version control system, so you can come reliably back to here later.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *