Using Jlink Edu / JTAG with Visionfive 2

Hi,
I am interested in bare metal programming of the board.

I can confirm that a jlink edu can work with the Visionfive 2.

Firstly I want to thank everyone out there for sharing info that helped me to get this working.

Here is what I did to get it to work:

  1. created a file called myscript that contained:

int InitTarget(void) {
//
// TDI → TAP_#1 → TAP_#0 → TDO
//
// TAP_#0 info:
// IRLen: 5
// TAPId: 0xDEB11001
//
// TAP_#1 info:
// IRLen: 5
// TAPId: 0x20000913
//
//
// Code to connect to TAP_#1
//
JLINK_JTAG_DRPre = 1;
JLINK_JTAG_DRPost = 0;
JLINK_JTAG_IRPre = 5;
JLINK_JTAG_IRPost = 0;
JLINK_JTAG_IRLen = 5;
JLINK_JTAG_SetDeviceId(0, 0xDEB11001);
JLINK_JTAG_SetDeviceId(1, 0x20000913);
return 0;
}

  1. created a file called jconnect that contained:

#!/bin/bash

JLinkExe -JLinkScriptFile /myscript -device U74-mc -if JTAG -speed 15000 -jtagconf -1,-1 -AutoConnect 1

  1. connect your jlink using this info:

  1. I also connected the jlink vtref pin to the 5 volt (gpio pin 2, see quick start guide for pin numbers) and also connected a ground pin from the jlink edu to pin 39 on the sbc

  2. i also had a usb serial adaptor hooked up to my sbc

  3. executed ./jconnect

  4. Oddly I got the following output from running the above script:


Device “U74-MC” selected.

Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
TotalIRLen = 10, IRPrint = 0x0021
JTAG chain detection found 2 devices:
#0 Id: 0xDEB11001, IRLen: 05, Syntacore RISC-V
#1 Id: 0x20000913, IRLen: 05, Unknown device

3 Likes

Hi, I used your basic information with the cmd
“…/jlink-jtag/JLinkGDBServer -JLinkScriptFile ./jlink_u74.cfg -device U74-mc -if JTAG -speed 15000 -jtagconf -1,-1 -AutoConnect 1”

I was able to debug exactly the same as I had been using openocd.

Could you please let me know where you got the jlink / openocd tools?

Were they from the sifive website?

Where did you get the openocd config file?

Were you able to set a breakpoint at the start of the firmware?

I want to break at the start of the firmware and also at the end when it jumps out so that I can learn more about how the system works.

I haven’t figured out how to get this to work.

Thanks for any help

Maybe this will help a little:
J-Link GDB Server - Segger Wiki
J-Link Software and Documentation Pack
Download - J-Link Software and Documentation Pack
OpenOCD - Supported JTAG interfaces

Yes I used the tools from SiFive,
I put the makefile and openocd config files in this repository.

But your jlink config works just as well as openocd.
I set the program counter to _enter to start debugging, its all shown in the .gdbinit file.

Is this stable? I used this link successfully, but it will be automatically disconnected after a while because of timeout as below.

Yes it’s stable, I used it a lot for debugging.
You may just have a bad cable.
The logs shows usb to jtag errors when trying to send and receive messages.

so only 6 pins need to be connected?
I need dupont wires to connect