Writing my first KSDK1.2 Application in KDS3.0 - Hello World and Toggle LED with GPIO Interrupt

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

Writing my first KSDK1.2 Application in KDS3.0 - Hello World and Toggle LED with GPIO Interrupt

Writing my first KSDK1.2 Application in KDS3.0 - Hello World and Toggle LED with GPIO Interrupt

Hi all,

 

Please find attached the new version of this document using KDS3.0 and KSDK1.2.0.

 

For more information about using Interrupts please see the following document from Jorge_Gonzalez

Interrupt handling with KSDK and Kinetis Design Studio

 

For information about creating a new KSDK project with MQX please see the following document.

How To: Create a New MQX RTOS for KSDK Project in KDS

 

For information about creating a new C++ project in MQX for KSDK1.2 please see the following document.

How to Create a C++ Project Using MQX RTOS for KSDK1.2

 

For information about getting started with FreeRTOS and KSDK1.2 see the following document.

How to: Create a New FreeRTOS for KSDS1.2 Project in KDS3.0

 

 

I hope it is useful.

 

Regards,

Carlos

Technical Support Engineer

Labels (1)
Attachments
Comments

Hey Carlos,

I got the Hello World and Toggle LED with GPIO Interrupt working.

I must say that it was an unexpectedly hard slog - are there plans to automate the process of creating of projects?  Adding the library folders (and the library file to the linker itself) seem to be areas that would be ripe for automating for the user.

It took me an honest three hours to go through your document (and the referenced ones).  I did add some extra steps, based on the work I had done before trying to set up KDS/KSDK before, as well as document and try to verify everything that was being done.  Here are my notes with issues I had, questions as to why certain things were done and suggestions:

Following instructions from: https://community.freescale.com/docs/DOC-103288 & document "Writing my first KSDK Application in KDS"

- Document has text on first page: "This document explains briefly how to create a Hello World project and toggle a LED using GPIO interrupts.  KSDK1.1 and KDS2.0 are used in this example"

System was a Windows 7 PC

Before starting anything, made sure all instances of CW and MQX were removed from system.

Document Steps followed:

1.1     Install KDS using instructions here: file:///C:/Users/myke%20predko/Downloads/KDS%20Installation%20Guide.pdf

1.1.1   Did NOT Turn Windows UAC Off

1.1.2   When "Custom Setup" dialog came up, didn't change anything.

1.2     ISSUE: Document specified is for KSDK 1.0.0 (file:///C:/Users/myke%20predko/Downloads/KSDK%20Installation%20Guide.pdf)

        Decided to install KSDK 1.1.0 using document as a guilde

1.2.10  ISSUE: Got different options for the "Choose Install Set".  Went with only "Kinetis SDK Basic"

1.2.12  Restarted the System

1.3     Presumed that this means start up Kinetis Design Studio

1.3.a   Created the following path "C:\eclipse workspaces\Freescale\KDSworkspace" for the workspace

1.3.b   Dismissed the Welcome Splash Screen and went straight to the workbench

1.3.c   Did "Check for Updates"

         - Got "GNU ARM PEMicro Interface Debugging Support" Update & Installed it

         - This caused KDS to restart

1.3.d   Opened "C:\Freescale\KSDK_1.1.0\doc\Getting Started wtih Kinetis SDK (KSDK).pdf" as Specified in Appendix A

         - Followed instructions in section 5.2 of the document

         - Loaded "KSDK_1.1.0_Eclipse_Update.zip" from "C:\Freescale\KSDK_1.1.0\tools\eclipse_update"

         - Restarted KDS

1.3.e   After Restart did "Install New Software"

         - Work with: "Freescale KDS Update Site"

         - Selected and installed:

           - "MQX Plug-ins"

           - "Processor Expert Software - Update for KDS v1.1.x"

           - ISSUE: This isn't described in "Getting Started wtih Kinetis SDK (KSDK).pdf" or Appendix A.  I *think* it's correct.

           - ISSUE: "Projects of Projects Plug-in" was also installed even though "Projects of Projects" wasn't selected.

         - Restarted KDS

1.4     Confirmed "KSDK_PATH" environment variable is correct.

1.5     Following "Getting Started wtih Kinetis SDK (KSDK).pdf" as specified

        ISSUE: There is no "7 Build and run the KSDK demo applications using Kinetis Design Studio IDE", in the document it's "7 Run a demo using ARM GCC".  Believe that what is being suggested is "5.3 Build the platform library".

        ISSUE: Could not find "Open the platform driver library" section in

        Followed "5.3 Build the platform library"

        No Issues building the platform library

Extra Step: Plugged in FRDM-K64F Board and waited for USB_CDC to be assigned

            Installed "mbedWinSerial_16466.exe" for Freedom Board

            FRDM-K64F Board recognized as "COM3"

Extra Step: Tested what has been done so far building a demo application.  This was done by following "Getting Started wtih Kinetis SDK (KSDK).pdf" section "5.4 Build a demo application"

            Loaded "hello_world" from "C:\Freescale\KSDK_1.1.0\demos\hello_world\kds\frdmk64f"

            No changes to Project "Properties"

            Did "Clean Project"

            Did "Build Project" - Successful

Extra Step: Executed the demo application.  This was done by following "Getting Started wtih Kinetis SDK (KSDK).pdf" section "5.5 Run a demo application".

            Assumed that the Freedom Board's CDC port is "COM3" and used Tera Term to test (mbed port was identified in Tera Term)

            No changes to system produced Debug Configuration under "GDB OpenOCD Debugging"

            Asked to open the Debug Perspective - said "Yes" and "Remember my decision"

            Execution/Debug of the application was successful

2.+++   Followed Instructions in Document and used the same names and used the FRDM-K64F Board through document except with ISSUEs, QUESTIONs and SUGGESTIONs where noted

2.3     ISSUE: Targets shown are a lot more than in screen shot

3.2     QUESTION: Why is the "Board" folder placed under "Sources" instead of under the project name, like in the example programs?

3.6     ISSUE: Folders tree screen shot in document does not match what is seen.  Isn't what is in the document what would be produced after a successful build?

        QUESTION: Why is the "Utilities" folder placed under "Sources" instead of under the project name, like in the example programs?

3.7     ISSUE: Include Folders do not match screen shot.  Screen shot should have '"${PROJECT_KSDK_PATH}/platform/utilities/inc"' & '"${PROJECT_KSDK_PATH}/platform/utilities/src"'

3.11    Did a "Clean Project" before "Build Project"

3.12    ISSUE: Did not get the same error as seen in Screen Shot ("fsl_os_abstraction.h" was flagged as error, not "fsl_uart_common.h")

         - followed instructions as "fsl_os_abstraction.h" is in the "C:/Freescale/KSDK_1.1.0/platform/osa/inc" as listed in the document

3.14    SUGGESTION: Add a Screen Shot showing the Compiler Include path that should be present

         - Did a "Clean Project" and "Build Project" cycle.  It looks like all compiles were correct all all failures were in linking ("Build target: FRDM-F64_HelloWorld_GPIO_ISR.elf")

3.15    ISSUE: "NOTE:" message at bottom of Screen shot is confusing.  ISSUES for section 1.5 identified (and the library was built)

         - Looked in C:\Freescale\KSDK_1.1.0\lib\ksdk_platform_lib\kds\K64F12\Debug and saw "libksdk_platform.a" and assumed this is correct

3.16    "Clean Project" and "Build Project" successful

4.2     Used default Debug Configuration under "GDB OpenOCD Debugging" for this project

4.4     Program Executed Successfully

        SUGGESTION: In the example program change the introduction message to "Hello World & GPIO ISR!" as individuals like me who want to test will have probably used "Hello World" and the same message coming out will be confusing

Hopefully this will be of use to you as well as somebody else working through the process. 

Let me know if you have any comments back.

myke

Thank you for doing what Freescale should probably have already done - proofread.

Hi Carlos,

I tried your example with KDS 3.0 and KDSK 1.2.0. It works well ( After I change some process, that were in include "C:\Freescale\KSDK1.2.0\system\inc" that should be change for C:\Freescale\KSDK_1.2.0\system\inc.)

This example use a "pre" files for FRDM-K64F. (board.h, etc).

but I need to do the same example in my custom board using K64 and K63. Begining from zero. Creating my own board.h and so on.

I began following "Kinetis SDK v.1.2 API Reference Manual", (Just to turn on and off a Pin). Including  KDSK files, Using "GPIO Peripheral driver" initializations, (Examples in Kinetis SDK v.1.2 API Reference Manual`). But until now it do not works. I receive may erros.

So I'm trying you.

Can you make the same  example, but using only KSDK files, and making the headers. Without following this pre files for demo boards ?

What can you suggest ?

Best Regards

Rodrigo

Hi Carlos,

I have followed the instructions in 'Writing my first KSDK1.2 Application in KDS3.0 - Hello World and Toggle LED with GPIO Interrupt' and the code will compile but it doesn't run properly, i am using a TWR-K60D100M tower kit and have (I think) changed all the board specific files accordingly. When I step through the program it gets as far as the

if ((!RTC_HAL_IsOscillatorEnabled(rtcBase)) && (config->enableOsc))

line within the BOARD_ClockInit(); routine and hangs to the DefaultISR in startup_MK60D10.S.

When I look at the Variables tab, rtcBase has a value reading;

Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * rtcBase Error message from debugger back end: value has been optimized out\ Unable to create variable object\ Failed to execute MI command: -var-create - * rtcBase Error message from debugger back end: value has been optimized out

Can you suggest anything I might be doing wrong? I am new to ARM coding so I apologize if it is a daft mistake...

Thanks

Darren

Hello Darren Nicholson:

Please confirm on your board that jumper J12 is installed in position 1-2. This is the VBAT power and any access to RTC registers would cause a hardfault.

Actually I recommend you to set the default jumpers configuration. Refer to the TWR-K60D100M Users Manual downloadable from this link:

Kinetis K60 100 MHz MCU Tower System Module|Freescale

Regards!

Jorge Gonzalez

Hi Jorge,

That’s fixed it now.

Thanks

Darren

Darren Nicholson

Design Engineer (Electronic)

Tritech International Limited

Oubas Hill, Ulverston, Cumbria LA12 7LB

++ 44 (0)1229 586672 (tel)

++ 44 (0)1229 586696 (fax)

++ 44 (0)1229 484265 (DDI)

Web: www.tritech.co.uk<http://www.tritech.co.uk/>;

Tritech International Limited, a Moog Inc. company<http://www.moog.com/markets/marine/>, is registered in Scotland.

Registered number: 85501. Registered office: Tritech International Ltd, Peregrine Road, Westhill Business Park, Westhill, Aberdeenshire. AB32 6JL

Hi Carlos

Thanks for the detail. I'm using it on a FRDM-KL27Z board. It toggles the LED blue SW3 is pressed with polling method. Once setup for interrupts nothing happened. I haven't dug into it.

Is there a similar document that can step through using KDSK1.2 and the visual Processor Expert? While it works for copying across a defined board FRDM-KL27Z- it seems likes its going to be less error prone to use the visual PE with selecting the pin options.

thanks

I found a description of generating a FRDM /KSDK1.2 /PE project that was useful

Freescale Freedom development platform: Kinetis... | element14 uses

specifies FRDM- KL46Z

http://element643.rssing.com/chan-7629382/all_p264.html#item5266  search KL27Z

Hello Neil,

You can also check the video in the next link:

The example is for FRDM-K64F, but you can simply follow the steps for the FRDM-KL27Z.

Regards!

Jorge Gonzalez

Thanks. Great to get the feel for the interface and visual tricks.

I also found another reference for flashing leds

Freescale Freedom development platform: [FRDM-K... | element1

However, it seems when multiple fsl_gpio are declared. 

pastedImage_1.png

only one fsl_gpio can be initialized.

On the Auto Initilization it seems only one port can be initialized on the menus

pastedImage_2.png

and indeed in Cpu.c: Components_init(void) only has one bit initialized

pastedImage_3.png

Hi Neil,

Actually you declared 3 "Output configurations". Instead you should declare 3 "Output pins" for the same Output configuration. Give a second check to the tutorial you linked and you will see the diference.

If you have more questions please open a new thread, to keep this post Non-PE related.

Regards!

Jorge Gonzalez

Thanks - a subtlety that I missed. For the non-PE v PE discussion - PE is much more automated in the environment setup, so I recommend PE.

No ratings
Version history
Last update:
‎01-07-2015 05:04 PM
Updated by: