In order to debug the Pixie Flight Controller I needed to at least create an adapter that breaks out the SWD pins on the expansion port to a debugger. Instead of doing that I decided to create a custom debug board that would both debug the Pixie and serve as a compact and easy to use debugger for other projects.
In the past I've used several JTAG probes. More recently I started using STM32 discovery boards for SWD debugging. The discovery boards work well, but they're pretty bulky for their purpose, so I've been looking for a more compact alternative. I tried several of the small st-link compatible adapters on ebay. They generally work, but I've had some issues with them, and who knows where the firmware comes from.
Recently I ran across the Black Magic Probe. This is both an open source software and hardware project that supports debugging STM32 as well as other Cortex MCUs. Unlike most other debuggers, it doesn't require any external software, such as OpenOCD, etc, because it implements the GDB extended remote interface in the firmware. It presents two CDC serial ports, one of which is the GDB interface, and the other is a direct link to an on-board UART. This allows one to connect GDB directly to the first CDC serial port for flashing firmware and debugging, and connect a terminal program to the other for debug output, etc. I find it to be very elegant.
You can buy an official Black Magic Probe from several distributors, but I decided to try it out by trying to flash the firmware to one of the many st-link clones that I bought on Ebay. It turns out that it is very easy to port to most any STM32 device, and it actually works pretty well on the Ebay clones. I may document how to do that in a later post, but it's probably easier to just buy an official Black Magic Probe, especially if you don't already have one of the st-link clones.
After trying out the BMP firmware I decided that it wouldn't be very hard to just build a debug board similar to the BMP that would connect directly to the Pixie, and could be used in other projects as a small debugger. That's where Pixie Debug came from.
In the past I've used several JTAG probes. More recently I started using STM32 discovery boards for SWD debugging. The discovery boards work well, but they're pretty bulky for their purpose, so I've been looking for a more compact alternative. I tried several of the small st-link compatible adapters on ebay. They generally work, but I've had some issues with them, and who knows where the firmware comes from.
Recently I ran across the Black Magic Probe. This is both an open source software and hardware project that supports debugging STM32 as well as other Cortex MCUs. Unlike most other debuggers, it doesn't require any external software, such as OpenOCD, etc, because it implements the GDB extended remote interface in the firmware. It presents two CDC serial ports, one of which is the GDB interface, and the other is a direct link to an on-board UART. This allows one to connect GDB directly to the first CDC serial port for flashing firmware and debugging, and connect a terminal program to the other for debug output, etc. I find it to be very elegant.
You can buy an official Black Magic Probe from several distributors, but I decided to try it out by trying to flash the firmware to one of the many st-link clones that I bought on Ebay. It turns out that it is very easy to port to most any STM32 device, and it actually works pretty well on the Ebay clones. I may document how to do that in a later post, but it's probably easier to just buy an official Black Magic Probe, especially if you don't already have one of the st-link clones.
After trying out the BMP firmware I decided that it wouldn't be very hard to just build a debug board similar to the BMP that would connect directly to the Pixie, and could be used in other projects as a small debugger. That's where Pixie Debug came from.
Above you can see a picture of the top side of the Pixie Debug board. It contains:
The bottom of the board is essentially empty, so it's a one-sided board.
- STM32F103 MCU
- UART1 (can be passes through to USB serial interface).
- USB interface
- Standard 0.05" JTAG connector
- An SWD port for connecting to boards other than the Pixie.
- Pixie expansion port that connects to SWD and USART6 on Pixie. It also connects to the SPI, which could be useful for something.
- 4 LEDs
The bottom of the board is essentially empty, so it's a one-sided board.
The schematic is very similar to the original Black Magic Probe, with the addition of the Pixie expansion header, etc. I made the form factor the same as the Pixie both because it was easy, and as a first test of using the expansion header. The next version will likely be a more conversational form factor with 0.1" headers.
I am very happy with the Black Magic Probe firmware, and would recommend it to anyone who normally uses GDB to debug and develops for the supported MCUs.
I am very happy with the Black Magic Probe firmware, and would recommend it to anyone who normally uses GDB to debug and develops for the supported MCUs.