Deploy the example to your STM32F7
In the previous section of this guide, we explained the build process for a keyword spotting example application.
Now that the build has completed, we look in this section of the guide at how to deploy the binary to the STM32F7 and test to see if it works.
First, plug in your STM32F7 board via USB. The board should show up on your machine as a USB mass storage device. Copy the binary file that we built earlier to the USB storage.
If you have skipped the previous steps, download the binary file to proceed.
Use the following command:
cp ./BUILD/DISCO_F746NG/GCC_ARM/mbed.bin /Volumes/DIS_F746NG/
Depending on your platform, the exact copy command and paths can vary. When you have copied the file, the LEDs on the board should start flashing, and the board eventually reboots with the sample program running.
Test keyword spotting
The program outputs recognition results to its serial port. To see the output of the program, we must establish a serial connection with the board at 9600 baud.
The USB UART of the board shows up as
/dev/tty.usbmodemXXXXXXX. We can use ‘screen’ to access the serial console. Although ‘screen’ is not installed on Linux by default, you can use
apt-get install screen to install the package.
Run the following command in a separate terminal:
screen /dev/tty.usbmodemXXXXXX 9600
Try saying the word “yes” several times. You should see some output like the following:
Heard yes (208) @116448ms
Heard unknown (241) @117984ms
Heard no (201) @124992ms
The LCD displays "Heard yes!", as you can see in the following image:
Congratulations! You are now running a machine learning model that can recognize keywords on an Arm Cortex-M7 microcontroller, directly on your STM32F7.
It is easy to change the behavior of our program, but is it difficult to modify the machine learning model itself? The answer is no, and the next section of this guide, Retrain the machine learning model, will show you how.