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 will 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.
Note: 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/
STM32F7 shows up as a new drive, for example, D. You can simply drag the generated binary at
.\BUILD\DISCO_F746NG\GCC_ARM-RELEASE\mbed.bin and drop it to the drive.
Depending on your platform, the exact copy command and paths may vary. When you have copied the file, the LEDs on the board should start flashing, and the board will eventually reboot 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 will need to establish a serial connection with the board at 9600 baud.
The board’s USB UART 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
Once you connect to the board, you will see any recognition results printed to the terminal.
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
Congratulations! You are now running a machine learning model that can recognize keywords on an Arm Cortex-M7 microcontroller, directly on your STM32F7.