Official Firmware Extension Development
Official firmware extension development is intended for users who need to retain the USB, SPI, CAN/CAN FD, RS485, SocketCAN, management-port protocol, and offline batch-command functions of the V82 release firmware while adding sensors, an extension UART, or customer application logic.
If you need to take full control of CAN, CAN FD, RS485, or the complete communication flow and do not need the V82 communication functions, use Custom Firmware Development.
Download the Framework
The V82 extension framework is provided as an STM32CubeIDE project:
Download the V82 official firmware extension framework
The project directory is:
sanpo_v8_g0b_hse_framework/
The production MCU is STM32G0B1RCT6 with an external 8 MHz crystal. The system clock and FDCAN kernel clock are both 60 MHz. The Release configuration has been build-tested with STM32CubeIDE 2.2.0. Use the same version, or a compatible version that you have validated.
Available Extension Resources
Function |
Pins and peripheral |
Typical use |
|---|---|---|
Extension UART |
USART3, PB10/TX and PB11/RX |
Remote controls, wireless modules, external controllers, and custom commands |
I²C |
I2C1, PA9/SCL and PA10/SDA |
Attitude, temperature, pressure, and other sensors |
Analog inputs |
PB0/ADC1 IN8 and PB1/ADC1 IN9 |
Voltage, pressure, and other analog signals |
Background processing |
|
Status checks, data processing, and customer application logic |
USB, external SPI, on-board SPI, CAN/CAN FD, RS485, and the official communication tasks are already integrated and normally do not need to be modified. See Interfaces and Pin Definitions for the complete pin assignment.
Customer Code Location
Customer code is located under:
CustomerApp/
The main files and entry points are:
CustomerApp/Src/customer_protocol.c: add USART3 commands, protocol parsing, and customer application processing;CustomerApp/Src/customer_app.c: framework entry points for USART3, I2C1, ADC1, and background tasks;CustomerApp/Inc/customer_app.h: customer tasks and USART3 transmit/statistics interfaces;CustomerApp/Inc/customer_protocol.h: customer protocol callback interfaces.
The default example returns the following response when USART3 receives PING, PING\n, or PING\r\n:
PONG\r\n
The default USART3 configuration is 115200-8-N-1. Verify PING/PONG first, then connect customer devices and add application code.
Using STM32CubeIDE
Install STM32CubeIDE and prepare an ST-LINK.
Select
File > Import > Existing Projects into Workspace.Import
sanpo_v8_g0b_hse_framework.Select the
Releaseconfiguration, then run Clean and Build.Use ST-LINK to program and verify the firmware, then power-cycle the board.
The official communication library is located at:
Libs/libloop_function_v8_g0.a
This static library is paired with the V82 release baseline. Do not replace the MCU, ABI, HAL, FreeRTOS, USB stack, static library, or linker script, and do not copy a communication library from another firmware version into this project.
Do Not Regenerate Code from an IOC File
This release project is not an empty CubeMX template:
the package does not include an
.iocfile;do not run CubeMX
Generate Code;do not reassign resources used by the official USB, SPI, CAN/CAN FD, RS485, or FreeRTOS implementation;
do not overwrite official communication tasks, USB descriptors, or the HAL callback chain;
place customer functions in
CustomerAppwhenever possible.
If you need to freely modify the IOC file, communication peripherals, or startup flow, use the direct-development projects in Custom Firmware Development.
Two MCUs and Firmware Space
The two STM32G0B1RCT6 MCUs on the board have identical models and pin assignments. If both sides require the same customer function, program the same image through both SWD connectors. Each MCU controls its local two CAN/CAN FD channels and two RS485 channels.
The project linker script limits the application Flash region to 112 KB. Do not enlarge this region or perform a full-chip erase, because doing so may overwrite stored device identity, authorization data, communication settings, or offline batch tasks. See Firmware Update for programming requirements.
Validation After Modification
At minimum, verify the following after every modification:
the Release configuration builds without errors;
AT+VER\r\non the management port returnsV82\r\n;PING\r\non USART3 returnsPONG\r\n;both USB transparent mode and protocol mode work;
SocketCAN, external SPI, and the management-port protocol work;
both CAN/CAN FD channels and both RS485 channels of the MCU can transmit and receive;
the added USART3, I2C1, ADC1, or sensor functions work;
channel mapping is correct when the two MCUs are programmed separately;
existing communication settings remain valid after a power cycle;
long-duration operation shows no unexpected reset, communication interruption, or significant frame loss.