Developing with the SANPO Firmware
This option retains the existing USB/SPI-to-CAN/RS485 functions while allowing you to add I2C, ADC, UART, and other sensor peripherals.
If you need to reimplement CAN, RS485, or the complete communication path, use Developing Custom Firmware.
Choose a Development Tool
The same V47 development framework is available for two toolchains:
Tool |
Project |
|---|---|
STM32CubeIDE |
|
Keil 5 |
Both projects retain the same V47 communication functions and expose the same customer extension entry points. Choose one toolchain. Do not mix static libraries or project settings between the two versions.
Functions You Can Add
Function |
Pins and peripheral |
Typical uses |
|---|---|---|
Expansion UART |
USART3, PD8/TX and PD9/RX |
Remote controls, radio modules, external controllers, and custom commands |
I2C |
I2C2, PB10/SCL and PB11/SDA |
Attitude, temperature, pressure, and other sensors |
Analog inputs |
PB0/ADC1 IN8 and PB1/ADC2 IN9 |
Voltage, pressure, and other analog signals |
Background processing |
Customer task entry point |
Status checks, data processing, and simple control logic |
USB, SocketCAN, external SPI, CAN, and RS485 are already integrated and normally do not need to be changed.
Customer Code Location
Customer functions are located in:
CustomerApp/
Common files:
CustomerApp/Src/customer_protocol.c: add custom UART commands and protocol parsing.CustomerApp/Src/customer_app.c: connect UART3, I2C, ADC, and background processing.CustomerApp/Inc/: add customer-facing interfaces.
The default example replies to PING, PING\r\n, or PING\n received on USART3 with:
PONG\r\n
USART3 defaults to 115200-8-N-1. Verify PING/PONG before adding your device.
STM32CubeIDE
Install STM32CubeIDE.
Select
File > Import > Existing Projects into Workspace.Import
stm32f407V4_with_socketcan.Select the
Releaseconfiguration, then run Clean and Build.Program and verify with ST-LINK, then restart the board.
The SANPO communication library is:
Libs/libloop_function_v4.a
Keil 5
The Keil project requires:
Keil MDK 5.43 or later;
Arm Compiler 6.24;
Keil::STM32F4xx_DFP3.1.1;ST-LINK.
Open:
stm32f407V4_with_socketcan_keil/MDK-ARM/spine_v4_v47_keil.uvprojx
Select V47 Release and press F7. A normal build reports 0 Error(s), 0 Warning(s).
The Keil communication library is:
Libs/libloop_function_v4_keil.lib
Do not switch this project to Arm Compiler 5, and do not use the GCC library from the STM32CubeIDE project.
Programming and Saved Data
The two STM32 devices use the same development project and pin configuration. If both sides need the same function, program the same build through the two SWD connectors.
Use program and verify. Do not perform a full-chip erase. Keep the application within 0x08000000 to 0x0801FFFF so it does not overwrite the Flash area used for communication settings and offline tasks. See Firmware Update.
Do Not Regenerate Code from an IOC
These release projects are not blank CubeMX templates:
The release packages do not include
.iocor.mxprojectfiles.Do not run
Generate Code.Do not replace USB, SPI, CAN, RS485, FreeRTOS, or the static library.
Do not reassign pins used by the SANPO communication functions.
If you need unrestricted IOC and communication-interface changes, start from a project in Developing Custom Firmware.
Acceptance Checks After a Change
At minimum, verify:
The project builds without errors or warnings.
AT+VER\r\nover USB returnsV47\r\n.PING\r\nover USART3 returnsPONG\r\n.The SANPO USB protocol and SocketCAN work.
The SPI protocol works.
Both CAN and both RS485 channels can transmit and receive.
Added UART, I2C, ADC, or sensor functions work.
Saved communication settings remain after a power cycle.