2025-09-02 2:22 AM - last edited on 2025-10-13 7:39 AM by Amel NASRI
Hello everyone.
I'm a beginner to STM32 and STWIN.
I'm experimenting with the DATALOG2 firmware on STWIN.
My question is about customizing this firmware.
What I want to do is keep the DATALOG2 functionality as-is, but add an extra feature: when the accelerometer value exceeds a certain threshold, output a High signal on a GPIO pin or turn on an LED.
(I couldn't find any GPIO pins in the STWIN schematic!)
STEVAL-STWINKT1
https://www.st.com/en/evaluation-tools/steval-stwinkt1.html
The firmware is here.
GitHub : FP-SNS-DATALOG2 Firmware Package
https://github.com/STMicroelectronics/fp-sns-datalog2
Since my development environment is STM32CubeIDE, should I open the .project file within the following STM32CubeIDE directory in the GitHub using CubeIDE and modify the source code there?
2025-12-24 1:58 AM
Hi @Imu ,
Welcome to STM32 and STWIN development. Regarding your question about customizing the DATALOG2 firmware on the STEVAL-STWINKT1 board, you can indeed maintain the existing functionality while adding a feature to monitor accelerometer values and trigger a GPIO output or LED when a specified threshold is exceeded.
Since you are using STM32CubeIDE, the correct approach is to open the .project file located in the STM32CubeIDE directory within the GitHub repository you referenced. This will allow you to load, modify, and build the firmware within your development environment.
To implement your feature, you should locate the section of the firmware where accelerometer data is processed and add code to compare the accelerometer readings against your threshold. Upon exceeding the threshold, you can utilize the HAL GPIO functions such as HAL_GPIO_WritePin() to control the desired pin or LED.
Remember to configure and initialize the GPIO pin properly in the MX_GPIO_Init() function to ensure correct operation.
2025-12-24 6:21 AM
You can customize DATALOG2 without breaking existing features. Open the STM32CubeIDE project here:
Projects/STM32L4R9ZI-STWIN/Applications/DATALOG2/STM32CubeIDE
Import it into STM32CubeIDE and build once. The STWIN has onboard LEDs. Use BSP_LED_Init() and BSP_LED_On() to control them. No extra GPIO configuration is needed for LEDs. Insert your accelerometer threshold logic in datalog_application.c. Compute magnitude with sqrt(x*x + y*y + z*z). Compare it to your threshold. Turn on an LED when exceeded. This keeps DATALOG2 fully functional.
If you later want external GPIOs, check the STMOD+ connector. Expansion pins are available but shared. For reference, see this STM32 dev board project . It’s helpful for learning STM32 hardware design. This approach avoids unnecessary CubeMX changes and keeps firmware simple.