diodep / ch55x_jtag

CH55x USB to JTAG bridge
125 stars 34 forks source link

bitbang commands #6

Open kimstik opened 3 years ago

kimstik commented 3 years ago

It seems that commands 0x80-0x83 not usable

kimstik commented 3 years ago

What is more - genuine chip answer to commands like 0x80 with empty USB packet.

diodep commented 3 years ago

Yep, I haven't implemented bitbang commands since Gowin Programmer doesn't take effort on it.

kimstik commented 3 years ago

Is it supposed to be used with non-"Gowin Programmer" tools? Something like OpenOCD

diodep commented 3 years ago

Is it supposed to be used with non-"Gowin Programmer" tools? Something like OpenOCD

I tried use it to debug RISC-V core with OpenOCD and it works fine.

ololoshka2871 commented 1 year ago

I tried use it to debug RISC-V core with OpenOCD and it works fine.

I'm using this board and found, it uses your project as a USB-JTAG+UART bridge. I am trying to connect internal Cortex-M3's JTAG to FPGA pins (like there) and debug it! So, could you please provide an example of configuring the OpenOCD transport? There are many ftdi configurations in openocd/scripts/interface/ftdi, but I have no idea how to modify them.

ololoshka2871 commented 1 year ago

I found that openocd 0.12 already implements gowin chip connection as FPGA, so I created the following config for openocd to connect ARM Cortex-M3 core based on it and config for STM32F1x:

gdb_port 2331
telnet_port 2332

# from board/gowin_runber.cfg
adapter driver ftdi
ftdi vid_pid 0x0403 0x6010

ftdi channel 0
ftdi layout_init 0x0008 0x008b
reset_config none
transport select jtag
adapter speed 2000

# from ld script
# RAM size
set WORKAREASIZE 0x4000 
# ROM size
set FLASH_SIZE 0x8000

# from stm32f1x.cfg
source [find target/swj-dp.tcl]
source [find mem_helper.tcl]

set _ENDIAN little

# from scan results
set CPUTAPID 0x4ba00477

set _CHIPNAME gowinarm

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $CPUTAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap

image image