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/13 12:13] – [ST-LINK V2 aluminium] kingkevinjtag [2017/09/06 14:14] – [Black Magic Probe] kingkevin
Line 82: Line 82:
 One trick to get this ridiculously low price is to use STM32F101 micro-controllers. One trick to get this ridiculously low price is to use STM32F101 micro-controllers.
 Compared to the STM32F103 micro-controllers they offer less functionalities, like USB ... yet this is a USB dongle! Compared to the STM32F103 micro-controllers they offer less functionalities, like USB ... yet this is a USB dongle!
-Well this is because these micro-controllers use the same die, but if not all STM32F103 feature tests pass after production they get packages as STM32F101, and it seems that USB still works well enough.+Well this is because these micro-controllers use the same die, but if not all STM32F103 feature tests pass after production they get packages as STM32F101, but it seems that USB still works well enough.
 At least this is my guess. At least this is my guess.
-It would be interesting to check if the other STM32F103 peripherals normally not present on the STM32F101 work as well.\\+It would be interesting to check if the other STM32F103 peripherals normally not present on the STM32F101 work as well, but I wouldn't rely on these. 
 +After all, they are probably marked as STM32F101 for a good reason.\\
 Similarly the STM32F103C8 is only rated having 64 kB of flash because it didn't pass the flash test, compared to the 128 kB for the STM32F103CB, but they very often have more (you can verify by read/writing and check for errors). Similarly the STM32F103C8 is only rated having 64 kB of flash because it didn't pass the flash test, compared to the 128 kB for the STM32F103CB, but they very often have more (you can verify by read/writing and check for errors).
  
Line 110: Line 111:
 {{:jtag:reverse-gnd_internal-back.jpg?0x100|}} {{:jtag:reverse-gnd_internal-back.jpg?0x100|}}
  
-From the outside this looks very similar to the previous one, except that the connector pinout is very different (except for power).\\+From the outside this looks very similar to the previous one, except that the connector pinout is very different (except for power) and there is only one LED.\\
 No markings are on the board. No markings are on the board.
  
Line 134: 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 140: 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", 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 small 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 158: 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 167: 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 181: 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 197: 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 207: 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