Compatibility of common peripherals of CH32F103 and STM32 peripheral programs
[Copy link]
1. Test the compatibility of common peripheral programs by replacing CH32F103 with stm32F103
Because the maximum flash of CH32F103 series is only 64k, it is benchmarked against the medium-capacity MCU Stm32F103. However, the flash sector of CH32F103 is only 1K, so it is necessary to modify the flash-related operations. In addition, CH32F103 does not have timer 5. If timer 5 is used, it needs to be modified. In general, CH32f103 is a combination of the medium-capacity stm32F103 series and the interconnected Stm32F105. The CH32F103 flash burning algorithm is inconsistent with the STM32f103 burning algorithm, so it cannot be directly burned using the keil stm32 project. The burning algorithm needs to be configured to CH32F1xx flash.
Directly modify the original stm32 project, change the flash address and sector to 1k, burn it into the board for testing, and the result is that IIC cannot work properly, but other peripherals can work properly. Using an oscilloscope to capture packets for analysis, it is concluded that if there is data on the bus before the CH32IIC peripheral is initialized, then CH32IIC will enter the BUSY state, stuck and unable to operate, otherwise it can work normally. After some changes, IIC finally ran successfully, and the peripheral compatibility table is shown below.
2. In general, the program compatibility is very good. The STM32 project used has not been transplanted. The only difference is IIC, but it is not a big problem. The disadvantage is that the flash is too small, and the program burning algorithm is not compatible with STM32. If it is mass-produced, another burner will be needed. The compatibility test ends here. The rest is to bake the machine to see how stable and consistent this chip is.
|