Programming
STM32 Open IoT and IIoT Gateways (P10 - P12)
Install IDE & Programmer
Download and install STM32CubeIDE for ability to creating own programs. For device programming, you must install STM32CubeProgrammer. Follow the instructions located on the producer's site. Software is available on Windows, Linux and macOS. Of course, there is a possibility of using other IDEs, but Cube is dedicated to STM32 MCUs and provides a lot of compatible libraries.
Connect the programmer
STM32 IoT and IIoT Gateways can be programmed only with the MCU producer's external hardware programmer - ST LINK - connected via the Tag-Connect connector to the board. After connecting it to the board and a PC, the device should be available in Device Manager as STM32 STLink in Universal Serial Bus devices.
Connect the power supply
The gateway works with 12-30V DC power supplies. Make sure your supply is properly set.
Create your own programs
After all of the above steps are done, the device should be ready to be programmed.
Build, flash and monitor the device
There are two options for building your program.
STM32CubeIDE
Right click on your project and choose Debug As -> STM32 C/C++ Application. It should generate the .elf file in the Debug folder in the project.
CMake
The project can also be built in STM32CubeIDE via CMake. For more information and instructions check the producer's instructions.
Flash
There are two ways to flash the device.
STM32CubeProgrammer
It is the most recommended to use Programmer.
Open the software and connect it to the ST-Link programmer.
After successful connect you should see the device memory with addresses on the screen.
Click on the down-arrow on the left side of the screen and browse for your file path.
Find the .elf file (it should always be generated in the Debug folder in your project's path).
Click "Open".
Click "Start Programming".
If programming have been done successfully, you should see on the screen some messages in pop-up windows and Log console.
The Gateway has been programmed.
Flashing in IDE
It is possible to flash your program directly from STM32CubeIDE. However, this method works only with some simple, small projects without using CMake. Just click on the icon in the IDE, and after a few seconds, the device should be programmed. If it doesn't work, use the previous method.
Monitoring
You can connect the device to your computer using a console and Serial connection. To do so, you need two USB cables and a USB -> UART Converter (for example, C37).
If the connection is correct, the device will be visible as a USB Serial Port (COMx/ttyUSB). You can use any console terminal with the Serial option. The baudrate depends on USB UART settings in the project.