Run a neural network model on an STM32L4 Discovery board
Introduction
Prepare development environment
Collect training data
Train the model
Feature extraction
Run the model on development board
Next Steps
Run a neural network model on an STM32L4 Discovery board
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Jupyter shows
In[*] while a cell is running. When complete, it changes to In[N], where N is the execution count.You’ll collect accelerometer data from the STM32 board and save it as CSV files. The notebook discovers these CSV files from the
samples_dir location and loads them for training.The example model uses an input shape of (3, stride), representing three accelerometer axes over a time window. Labels are one-hot encoded using
tf.keras.utils.to_categorical with the class count derived from the unique labels.The process computes the mean and standard deviation for each accelerometer axis and saves these as features. You then train a model on these feature vectors instead of the raw time-series samples.
Use the Board Selector to choose the B-L475E-IOT01A board, then set the project name and location in Project Manager. Import the trained model using STM32Cube.AI within STM32CubeMX, and continue with Pinout & Configuration.