📜 ⬆️ ⬇️

Debugger for a penny: do ST-Link from Maple Mini



Having started my acquaintance with STM32 with Chinese clones of Leaf Maple Mini (because the cheapest option is $ 4), I was inconvenienced. Since you should not count on Maple IDE, it means that you have to work with the “bare” STM32. And since I don’t have ST-Link, I can only upload the program via UART, which is inconvenient (and there is no debugging capability).

But the hambrayuzer imwode exactly 9 hours after my publication wrote a response material from which I learned the great: the ST-Link debugger is based on the same STM microcontroller. At the same time, the firmware debugger firmware is pulled out and ready to be loaded onto non-native devices. Maple Mini fits perfectly: nothing superfluous, USB is soldered, you just need to connect a few resistors.
')

It is necessary :

1. Connect PA5 and PB13 (D6 and D30 at Maple Mini). This will be the SWCLK line.
2. Between PB14 and PB12 (D29 and D31) put a resistor of 220 Ohms. PB14 (D29) is the SWDIO line.
3. PA0 (D11) to connect to the divider of two 4.7 kΩ resistors between + 3.3V and GND.

And here, too, rake!

After the firmware, in theory, the PC should recognize the board as ST-Link. But no. As if nothing is connected at all. It took a certain amount of time to search for the rake, and all that was needed was to take a closer look at the Maple Mini scheme, and specifically on the implementation of the USB D + line. It pulls up to + 3.3V through a resistor of 1.5 KΩ, but the tightening is activated with a transistor switch. Which is controlled from the MK leg and is turned off by default. And if so, the PC simply does not understand what is connected to the USB port. We will not interfere with the board, but simply “hang” another 1.5 KΩ resistor between + 3.3V and D + (D23).

Now we have a ST-Link device. We put ST-Link Utility, there and the driver is available. We update the firmware of our ST-Link (through this same Utility), and you can start working with a debugger. At least, I connected the second Maple Mini to it: SWCLK to PA14 (D21), SWDIO to PA13 (D22) and successfully filled both the compiled Blink and made it debug using Coocox.

In principle, the device can already be equipped with a normal connector and stuffed into the case. Not forgetting to obtain before this “normal” resistors, and not something that turned up at hand. Does not interfere with any LED display. I think many home-made builders will confirm that the transition from “matches, acorns, blue electrical tape” to the finished device is the most difficult and lengthy, because “why, it works anyway, even though the wires stick in all directions”.

And, yes, the Chinese ST-Link can be bought for the same $ 4 on Aliexpress, for example .

The underlying theme of Easyelectionics.
Firmware (also Easyelectronics).
Leaf Maple Mini Description
ST-Link Utility
Manual on the "native" ST-Link

Source: https://habr.com/ru/post/247275/


All Articles