HiFive 1b usb woes [SOLVED]


#1

I just got my HiFive 1 rev B.

I’m using x64 machine running Arch linux as host. The device comes up nicely and plays the LED color change program it came with so basics are ok.

Dmesg however shows it detected as a J-Link SEGGER device. A disk is also detected when I plug in the usb cable.

DMESG:

[   47.324468] usb 5-4: new full-speed USB device number 4 using xhci_hcd
[   47.519868] usb 5-4: New USB device found, idVendor=1366, idProduct=1051, bcdDevice= 1.00
[   47.519870] usb 5-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   47.519871] usb 5-4: Product: J-Link
[   47.519872] usb 5-4: Manufacturer: SEGGER
[   47.519873] usb 5-4: SerialNumber: 000979000164
[   47.535902] cdc_acm 5-4:1.0: ttyACM0: USB ACM device
[   47.544849] cdc_acm 5-4:1.2: ttyACM1: USB ACM device
[   47.556844] usb-storage 5-4:1.5: USB Mass Storage device detected
[   47.556945] scsi host9: usb-storage 5-4:1.5
[   48.576130] scsi 9:0:0:0: Direct-Access     SEGGER   MSD Volume       1.00 PQ: 0 ANSI: 4
[   48.576376] sd 9:0:0:0: Attached scsi generic sg1 type 0
[   48.576576] sd 9:0:0:0: [sdb] 21829 512-byte logical blocks: (11.2 MB/10.7 MiB)
[   48.577875] sd 9:0:0:0: [sdb] Write Protect is off
[   48.577876] sd 9:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[   48.579875] sd 9:0:0:0: [sdb] No Caching mode page found
[   48.579877] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[   48.599119]  sdb:
[   48.602911] sd 9:0:0:0: [sdb] Attached SCSI removable disk

There’s no ttyUSB created only ttyACM0 and ttyACM1 which don’t work (tried screen and arduino IDE as well).

Note that I tried everything as root to be sure it’s not a permissions issue. Do I need a driver??


(Bruce Hoult) #2

Have you installed J-Link OB software as shown in section 6.1 of the HiFive1Rev B Getting Started Guide?

Examples are shown for Ubuntu (or other Debian-derived OS) and Windows but if you go to the J-Link site referenced you’ll also find Mac and RPM packages plus plain .tgz which I think you may need to use for Arch linux i.e. https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.tgz


#3

I followed the rev 1b quickstart now and decided to try using the freedom studio for simplicity since it comes with everything.

I’ve setup the project per the freedom studio instructions (hello world) and it compiled fine, but it doesn’t deploy.

The error is:

SEGGER J-Link GDB Server V6.44 Command Line Version

JLinkARM.dll V6.44 (DLL compiled Mar  1 2019 17:36:42)

Command line: -if jtag -device hifive1b -endian little -speed 1000 -port 2331 -swoport 2332 -telnetport 2333 -vd -ir -localhostonly 1 -singlerun -strict -timeout 0 -nogui
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            on
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 hifive1b
Target interface:              JTAG
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
Connecting to J-Link failed. Connected correctly?
GDBServer will be closed...
Shutting down...

I’m not even sure if this means that the local j-link thing doesn’t work or if the device isn’t reachable…

I really wished they didn’t use the j-link thing, seems like a mess.

I tried running sdk/SiFive/jlink//JLinkExe and got

Connecting to J-Link via USB...FAILED: Cannot connect to J-Link via USB.

Permissions should be fine tho I’m in a group assigned to the device:

$ groups
sys wheel uucp audio users vboxusers realtime docker
$ ls -l /dev/ttyACM0
crw-rw---- 1 root uucp 166, 0 May 9 10:28 /dev/ttyACM0

#4

Turns out it was actually a permissions issue, getting the jlink AUR package provided the correct udev rules to fix this.


(Bruce Hoult) #5

Everyone before was complaining about using openocd and the “evil” FTDI instead of using “professional” tools such as Segger or Lauterbach. Can’t win :slight_smile:


#6

Well, I’m no embedded expert, haven’t touched anything like this in years since my last espruino project, but to me simpler is better. I also saw some unsavoury licensing requirements at SEGGER which got me a bit nervous.

Maybe there’s some big benefit to using the “professional” tools, but us amateurs like things simple :smiley:


(Bruce Hoult) #7

Yes, I was a bit shocked when I saw that (apparently – the document was in German) you’re not allowed to download the software if you’re in Russia, Ukraine, Belarus or a bunch of others.

I’m from New Zealand, and I’m living in California now, but when I bought a original HiFive1 (which later led to actually joining SiFive) I was working and living in Moscow.


(Ty) #8

@Almindor do you have it working with Freedom Studio now?

The guide says (section 6.1) that if you are using Freedom Studio you don’t need to install the freedom-e-sdk or JLink software. Is it incorrect and you actually did need to install these things separately?

What are the correct udev rules that got it working for you?


#9

For udev I had to use these rules provided by this AUR package on Arch Linux.

I’m not sure which exact device/lines from that udev rules file is required, but the quickstart rules didn’t do it for me.

I’m not using the studio nor the SDK atm, but Rust directly with JLink provided by said package and objdump from SiFive’s toolchain. Currently I got serial, build-in LEDs and timer interrupts working fine.


Is there a better guide than the getting started guide for the revb?
(Ty) #10

@Almindor thanks, having a rules file that I know works made a difference.