Skip to main content
Topic: Usage under Linux (Read 5811 times) previous topic - next topic

Usage under Linux

Hi,

just trying to use the BusBlaster under Linux.

It seems the wiki is a bit out of date and I would be glad if we could summarize the actual status.
Here is what I did so far.

I use 64 bit Arch Linux system and used a AUR package (a receipt) to build and install urJTAG from SVN.
The busblaster was nicely recognized by the ftdi_sio drivers. However, the package explicitly build urJTAG against the proprietary ftd2xx drivers. No idea if that is a personal preference or a requirement. Anyhow, those drivers came as dependencies in form of another Arch Linux package (thanks Arch).

After removing the ftdi_sio drivers

Code: [Select]
sudo rmmod  ftdi_sio 

I can start urJTAG
Code: [Select]
jtag

I hate if program binaries call different compared to the software name esp. for CLI-tools ;) )

Furthermore, it seems not longer necessary to used a patched version of urJTAG to address the second interface (interface=1). This seems to work with the current build from urJTAG.
However, the Arch AUR shipped a patch which took care of some long int and integer conversion. This problem was addressed here already and seems not to be upstream yet.
Code: [Select]
--- urjtag/src/tap/usbconn/libftd2xx.c.ORIG	2011-10-31 10:00:34.746529359 +0100
+++ urjtag/src/tap/usbconn/libftd2xx.c 2011-10-31 10:03:43.009128467 +0100
@@ -172,7 +172,7 @@
 
    urj_log (URJ_LOG_LEVEL_COMM,
              "%sflush end: status %ld, xferred %ld, recvd %ldn", module,
-            status, xferred, recvd);
+            (long int) status, (long int) xferred, (long int) recvd);
 
    return status != FT_OK ? -1 : xferred;
 }
@@ -225,7 +225,7 @@
    }
 
    urj_log (URJ_LOG_LEVEL_COMM, "%sread end  : status %ld, length %dn",
-            module, status, cpy_len + len);
+            module, (long int) status, (int) cpy_len + len);
 
    return status != FT_OK ? -1 : cpy_len + len;
 }

So the question remain. Could it work with the native drivers (ftdi_sio) and where are the pros and cons?
Obvious one pro would be the fact that the ftdi_sio drivers are available on most systems without additional installation.

If we once get an up-to-date "How to use it under Linux" we might push it forward to the wiki.

Greetings

Torwag

Re: Usage under Linux

Reply #1
I wanted to add a reply to this post, but is impossible to add a complete guide because the stupid "anti spam rules"
Now I see the reason because they are so few posts

Re: Usage under Linux

Reply #2
@torwag - Yes, the patch for dual interfaces is in the trunk for a while I think, not in the windows binaries though (still at v11). I believe it will work with the native drivers, last time I was in the source poking around I thought it was an easy switch. Also, when robots made the initial patches (and Tornado helped implement them) I thought urJTAG asked that we write code that supported both types, but I don't recall.

Please do push any updates to the wiki, the linux build side is constantly evolving.
Got a question? Please ask in the forum for the fastest answers.

Re: Usage under Linux

Reply #3
@Juan37 - I'm so sorry about our spam filter and the inconvenience. I wrote it to cause the minimum hassle to users and eliminate the need for moderation, but it does filter you for the first 24 hours that you have an account. This gives us a chance to catch spammers before being bombed with spam and nudie pictures. By this time I think all restrictions will be lifted and you'll never see it again, if not please let me know and I'll see if there's a problem.
Got a question? Please ask in the forum for the fastest answers.

Re: Usage under Linux

Reply #4
Hey Ian,
just OT but .... if you wrote the SPAM filter you might be able to adapt it that new people can get rid of that if they get befriended with another forum member of a certain "rank".... e.g. if you know someone in person or trust him, you can assign him to your friend list giving even a newbie full access to the forum features. That would be a decentralized way to give real contributors fast access.

Re: Usage under Linux

Reply #5
The open source driver ftdi_sio (present in the actual Linux systems), do'nt work. The best way to prevent this module to not load, is to add to the blacklist modules in /etc/modprobe.d/
They are 2 options about the driver; one, is the ftdi propietary driver, and the best, is to use with libftdi and libusb.

I tryed to use urjtag, but I do'nt finded the patch for the source, to use with the bus blaster.

I builded openocd, configured with ./configure --enable-maintainer-mode
            --enable-ft2232_libftdi
With this option (the first time used only "./configure --enable-ft2232_libftdi"

I must have installed oin the system libftdi and libftdi-dev, libusb and libusb-dev.

I use Opensuse 12.2, and here You have a guide usable for many Linux systems:

I could'nt add the link, search in Google "STM32/ARM Cortex-M3 HOWTO: Development under Ubuntu (Debian)"

Bus_Blaster_OpenOCD_guide#busblaster.cfg_file_for_OpenOCD

You can use this device as user, creating the udev.rules:

$> lsusb
...
Bus 004 Device 005: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC
...

Then we are going to add this device to udev so we don't have to use sudo to use it. First check that you are a member of the group plugdev (with commands like groups or id), then add the following to a udev rules file.

sudo vi /etc/udev/rules.d/45-ftdi2232-libftdi.rules

#Bus Blaster
SYSFS{idProduct}=="6010", SYSFS{idVendor}=="0403", MODE="666", GROUP="plugdev"

More info:
http://fun-tech.se/stm32/OpenOCD/index.php

Re: Usage under Linux

Reply #6
Hi  Juan37,

in my understanding its not a good idea to add ftdi_sio to the module blacklist. It works pretty well for other ftdi-based devices.
Thus, I would recommend to write a little script which first unloads the ftdi_sio and then start urjtag.
Could be as simple as this (not tested)
Code: [Select]
#!/bin/sh
# urjtag.sh
sudo rmmod ftdi_sio
jtag

However, if I read it correct, one can compile urjtag against both drivers. Need to test this.
For me compiling urjtag worked compiled against the ftd2xx-driver without any patching with regards to the Busblaster.
See the Arch Linux PKGBUILD file [1]. Its pretty much a script which just does what you would do on a manual install.
There is a patch but that seems just to fix type casting problem.

Didn't try OpenOCD yet.
[1] https://aur.archlinux.org/packages/ur/u ... n/PKGBUILD

Re: Usage under Linux

Reply #7
But the proposed solution by You, has the problem that any time You must to call it via the script. If You forget it, They will'nt work.

 I do'nt patched urjtag. I downloaded the propietary libraries and drivers from the FTDI website, and recompiled urjtag to use the libraries ftd2xx. I must have installed it in the proper directory, with the symlinks.
I used this option, and the configure script detected the ftd2xx libraries:

./configure --enable-cable ft2232 --with-ftd2xx

But the first time I wanted to use the bus blaster interface with openocd and urtjtag, I finded to get to work openocd first, without downloading the propietary libraries and drivers.

Aside from the issue of the TDO terminal fixed on 1, I had a problem with the detection of SST39VF1601 flash memory of the board, and I do'nt know if the problem was due to the TDO terminal, or is other problem. It was with openocd, because urjtag was unable to start by the hardware problem on the interface.
viewtopic.php?f=37&t=4754

Cheers

Re: Usage under Linux

Reply #8
Quote
But the proposed solution by You, has the problem that any time You must to call it via the script. If You forget it, They will'nt work.

Yup thats right, but relatively easy. In my case I never can remember that one has to start urjtag by a command call 'jtag'. Thus, I created this little script call urjtag which does the kernel module stuff first. Solved two problems ;)
If people still prefer to call 'jtag' as a command, it's possible too. Either, place a script somewhere which has higher priority in the execution look up compared to the original /usr/bin/jtag, or simply rename jtag into jtag_do_not_start_me_directly_or_you_will_be_badly_surprised and create a script jtag which calls the renamed original jtag command.

As for the patch I believe it's only a small bug-fix. It might work without it equally well.

Did you try in addition to compile urjtag against the ftdi_sio module? Would be interesting if this works too.

Greetings

Re: Usage under Linux

Reply #9
We can compile urjtag without the use of propietary software.
 The solution is the same than openocd: Using the libftdi open source library:
http://www.intra2net.com/en/developer/libftdi/

From the configure help to compile urjtag:
  --enable-cable          Enable default set or specific cable drivers.
                          'default' enables:
                          arcom byteblaster dlc5 ea253 ei012 ft2232 igloo
                          jlink keithkoep lattice mpcbdm triton usbblaster
                          wiggler xpc
                          Disabled by default are:
                          ep9307 jim ts7800

  --enable-lowlevel      Enable default set or specific lowlevel drivers:
                          'default' enables:
                          direct ftdi ftd2xx ppdev ppi

  --enable-relocatable    Enable relocatable paths
  --enable-dmalloc        Enable heap debugging with dmalloc library
  --disable-flash-multi-byte
                          Disable flash multi-byte write mode

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE      do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld          assume the C compiler uses GNU ld default=no
  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
  --without-libiconv-prefix    don't search for libiconv in includedir and libdir
  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
  --without-libintl-prefix    don't search for libintl in includedir and libdir
  --with-libusb          use libusb for some USB JTAG cables
  --with-libftdi          use libftdi for FTDI-based cables
  --with-ftd2xx          use ftd2xx library for FTDI-based cables
  --with-inpout32        use InpOut32.dll for parallel port access on Windows

To build urjtag for the Bus Blaster, the configure option is:
./configure --enable-cable ft2232  --with-libftdi

Regards,
              Juan