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:07] kingkevinjtag [2018/02/04 12:14] – [Black Magic Probe] update DFU flashing information kingkevin
Line 68: Line 68:
 It comes in the same box, with the same cables, the enclosure is the same, even the board name has been taken over (MB936), but the board isn't the same. It comes in the same box, with the same cables, the enclosure is the same, even the board name has been taken over (MB936), but the board isn't the same.
 The BOM doesn't match with the [[http://www.st.com/resource/en/bill_of_materials/st-link_v2_bom.zip|original]].\\ The BOM doesn't match with the [[http://www.st.com/resource/en/bill_of_materials/st-link_v2_bom.zip|original]].\\
-The original adapter come with ESD protection, protection resistors, and a transceiver to allow operating with target signal levels of 1.65V to 5.5V.+The original adapter comes with ESD protection, protection resistors, and a transceiver to allow operating with target signal levels of 1.65V to 5.5V.
 This is completely missing on the clone since the connector pins are directly connected to the micro-controller. This is completely missing on the clone since the connector pins are directly connected to the micro-controller.
 Thus it only supports target signal levels of 3.3V and sometimes 5V since the pins are 5V tolerant. Thus it only supports target signal levels of 3.3V and sometimes 5V since the pins are 5V tolerant.
Line 130: Line 130:
 The [[http://betemcu.cn/|Baite]] [[https://www.aliexpress.com/store/product/Best-Quality-ST-Link-stlink-V2-for-STM8S-STM8L-STM32-Cortex-M0-Cortex-M3-SWIM-JTAG/213957_32676015777.html|ST-Link V2]] is my favorite clone since it supports JTAG, SWD, and SWIM (for STM8). The [[http://betemcu.cn/|Baite]] [[https://www.aliexpress.com/store/product/Best-Quality-ST-Link-stlink-V2-for-STM8S-STM8L-STM32-Cortex-M0-Cortex-M3-SWIM-JTAG/213957_32676015777.html|ST-Link V2]] is my favorite clone since it supports JTAG, SWD, and SWIM (for STM8).
  
-The seem to use the same board also for several other programmers, and since the pinout is not on the case I've decided to make my own sticker.+They seem to use the same board also for several other programmers, and since the pinout is not on the case I've decided to make my own sticker.
  
 {{:jtag:dsc02406.jpg?0x100|pinout sticker}} {{:jtag:dsc02406.jpg?0x100|pinout sticker}}
Line 141: Line 141:
 {{:jtag:baite-v2a-board_back.jpg?0x100|board front}} {{:jtag:baite-v2a-board_back.jpg?0x100|board front}}
  
-There is a newer version marked as "V2A" (under the crystal), but the {{:jtag:baite-v2a.pdf|schematic}} is pretty much the small with the following changes:+There is a newer version marked as "V2A" (under the crystal), but the {{:jtag:baite-v2a.pdf|schematic}} is pretty much the same with the following changes:
   * all pads for the micro-controller are present (there is even solder mask between them)   * all pads for the micro-controller are present (there is even solder mask between them)
   * they added a SWD port   * they added a SWD port
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 supports 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/" 
-patch -p1 < 0001-add-new-platform-Baite-ST-Link-V2-clone.patch 
 make make
 cd src cd src
Line 182: Line 180:
 </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.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 196:
 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 206:
 # 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 blackmagic_dfu.bin -v /dev/ttyUSB0 
-</code> +# flash the main firmware 
- +stm32flash -w blackmagic.bin --0x08002000 /dev/ttyUSB0
-Unplug and re-plug the Baite dongle and you should see the device in DFU bootlader mode. +
-Flash the main application firmware using dfu-util: +
-<code bash> +
-dfu-util -d 1d50:6017 -0x08002000:leave -D blackmagic.bin+
 </code> </code>
  
Line 221: Line 215:
 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 the DFU bootloader with:
 <code bash> <code bash>
-dfu-util -d 1d50:6018 -s 0x08002000:leave -D blackmagic.bin+python2 ../scripts/stm32_mem.py 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).+Note: 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. 
 +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 (i.e. ''dfu-util'')
 +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, with verification enbaled ot ensured the whole firmware has been written successfullyor ''stm32_mem''.
  
 Here is the new "BMP Baite" {{ :jtag:bmp_baite.pdf |pinout}}: Here is the new "BMP Baite" {{ :jtag:bmp_baite.pdf |pinout}}:
Line 243: Line 239:
 </code> </code>
 ===== Altera USB-Blaster ===== ===== Altera USB-Blaster =====
 +
 +{{ :jtag:dsc02418.jpg?0x150|device front}}
  
 The [[https://www.buyaltera.com/PartDetail?partId=1212940|USB-Blaster]] is from Altera. The [[https://www.buyaltera.com/PartDetail?partId=1212940|USB-Blaster]] is from Altera.
 It is often used to flash FPGA, but is a general purpose JTAG adapter. It is often used to flash FPGA, but is a general purpose JTAG adapter.
- 
-I have a cheap [[http://www.aliexpress.com/item/Free-shipping-New-Mini-Usb-Blaster-Cable-For-CPLD-FPGA-NIOS-JTAG-Altera-Programmer-in-stock/806527241.html|Rev.c clone]]. 
-The original uses FTDI FT245 and MAX CPLD chips. 
-This one uses a Silicon Labs C8051F321 micro-controller and a 74LVC125 quad buffer, but there are many other clone variants. 
- 
-{{:jtag:dsc02418.jpg?0x100|device front}} 
-{{:jtag:dsc02419.jpg?0x100|device back}} 
-{{:jtag:dsc02420.jpg?0x100|PCB front}} 
-{{:jtag:dsc02424.jpg?0x100|PCB back}} 
  
 :!: be aware that here the VCC{TARGET} pin has to be connected to a reference voltage used for the JTAG communication, generally provided by the target device on the board (often 3.3V or 1.8V). :!: be aware that here the VCC{TARGET} pin has to be connected to a reference voltage used for the JTAG communication, generally provided by the target device on the board (often 3.3V or 1.8V).
Line 267: Line 256:
 </code> </code>
  
-To be able to use it I had to recompile OpenOCD for the USB-Blaster to use libftdi (probable because it's a clone).+To be able to use it I had to recompile OpenOCD for the USB-Blaster to use libftdi (maybe because it's a clone).
 <code bash> <code bash>
 git clone http://git.code.sf.net/p/openocd/code openocd-code git clone http://git.code.sf.net/p/openocd/code openocd-code
Line 332: Line 321:
 </code> </code>
  
 +The original uses FTDI FT245 and MAX CPLD chips.
 +There are numerous clone variants, with various quality and voltage support.
 +
 +==== SiLabs USB-Blaster ====
 +
 +This one uses a Silicon Labs C8051F321 micro-controller and a 74LVC125 quad buffer (for signal voltages from 1.65 to 3.6 V).
 +
 +{{:jtag:mini_silabs_front.jpg?0x150|SiLabs USB-Blaster front}}
 +{{:jtag:mini_silabs_back.jpg?0x150|SiLabs USB-Blaster back}}
 +
 +==== PIC USB-Blaster ====
 +
 +This one uses a Microchip PIC18F14 micro-controller and has no buffer (thus only supporting 5 V signals).
 +
 +{{:jtag:mini_pic_front.jpg?0x150|PIC USB-Blaster front}}
 +{{:jtag:mini_pic_back.jpg?0x150|PIC USB-Blaster back}}
 +
 +==== ARMJISHU USB-Blaster ====
 +
 +This one uses a ST STM32F101 (as a STM32F103 with USB support) micro-controller and a 74HC244 octal-buffer (for signal voltages from 2.0 to 6.0 V).
 +
 +{{:jtag:mini_stm32_front.jpg?0x150|ARMJISHU USB-Blaster front}}
 +{{:jtag:mini_stm32_back.jpg?0x150|ARMJISHU USB-Blaster back}}
 +
 +I also reversed the {{:jtag:bus_blaster-stm32.pdf|schematic}}.
 +It shows that the hardware can also drive the signals (at 3.3 V) in case Vcc_target is not connected, and you can add an uSD card slot or SPI flash.
 +I don't know if these features are supported in software.
 +
 +{{:jtag:mini_stm32_front-board.jpg?0x150|ARMJISHU board USB-Blaster front}}
 +{{:jtag:mini_stm32_back-board.jpg?0x150|ARMJISHU board USB-Blaster back}}
 ===== SEGGER J-Link ===== ===== SEGGER J-Link =====
  
jtag.txt · Last modified: 2024/01/07 17:49 by 127.0.0.1