I would like to present a bare-metal example project named MK22F51212_Project_FXLS8974CF, developed for the FXLS8974CF accelerometer. This project utilizes the FRDM-STBC-FNM03 multisensory board in combination with the FRDM-K22F Freedom Kinetis MCU board, and was created using the MCUXpresso IDE.
Hardware Setup
To ensure proper functionality, please configure the jumpers on the multisensory board as follows:
J5: 3–4 — Powers the FXLS8974CF sensor
J9: 1–2 — Enables Motion Detection mode
J10: 1-2 — If BT_MODE=VDD (J9: 1-2) must be populated
All other jumpers can remain open
Project Functionality
The K22F MCU continuously reads the following registers from the FXLS8974CF sensor in an infinite loop:
OUT_X_LSB, OUT_X_MSB
OUT_Y_LSB, OUT_Y_MSB
OUT_Z_LSB, OUT_Z_MSB
The raw data is first stored in the g_master_rxBuff array, then parsed into the accelX, accelY, and accelZ variables.
To convert the raw data into acceleration values (in g), divide each value by the nominal sensitivity of 512, which corresponds to the default ±4g measurement range.
Building and Debugging
Once the project is imported into MCUXpresso IDE, follow these steps:
1. Clean and Build the project
2. Debug the project as LinkServer and Run the application
3. View the raw and/or processed acceleration values in the Global Variables Window
Data Visualization with FreeMASTER
To visualize the accelerometer data using FreeMASTER, follow these steps:
Download and launch the latest version of FreeMASTER
Terminate the debug session in MCUXpresso IDE
Ensure the FRDM-STBC-FNM03 + FRDM-K22F kit is still connected to your PC
In FreeMASTER, open the Connection Wizard and configure as follows:
Select “Connect through a debugger probe or on-board debugger interface”
Choose “CMSIS-DAP compliant interface from ARM”
Select “Direct access to target microcontroller memory”
Click “Plug-in Configuration”
9. Test the connection. If successful, click OK twice and then Finish
10. Click “Open an Existing Project” and locate the Project.pmpx file in your MCUXpresso workspace
Now you can observe live accelerometer data in the FreeMASTER Oscilloscope or Variable Watch Window.
Attached are: FRDM-STBC-FNM03 multisensory board GERBER files and BOM, and Project for the KIT.
Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable law. NXP accepts no liability for any assistance with applications or product design. Materials may only be used in connection with NXP products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.
View full article