Dangerous Prototypes

Dangerous Prototypes => Bus Blaster JTAG debugger => Topic started by: r250r on May 01, 2011, 01:11:00 am

Title: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: r250r on May 01, 2011, 01:11:00 am
EDIT: this is fixed as of urjtag git revision 08e714ef68513

I got my BBv2 yesterday.  I downloaded and compiled the latest version of urjtag.

If I try to autodetect, urjtag says my board is a flyswatter.

If I use the ft2232 driver, I get a warning that TDO seems to be stuck at 1. I get this no matter the interface, and also if I try to use the jtagkey driver (which I thought the board was supposed to come preconfigured for).

Quote
jtag> cable ft2232 vid=0x403 pid=0x6010 interface=2
Connected to libftdi driver.
jtag> detect
../../../src/tap/discovery.c:117 urj_tap_detect_register_size() Warning: TDO seems to be stuck at 1
Error: (null):0 (null)() no error:
jtag>
I've tried interface=0, =1, and =2 -- all with the same result.  Urjtag has been acting strange - for example, the error above, and parameters seem to persist, which doesn't make sense to me:
Quote
jtag> cable ft2232 vid=0x403 pid=0x6010 interface=b
Usage: cable DRIVER [DRIVER_OPTS]
<snipped rest of usage message>
Error: ../../../src/global/params.c:201 parse_param_lu() syntax: need unsigned int, not 'b'
jtag> cable ft2232 vid=0x403 pid=0x6010 interface=1
Connected to libftdi driver.
jtag> detect
../../../src/tap/discovery.c:117 urj_tap_detect_register_size() Warning: TDO seems to be stuck at 1
Error: ../../../src/global/params.c:201 parse_param_lu() no error: need unsigned int, not 'b'
jtag>

So I'm not sure if urjtag is the problem or if it's something else.

One thing I noticed about my board is that the FTDI chip looks different than the one pictured at http://dangerousprototypes.com/docs/Bus ... ew#FT2232H (http://dangerousprototypes.com/docs/Bus_Blaster_v2_design_overview#FT2232H) .  The last three letters of FTDI look like they cut deep into the package, instead of being on the surface. ?!

As an aside, there is confusion in your docs about whether to use interface=1 or interface=2 - compare the screenshot with the text on both of these pages:
http://dangerousprototypes.com/docs/Cla ... ith_urJTAG (http://dangerousprototypes.com/docs/Claire:_Bus_Blaster_v2#Programming_the_CPLD_with_urJTAG)
and
http://dangerousprototypes.com/docs/Bus ... _resources (http://dangerousprototypes.com/docs/Bus_Blaster_v2_manufacturing_resources)

edit: add TDO paragraph
Title: Re: troubleshooting bbv2
Post by: ian on May 01, 2011, 09:33:02 am
Hi r250r,

Thanks for the report, I'm sorry about the problem with the Bus Blaster.

You are right, the programming screenshots are incorrect. For the CPLD use interface=1. The screenshots were made when we were still patching urJTAG to work with the secondary programming interface and we used a few different names. I'll post new shots ASAP. This will be the official programming instructions page for the future:
http://dangerousprototypes.com/docs/Bus ... rogramming (http://dangerousprototypes.com/docs/Bus_Blaster_v2_buffer_logic#Programming)

Looking at the output I guess you are using urJTAG on Linux with the libFTDI GPL drivers?

Just to check - did you compile the latest SVN version without applying our patch? Our patch is no longer needed because it is included in the project.

arhi compiled the latest SVN here and connected under Linux using the FTDI D2xxx driver (I think, looking at the output):
viewtopic.php?f=37&t=1662#p21259 (http://dangerousprototypes.com/forum/viewtopic.php?f=37&t=1662#p21259)

Would it be possible to test the FTDI drivers instead? You may have found a bug in our patch for GPL libFTDI support.

I wouldn't worry about the chip difference (yet). I source from mouser and digikey, Seeed uses suppliers in China whenever possible. I bet they just come from different fabs, or a different batch.
Title: Re: troubleshooting bbv2
Post by: r250r on May 01, 2011, 02:53:00 pm
Quote
Looking at the output I guess you are using urJTAG on Linux with the libFTDI GPL drivers?
Yes, the GPL driver and 64-bit Debian (also tried 64-bit Ubuntu, same result).
Quote
Just to check - did you compile the latest SVN version without applying our patch? Our patch is no longer needed because it is included in the project.
I used the latest revision of urjtag, and no patches.

Quote
Would it be possible to test the FTDI drivers instead? You may have found a bug in our patch for GPL libFTDI support.

I downloaded the latest 64-bit driver from http://www.ftdichip.com/Drivers/D2XX.htm (http://www.ftdichip.com/Drivers/D2XX.htm) .  It works.

I was able to run urjtag without installing either libftd2xx or urjtag.  If someone else wants to do it, here's what I did:
Code: [Select]
$ cd libftd2xx1.0.4/
$ ln -s build/x86_64/libftd2xx.so.1.0.4 libftd2xx.so
$ cd ../urjtag/urjtag
$ mkdir build
$ cd build
$          # --with-ftd2xx needs an absolute path
$ ../configure --with-ftd2xx=/home/mark/projects/hw-dev/libftd2xx1.0.4/ --without-libftdi
$ make
$ sudo rmmod ftdi_sio
$ sudo rmmod usbserial
$          # symlink so that urjtag can find its manufacturer data
$ sudo ln -s /home/mark/projects/hw-dev/urjtag/urjtag/data /usr/local/share/urjtag

You must point LD_LIBRARY_PATH at libftd2xx/ when running urjtag:
Code: [Select]
$ LD_LIBRARY_PATH=/home/mark/projects/hw-dev/libftd2xx1.0.4 src/apps/jtag/jtag

The Bus Blaster is recognized now:

Code: [Select]
jtag> bsdl path ../../bsdl
jtag> cable ft2232 pid=0x6010 vid=0x403 interface=1
Connected to libftd2xx driver.
jtag> detect
IR length: 8
Chain length: 1
Device Id: 00000110111000011100000010010011 (0x06E1C093)
  Filename:    ../../bsdl/xc2c32a_vq44.bsd
jtag> svf ../../buffer_logic/BBv2-JTAGkey-v1.3.svf progress stop
Parsing    660/663 ( 99%)
Scanned device output matched expected TDO values.
jtag>
Title: Re: urJTAG fails with libFTDI on Linux
Post by: ian on May 01, 2011, 03:23:19 pm
Thanks for the update, I'm glad you got it going. I changed the topic of the post to help other people find it. Hopefully the libFTDI version will be fixed soon too.
Title: Re: urJTAG fails with libFTDI on Linux
Post by: arhi on May 01, 2011, 04:52:44 pm
you need to download urjtag from svn:
Code: [Select]
svn co https://urjtag.svn.sourceforge.net/svnroot/urjtag urjtag
cd urjtag/trunk/urjtag

now you need to tell it where your libftd2xx is and tell it to compile with libpthread and libdl
Code: [Select]
export LIBS="-lpthread -ldl"
export LDFLAGS=-L/usr/local/lib64

now run configure:
Code: [Select]
./configure

and make
Code: [Select]
make -j4

and install
Code: [Select]
sudo make install

and it will work:
Code: [Select]

[arhimed@luckey urjtag]$ jtag

UrJTAG 0.10 #1902
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

jtag.c:536 main() Warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable jtagkey interface=1
Connected to libftd2xx driver.
jtag> detect
IR length: 8
Chain length: 1
Device Id: 00000110111000011100000010010011 (0x06E1C093)
  Filename:    /home/arhimed/Dev/BSDL/XC2C32A_VQ44.bsdl
jtag> cable jtagkey interface=0
Connected to libftd2xx driver.
jtag> detect
IR length: 9
Chain length: 2
Device Id: 00111011101000000000010001110111 (0x3BA00477)
  Unknown manufacturer! (01000111011) (/usr/local/share/urjtag/MANUFACTURERS)
Device Id: 00010110010000010000000001000001 (0x16410041)
  Unknown manufacturer! (00000100000) (/usr/local/share/urjtag/MANUFACTURERS)
jtag>

(the itnerface=0 is jtag connector connected to some external STM32 ARM CortexM3 dev board - I don't have bsdl files for the ARM and whatever is second device jtag found)
Title: Re: urJTAG fails with libFTDI on Linux
Post by: r250r on May 14, 2011, 02:29:33 am
I just tried the latest version of urJTAG (git 08e714ef68513) with libFTDI, and it works fine.  Thanks for the bus blaster, and thanks to whoever fixed the issue as well!

I edited the original post to reflect the fact that this is fixed.
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: ian on May 14, 2011, 08:45:02 am
There were recently (this week?) a few patches submitted for urJTAG by one of the urJTAG project members. The interface problem is fixed, and the XC2C32A CPLD is now supported by urJTAG 'out of the box'.
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: tayken on June 27, 2011, 12:45:28 pm
I'm trying to compile urJTAG in Ubuntu (32bit) but no luck. I get these errors:

Code: [Select]
cc1: warnings being treated as errors
usbconn/libftd2xx.c: In function ‘usbconn_ftd2xx_flush’:
usbconn/libftd2xx.c:173:5: error: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘FT_STATUS’
usbconn/libftd2xx.c:173:5: error: format ‘%ld’ expects type ‘long int’, but argument 5 has type ‘DWORD’
usbconn/libftd2xx.c:173:5: error: format ‘%ld’ expects type ‘long int’, but argument 6 has type ‘DWORD’
usbconn/libftd2xx.c: In function ‘usbconn_ftd2xx_read’:
usbconn/libftd2xx.c:227:5: error: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘FT_STATUS’
make[3]: *** [libftd2xx.lo] Error 1
make[3]: Leaving directory `/home/tayken/dangerous_prototypes/urjtag/urjtag/src/tap'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/tayken/dangerous_prototypes/urjtag/urjtag/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/tayken/dangerous_prototypes/urjtag/urjtag'
make: *** [all] Error 2

Anybody had something like that?
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: arhi on June 27, 2011, 02:14:31 pm
edit the usbconn/libftd2xx.c and in line 174 and 227 add (long int) before problematic arguments:

Code: [Select]
    urj_log (URJ_LOG_LEVEL_COMM,
            "%sflush end: status %ld, xferred %ld, recvd %ldn", module,
            (long int) status, (long int) xferred, (long int) recvd);

Code: [Select]
    urj_log (URJ_LOG_LEVEL_COMM, "%sread end  : status %ld, length %dn",
            module, (long int) status, cpy_len + len);
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: tayken on June 27, 2011, 02:46:31 pm
Thanks, I couldn't remember how to do long int conversion. I'm beginning to forget stuff. :S

There was also another error when I tried to run it. Putting a symbolic link of liburjtag.so.0 (under /usr/local/lib) to /usr/lib solves that.

I have to start my program with "sudo jtag", otherwide I get:
Code: [Select]
jtag> cable ft2232
libusb couldn't open USB device /dev/bus/usb/001/004: Permission denied.
libusb requires write access to USB device nodes.
Segmentation fault
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: arhi on June 27, 2011, 03:45:09 pm
create a /etc/udev/rules.d/10-buspirate.rules with following content:

Code: [Select]
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="plugdev"

then make sure you add your user to a group plugdev (or just instead of plugdev put your user's default group) .. (note that I already set mode to 0666 so everyone can access it even if you have a wrong group, you might want 0660 there but if you are only user on a system 0666 works like a charm :D ..)
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: tayken on June 27, 2011, 04:03:14 pm
As I'm the only user, I left it as 0666. Now works like a charm!

Tomorrow I'll try to load sth to my FPGA board, then I'm set I guess.
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: arhi on June 27, 2011, 04:15:39 pm
btw as you can see in that file it sets mode 666 for any device with vid/pid=0403/6010 .. you can make a similar file only with different vid and pid for any other usb device you attach to you computer (bus pirate, logic shrimp, obls, pickit2, pickit3  ..). you can get the vid/pid info using lsusb so you can normally access them as regular user
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: tayken on June 27, 2011, 04:59:11 pm
I have a similar rule for setting up my BP at /dev/buspirate but I did that looong time ago and couldn't remember today. I'm kinda mess today, lots of stuff happening... So thnx for helping me out arhi!
Title: Re: [RESOLVED] urJTAG fails with libFTDI on Linux
Post by: esokol on December 02, 2016, 08:24:43 am
Almost the same problem, but worse.
Debian Stretch x64, kernel 4.8
Libftdi says Segmentation fault (urjtag installed via apt):
================================================
jtag> cable ft2232 pid=0x6010 vid=0x403 interface=1
Connected to libftdi driver.
jtag> detect
IR length: 8
Chain length: 1
Device Id: 00000110111000011100000010010011 (0x06E1C093)
  Manufacturer: Xilinx (0x093)
  Part(0):      xc2c32a-vq44 (0x6E1C)
  Stepping:    0
  Filename:    /usr/share/urjtag/xilinx/xc2c32a-vq44/xc2c32a-vq44
Segmentation fault
root@sokolenko:/usr#
================================================
libftd2xx says Warning: TDO seems to be stuck at 0 (urjtag compilled with libftd2xx):
================================================
jtag>  cable ft2232 interface=1
Connected to libftd2xx driver.
jtag> detect
Warning: TDO seems to be stuck at 0
jtag>
================================================
Will be thankfull for any idea...

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01342127656session_write_close ( )...(null):0
20.01372259248ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01372260024Database_MySQL->query( ).../DatabaseHandler.php:119
40.05662398760Database_MySQL->error( ).../Db-mysql.class.php:273