APM32F402 is the latest M4 core 32-bit MCU from Geehy. Based on the peripheral specifications in the datasheet and the clock and peripheral register details in the user manual, the APM32F402 is compatible with the APM32F103xB series.
In other words, the APM32F402 is an upgraded version of the APM32F103 with an M4 core replacing the previous core. According to the CoreMark benchmark data from previous tests, there has been a significant improvement in performance and floating-point computation ability: APM32F402 CoreMark test - Geehy MCU official technical support forum.
Both ARM Cortex-M3 and Cortex-M4 cores belong to the ARM Cortex-M series microcontrollers, designed for embedded real-time control, featuring low power consumption, high code density, and efficient interrupt response. The following is an analysis of their core similarities, differences, and compatibility:
Similarities
Architecture Foundation
Both use Harvard bus architecture (separate instruction and data buses), support Thumb-2 instruction set, and are compatible with mixed 16-bit and 32-bit encoding to ensure high code efficiency.
Interrupt Mechanism
Both integrate Nested Vector Interrupt Controller (NVIC), supporting low-latency interrupt response and dynamic priority adjustment, meeting real-time control requirements.
Memory Management
Support unaligned data transfer (automatically split into aligned operations by hardware) and optionally include Memory Protection Unit (MPU) to enhance system security.
Differences
Computing Power
Cortex-M4 extends the M3 with DSP instruction sets (such as SIMD single instruction multiple data operations) and optional single-precision FPU, significantly improving digital signal processing and floating-point calculation efficiency.
Performance Optimization
M4 uses instruction pipeline optimization and hardware divider acceleration, resulting in a performance increase of 30%-50% over M3 in complex algorithm scenarios (such as filtering and FFT).
Application Positioning
M3 is suitable for basic real-time control (such as industrial sensors and motor drives), while M4 is geared towards scenarios requiring high computational density (such as audio processing and smart sensor fusion).
Compatibility
Cortex-M4 is designed to be downward compatible with M3’s instruction set and programming model:
Software Compatibility: Code written for M3 can run directly on M4, but if it involves the new DSP or FPU instructions of M4, it will not be backward compatible with M3.
Hardware Extension: M4 adds peripherals (like FPU) that need to be enabled via specific register configurations; when not used, the core behaves the same as M3.
In summary, Cortex-M4 can be viewed as a feature-enhanced version of M3. Both share a highly similar architecture, but M4 extends the instruction set and computational units to cover a broader range of high-performance applications.
According to relevant ARM references, M4 is basically compatible with M3. Next, we compare peripheral differences and attempt to run APM32F103 code directly on APM32F402.

Memory Map Comparison between APM32F402 and APM32F103

Interrupt Vector Comparison between APM32F402 and APM32F103
From the peripheral comparison, except for differences in USB and I2C2, the APM32F402 can be compatible with most peripherals of APM32F103. Additionally, it adds USB OTG, TMR8, CAN2, UART4, and TMR5.
APM32F402’s CAN1 and USB registers and interrupt vectors are separated, solving the issue of CAN and USB sharing. The CAN remains compatible with 103, but upgrading USB to USB OTG makes direct compatibility with 103 impossible—please notice.
Furthermore, based on clock configuration and peripheral registers, the APM32F402 is compatible in these aspects. Therefore, theoretically, APM32F402 can directly run APM32F103 code, even matching STM32F103 code.
Next, we start the testing.
Choose the example: APM32F10x_SDK_V1.8\Examples\ADC\ADC_DMA, which involves clocks, ADC, UART, and DMA, to preliminarily evaluate compatibility.
Implementation involves installing the APM32F402 PACK package, which can be downloaded from the official Geehy website or directly via KEIL online.

Then, connect the programmer to see if the chip ID can be recognized.

Check whether the Flash scatter loading file is correct.

Note that the SDK for APM32F103 does not include FPU configuration, so the Floating Point Hardware option in the project should be set to “Not Used” to avoid compilation errors.
Enable MicroLIB by checking the option.

After completing the project setup, it can be burned, simulated, and run, confirming that the code operates normally.

Simultaneously, observe the UART output and ADC sampling values.

All functions operate normally, indicating that APM32F402 can directly be compatible with APM32F103 code.