dirtyjtag / DirtyJTAG

JTAG probe firmware
MIT License
464 stars 70 forks source link

Port to stm32f072 #81

Closed madushan1000 closed 3 years ago

madushan1000 commented 3 years ago

Most of the jlink ob clones on aliexpress comes with this chip. As far as I could see, these clones have 4 3V tolerant pins, and 2 5V tolerant pins for VCOM. There also seems to be a hardwired reset pin too. I think this document has the correct pinmap(https://github.com/idrnyu/dllGetSt072JlinkOb/blob/master/%E7%94%B5%E8%B7%AF072%E6%B3%A8%E6%84%8F.txt)

I'm wondering if it would be possible to port dirtyjtag to this chip, it supports usb dfu too.

zoobab commented 3 years ago

Jlink has many hardware revisions (v9, v10.4, etc...), do you have any documentation (photo of the PCB?) on which hardware revision has this stm32f072?

I think I also have this Nucleo board in my stock: https://www.st.com/en/evaluation-tools/nucleo-f072rb.html

madushan1000 commented 3 years ago

The chip is used in jlink "on board" clones, It's a simple jlink firmware with only swd + vcom support. I don't think it has any particular hardware revision. 1) https://www.segger.com/products/debug-probes/j-link/models/j-link-ob/ 2) https://www.segger.com/downloads/jlink/UM08024_JLinkOBSTM32F072.pdf

I think this is at least a partial schematic(header pinout is a little different).

I'll get a photo of the pcb when I have some time.

madushan1000 commented 3 years ago

Also, the jlink firmware requires that the pinout to be a certain way. so most of these clones have the bellow pinout. So I don't think the proper schematic is strictly required.

PA0 ----- 1K -----|<|---+ 3.3V   Activity LED 
PA1 ----- 100 om ----TARGET RESET 
PA2 ----- 100 om ---- TARGET SWCLK 
PA3 -------------------- TARGET SWO 
PA4 ----- 100 om ---- TARGET SWDIO 

PA9 ----- 100 om ---- (COM TX) TARGET RX 
PA10 --- 100 om ---- (COM RX) TARGET TX 
jeanthom commented 3 years ago

I wouldn't bother porting to J-Link hardware clones, it's so hard to purchase a specific hardware revision with the right MCU... But otherwise porting DirtyJTAG to STM32F0 should be feasible. You'd have to edit the Makefile to enable STM32F0 builds for unicore-mx, change at least two compiler flags (-DSTM32F1 and -mcpu), and edit the frequency definition macro.

The only thing I own that has an STM32F072 is my soldering iron, and I'm not sure that it would be useful at all to port DirtyJTAG on it :laughing:

EDIT/ Oh I thought you were refering to the crappy black J-Link clones with the pinout written in white. Do you mind taking a picture of the internals of the model you own? If there are level translators on it, I might be interested.

madushan1000 commented 3 years ago

If it would be that easy, I can give it a try myself. The only problem is getting the clone into dfu mode. the clearance between pins are so tiny I'm not sure if I'd short something. I'll get you some pictures in a couple of hours.

madushan1000 commented 3 years ago

Looks like no level shifters :/ image image image

jeanthom commented 3 years ago

Ah that's sad... You might be able to reprogram these using the P1 connector.

zoobab commented 3 years ago

You could try to flash via the P1 connector, if you don't have an stlinkv2, maybe use a usb-serial adaptor like documented.

madushan1000 commented 3 years ago

These chips has usb dfu, I'm wondering if I can get that to work. I don't have a jtag/swd/uart adapter handy at the moment.

jeanthom commented 3 years ago

I'm closing this issue because I'm not interested in STM32F0 support at the moment. Feel free to reopen this issue if you are willing to take the challenge ;)