CuVoodoo

the sorcery of copper

User Tools

Site Tools


jtag

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
jtag [2017/04/25 14:04] – [ST-LINK V2 aluminium] kingkevinjtag [2017/09/06 14:14] – [Black Magic Probe] kingkevin
Line 135: Line 135:
 {{:jtag:st-link_v2_baite.svg?0x100|pinout}} {{:jtag:st-link_v2_baite.svg?0x100|pinout}}
  
-I've also reversed the board layout to get the {{:jtag:baite_schematic.pdf|schematic}}.+I've also reversed the board layout to get the {{:jtag:baite.pdf|schematic}}.
 The connector pins are all protected with 220 ohms resistors. The connector pins are all protected with 220 ohms resistors.
  
Line 159: Line 159:
   * the ARM Cortex SWJ connector uses a small header (not very dupont-wire friendly)   * the ARM Cortex SWJ connector uses a small header (not very dupont-wire friendly)
   * the separate UART is not always populated (UART is also available on the SWJ connector)   * the separate UART is not always populated (UART is also available on the SWJ connector)
-  * it is quite expensive (> $50) +  * it is expensive (> $50), but this price is quite reasonable since it help supporting the project 
-  * it is always sold out (and V2.1 on pre-order will take a bit of time until it is available)+  * it was sold out for quite some time, encouraging me to look for an alternative
  
-But because the firmware is open source it is possible to port it to other hardware, and [[https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware|people already did it]].\\+Because the firmware is open source it is possible to port it to other hardware, and [[https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware|people already did it]].\\
 It has been [[https://medium.com/@paramaggarwal/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c|ported]] on the [[stm32f1xx#blue_pill|blue pill]], but I don't find this board as handy as a dongle.\\ It has been [[https://medium.com/@paramaggarwal/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c|ported]] on the [[stm32f1xx#blue_pill|blue pill]], but I don't find this board as handy as a dongle.\\
 It has also been [[http://blog.linuxbits.io/2016/02/15/cheap-chinese-st-link-v-2-programmer-converted-to-black-magic-probe-debugger/|ported]] to the [[#st-link_v2_aluminium|ST-Link V2 clone]], but then there is no additional UART anymore.\\ It has also been [[http://blog.linuxbits.io/2016/02/15/cheap-chinese-st-link-v-2-programmer-converted-to-black-magic-probe-debugger/|ported]] to the [[#st-link_v2_aluminium|ST-Link V2 clone]], but then there is no additional UART anymore.\\
Line 168: Line 168:
 This has less power pins (who needs 2xGND, 2x5V, 3x3.3V anyway), but provides enough function pins to add UART (and SRST). This has less power pins (who needs 2xGND, 2x5V, 3x3.3V anyway), but provides enough function pins to add UART (and SRST).
  
-To build the firmware ([[https://sourceforge.net/p/blackmagicdebug/mailman/message/35762464/|patch]] integration pending):+To build the firmware ([[https://github.com/blacksphere/blackmagic/pull/274|patch]] integration pending):
 <code bash> <code bash>
-git clone https://github.com/blacksphere/blackmagic+git clone https://github.com/tsaitgaist/blackmagic.git
 cd blackmagic cd blackmagic
 git submodule init git submodule init
 git submodule update git submodule update
-wget -O 0001-add-new-platform-Baite-ST-Link-V2-clone.patch "https://sourceforge.net/p/blackmagicdebug/mailman/attachment/20170401092652.GA15475%40coil/1/" +git checkout baite-platform 
-patch -p1 < 0001-add-new-platform-Baite-ST-Link-V2-clone.patch+# if you are usgin GCC >= 7 
 +git cherry-pick 2ebcffa2a4911090b43c36594dae6b58d4bb2f27
 make make
 cd src cd src
Line 182: Line 183:
 </code> </code>
  
-First we need to re-program the Baite dongle.\\ +Now we need to re-flash the Baite dongle.\\ 
-As you can see on the {{:jtag:baite_schematic.pdf|schematic}} the JTAG and SWD pins of the micro-controller are not connected (there even are no pads on the board for the pins to be soldered on).+As you can see on the {{:jtag:baite.pdf|schematic}} the JTAG and SWD pins of the micro-controller are not connected (there even are no pads on the board for the pins to be soldered on).
 But on the back of the board you can find test points so to program the device using the serial bootloader: But on the back of the board you can find test points so to program the device using the serial bootloader:
  
Line 198: Line 199:
 To start the serial bootloader when powering the dongle you need to set BOOT0 high by connecting it to +3.3V or DTR (or any high signal present on the USB to UART converter). To start the serial bootloader when powering the dongle you need to set BOOT0 high by connecting it to +3.3V or DTR (or any high signal present on the USB to UART converter).
  
-To flash the Black Magic DFU bootloader I used [[https://sourceforge.net/p/stm32flash/wiki/Home/|stm32flash]].+To flash the Black Magic firmware I used [[https://sourceforge.net/p/stm32flash/wiki/Home/|stm32flash]].
 Since the flash is read/write protected you first need to clear these option bits. Since the flash is read/write protected you first need to clear these option bits.
  
Line 208: Line 209:
 # erase flash # erase flash
 stm32flash -o /dev/ttyUSB0 stm32flash -o /dev/ttyUSB0
-# flash DFU bootloader +# flash the DFU bootloader 
-stm32flash -w blackmagic/src/blackmagic_dfu.bin /dev/ttyUSB0+stm32flash -w src/blackmagic_dfu.bin -v /dev/ttyUSB0 
 +# flash the main firmware 
 +stm32flash -w src/blackmagic.bin -v -S 0x08002000 /dev/ttyUSB0
 </code> </code>
  
-Unplug and re-plug the Baite dongle and you should see the device in DFU bootlader mode. +Since this adapter is based on an STM32F103C8 micro-controller with 64 kB of flash the DFU bootloader only advertises 56 kB of flash available for the main application
-Flash the main application firmware using dfu-util: +Because the blackmagic firmware exceeds this size it will not be possible to flash it through if the DFU software doesn't ignore this restriction. 
-<code bash> +STM32F103C8 micro-controllers often have 128 kB of flash though, thus it is still possible to flash the blackmagic firmware using the serial bootloader (at address 0x08002000)
-dfu-util -d 1d50:6017 -s 0x08002000:leave -D blackmagic.bin +Verification during flashing ensured the whole firmware has been written successfully.
-</code>+
  
 Unplug and re-plug the Baite dongle. Unplug and re-plug the Baite dongle.
 The adapter should be running the main application and two USB CDC ACM ports will appear. The adapter should be running the main application and two USB CDC ACM ports will appear.
  
-You can re-flash the device from the main application using dfu-util:+You can re-flash the device from the main application using dfu-util (if you can bring dfu-util to ignore the size restriction):
 <code bash> <code bash>
 dfu-util -d 1d50:6018 -s 0x08002000:leave -D blackmagic.bin dfu-util -d 1d50:6018 -s 0x08002000:leave -D blackmagic.bin
 </code> </code>
- 
-or short RX to ground (pin 5 and 7) to force the DFU bootloader start when plugin in the dongle (in case the main application is buggy). 
  
 Here is the new "BMP Baite" {{ :jtag:bmp_baite.pdf |pinout}}: Here is the new "BMP Baite" {{ :jtag:bmp_baite.pdf |pinout}}:
jtag.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1