Here is a Project created using new KDS version 3.0 and Kinetis software development kit 1.2 on processor expert platform. This is a project for blinking an RED LED using TPM module of PE implemented using freedom board FRDM-KL46Z.
Requirements
To run successfully this exercise, you need first to download following packages (link enclosed):
- IDE toolchain Kinetis Design Studio (KDS) min v3.0
- microcontroller Library Kinetis Software Development Kit (KSDK) min 1.2
- FRDM-KL46Z materials (schematics, Quick Start Package and Sample Code Package)
- latest P&E Micro windows drivers and SDA Applications
Before connecting your FRDM-KL46Z for the first time to the USB port of your computer, install the P&E Micro windows driver to ensure a correct detection of the board.
Install first the IDE toolchain KDS and when the installation ended successfully, install the MCU Library KSDK keeping the proposed installation path c:\freescale\kds or ksdk unchanged.
Launch KDS and define your workspace path, then select Help, Install New Software, Add, Archive, C:\Freescale\KSDK_1.2.0\tools\eclipse_update, select KSDK_1.2.0_Eclipse_Update.zip and press Open, OK, select KSDK Eclipse Update, press Next, Accept the Licence Agreement and press Finish. The KSDK libraries are now directly available in the IDE toolchain.
The automated code generator Processor Expert is already included in the IDE Toolchain (available separately as Processor Expert Driver Suite for other IDE toolchains).
Tutorial instructions
The tutorial shows how to toggle LED with KSDK 1.2.0 in KDS 3.0 and Processor Expert using a Timer Output for FRDM-KL46Z.
Guide is prepared for red LED which is connected to Timer/PWM Module 0 (TPM0), channel 2 (according to FRDM-KL46Z schematics).
Create new project
Create new project in KDS 3.0 with KSDK 1.2.0
Type the project name e.g. frdm-kl46z_red_blinky_tpm, choose the board FRDM-KL46Z, mark off options Kinetis SDK and Processor Expert
Now, your project structure looks like this in the project explorer and Processor Expert windows:
Set Processor Expert Settings
Now, go to Components Library, find fsl_tpm component using filters KSDK 1.2.0 and Applicable to Project and by double click add the component to the Processor Expert Component View of your project.
Rename the component tpmTmr:fsl_tpm to RedLed.
Double click on RedLed:fsl_tpm in Components View and Component Inspector view should open automatically
First turn the Component Inspector view to Classical view by unselecting the Tab View option.
Enable to reload the counter on Trigger
Set the counter frequency to 2Hz with a Duty cyle of 50%
Allocate TPM0 Channel 2 to Pin LED2_RED (defined by board selection)
Select Clock source MCGIRCLK and choose the Prescaler Divide by 64
Enable the Initialization of TPM0 Channel 2
Save the configuration by pressing ctrl+s
The star beside Component Inspector tab should have disappeared.
Generate the Processor Expert Code for the component RedLed that we have just configured
Build your project by choosing the right toolbar shortcut
Debugging the FRDM-KL46Z board for the first time, you need to define a Debug Configuration by selecting the appropriate option from the toolbar
The FRDM-KL46Z embeds a multimode programming and debug interface easily reconfigurable by drag’n droping from the file explorer new SDA applications in Bootloader mode.
For this example, we are going to select the PEMicro OpenSDA Debug mode.
Select the Debugger tab to choose the Interface OpenSDA Embedded Debug - USB Port
You can now start the Debug session!!
Launch the configuration
You should now the Red LED blink with a 2Hz frequency
Top Comments