This document shows how to execute the demo-apps for FRDM-KW41ZFRDM-KW41Z that comes along with connectivity software package
To proceed further the below are the prerequisites:
1. KDS3.2.0 installed on your computer
(You can download latest version of KDS from Here or direct download from below link:)
2. KW41Z Connectivity Software
The KW41Z Connectivity Software package integrates the Kinetis Software Development Kit v2.0 and all the wireless connectivity stacks required to develop your solution using IEEE 802.15.4 and/or Bluetooth Low Energy.
Click below to download the KW41Z Connectivity Software appropriate for your computer's operating system.
After installation you can find Connectivity Example Codes at below folder location:
C:\NXP\MKW41Z_ConnSw_1.0.2
Steps involved:
1) Importing the project into workspace
2) Build and Run an example application
Importing the project into workspace
Open Kinetis Design Studio Version: 3.2.0 it prompts the user to select a workspace location. KDS IDE is built on top of Eclipse, which uses workspace to store information about its current configuration; you can choose your own location.
Select "File -> Import" from the KDS IDE menu. In the window that appears, expand the "Project of Projects" folder and select "Existing Projects Sets". Then, click the "Next" button.
As we have installed the KW41 connectivity software at below location: point the browse option to this location or copy the path and paste it as shown in picture
“C:\nxp\MKW41Z_ConnSw_1.0.2\boards\frdmkw41z\demo_apps\ecompass\kds”
After pointing to the correct directory, your "Import Working Sets and Projects" window should look like the figure below. Click the "Finish" button.
The workspace will look like figure shown below:
You can browse to source folder “ecompass.c” where our main program is present
The E-Compass demo application demonstrates the use of the FXOS8700 sensor. The tilt-compensated algorithm calculates all three angles (pitch, roll, and yaw or compass heading).
I2C communication is done using pin muxing method here
SCL port is assigned to port-C-2 as shown below:
#define I2C_RELEASE_SCL_GPIO GPIOC
#define I2C_RELEASE_SCL_PIN 2U
SDA port is assigned to Port-C-3 as shown below:
#define I2C_RELEASE_SDA_GPIO GPIOC
#define I2C_RELEASE_SDA_PIN 3U
I2C Port pin config is done as below:
PORT_SetPinConfig(I2C_RELEASE_SCL_PORT, I2C_RELEASE_SCL_PIN, &i2c_pin_config);
PORT_SetPinConfig(I2C_RELEASE_SDA_PORT, I2C_RELEASE_SDA_PIN, &i2c_pin_config);
Magnetometer calibration is done using static void Magnetometer_Calibrate(void)
sensor data is received using Sensor_ReadData(&g_Ax_Raw, &g_Ay_Raw, &g_Az_Raw, &g_Mx_Raw, &g_My_Raw, &g_Mz_Raw);
FXOS sensor is initialised and data is read using below functions
FXOS_Init(&g_fxosHandle);
/* Get sensor range */
FXOS_ReadReg(&g_fxosHandle, XYZ_DATA_CFG_REG, &g_sensorRange, 1);
Debugging (Build and Run an example application)
There are two project configurations (build targets) supported for each KSDK project:
• Debug – Compiler optimization is set to low, and debug information is generated for the executable. This target should be selected for development and debug.
• Release – Compiler optimization is set to high, and debug information is not generated. This target should be
selected for final application deployment.
Choose the appropriate build target, "Debug" or "Release", by clicking the downward facing arrow next to the hammer icon, as shown below. For this example, select the "Debug" target.
Run an example application
Now connect the KW41Z board to your machine USB port and click on hammer button to build the project to check whether the project is compiling and building without errors
You can see the result in console window as shown below:
Now we will proceed to execute this project by clicking on debug configuration as shown:
Make sure to connect the development platform to your PC via USB cable between the OpenSDA USB and the PC USB connector.
Make the selection as shown
The application is downloaded to the target and automatically run to main(): You will see the execution window as shown below:
Now open a serial hyper terminal window to test this application:
My board is connected to com44 port as shown in device manager:
I am having putty serial terminal application with me, open with below set up configuration:
Now go back to the KDS execution window and
Start the application by clicking the "Resume" button
The ecompass application is now running: