Answers to questions about programming the Lingdongwei MM32 MCU
[Copy link]
Some users who have just come into contact with MM32 MCU have encountered the situation that MCU cannot be downloaded, and then they reported to us that there is a problem with the chip. Finally, after follow-up by technical engineers, it was actually caused by user program usage errors or improper operation, not chip problems. If you encounter this situation, please don't worry. This article is specifically about how to solve the problem of failed programming and the possible reasons for this kind of problem.
There are many reasons why MM32 cannot be programmed. We analyze it from two aspects: hardware and software:
Hardware reasons:
1. The debugger used does not support debugging and downloading MM32 MCU, and the emulator selection/configuration on IAR/KEIL is incorrect. MM32 MCU has been officially certified by Segger. On the Segger official website, J-Link driver version 6.40 and above supports the MM32 MCU series. MM32 MCU supports MM32-Link, U-link, J-Link, DAP-Link, etc., using SWD/JTAG (M3) and other methods to access the core, peripherals, and FLASH.
2. The minimum system of MM32 MCU is incomplete, the reset circuit design is wrong, the MCU power supply is abnormal, etc., which will also cause the device to be unable to be recognized. MM32 MCU supports a wide voltage of 2.0-5.5v power supply. When users design their own product PCB, it is recommended that users reserve VCC, SWDIO, SWCLK, GND, and NRST five-wire download port mode. Please refer to the demo board for design when designing the circuit.
3. The two pins PA13 and PA14 of SWD are poorly soldered, the external hardware has pull-up or pull-down, and the connection with the debugger is incorrect or not connected.
Software reasons:
1. Program download error. MM32 MCU has five major series: F, L, SPIN, W, and P. For different MCUs, we have different libraries, startup files, and routines. Before downloading the program, please check whether your MCU version model corresponds to the program to be downloaded. For example, MM32F031C6T6 is divided into q version and n version. The two models have different clock domain configurations, so the program cannot be directly shared.
2. MCU is in read/write protection state. When MCU is in read protection state, FLASH space is in write protection state. At this time, SWD protocol cannot be used to access the kernel, peripherals, and FLASH, and download and debugging cannot be performed.
3. MCU is in low power state. When MCU is in different modes of low power state, the peripheral area of MCU will be in power-off state. The debugger recognizes that MCU is in power-off state and cannot download and debug.
4. The two pins PA13 and PA14 of SWD are reused as other functions or general IO. PA13 and PA14 are configured as other working modes. At this time, PA13 and PA14 cannot work normally in SWD mode, and the debugger cannot download and debug through SWD protocol.
5. Errors occur during program download. Errors occur during download due to reasons such as download speed and debugger version characteristics, causing MCU to enter HardFault state (program runaway), and download and debugging cannot be performed at this time.
|