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
JozefKozon_0-1753170296868.png
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.
JozefKozon_1-1753170360967.png
Building and Debugging
Once the project is imported into MCUXpresso IDE, follow these steps:
1. Clean and Build the project
JozefKozon_4-1753170541423.png
2. Debug the project as LinkServer and Run the application
JozefKozon_5-1753170604928.png
3. View the raw and/or processed acceleration values in the Global Variables Window
JozefKozon_6-1753170645147.png
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 JozefKozon_7-1753170673844.png
Ensure the FRDM-STBC-FNM03 + FRDM-K22F kit is still connected to your PC
In FreeMASTER, open the Connection Wizard and configure as follows: JozefKozon_8-1753170722467.png
Select “Connect through a debugger probe or on-board debugger interface” JozefKozon_9-1753170786560.png
Choose “CMSIS-DAP compliant interface from ARM” JozefKozon_10-1753170827773.png
Select “Direct access to target microcontroller memory” JozefKozon_12-1753170872821.png
Click “Plug-in Configuration”
JozefKozon_15-1753170953565.png
9. Test the connection. If successful, click OK twice and then Finish
JozefKozon_16-1753171002895.png
JozefKozon_17-1753171025192.png
10. Click “Open an Existing Project” and locate the Project.pmpx file in your MCUXpresso workspace
JozefKozon_18-1753171089918.png
JozefKozon_19-1753171108823.png
Now you can observe live accelerometer data in the FreeMASTER Oscilloscope or Variable Watch Window.
JozefKozon_20-1753171149799.png
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.
記事全体を表示