SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By drwho9437
#111112
I am using Ubuntu 10.04, this is less an openOCD issue than a JTAG/Linux issue. Summary: my configuration doesn't seem to let me access the UART properly in the ICDI board if you have it working please read and let me know.

Without rules in /etc/udev/rules.d

The ICDI doesn't work without sudo... The solution to this seemed to be to add rules to udev.

I added, 45-ft2232.rules:

BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end"

SYSFS{idProduct}=="bcda", SYSFS{idVendor}=="0403", MODE="664", GROUP="plugdev"

LABEL="kcontrol_rules_end"

This lets the JTAG work.

I also added, 99-usbftdi.rules:

SYSFS{idProduct}=="bcda", SYSFS{idVendor}=="0403", RUN+="/sbin/modprobe -q ftdi-sio product=0xbcda vendor=0x0403"

With this line, I think it initially worked, that is I remember it working on at least one boot...

Basically before you attach openOCD to the /dev that is the JTAG dmesg reports that:

[ 446.732041] usb 5-1: new full speed USB device using uhci_hcd and address 3
[ 446.941033] usb 5-1: configuration #1 chosen from 1 choice
[ 446.948961] ftdi_sio 5-1:1.0: FTDI USB Serial Device converter detected
[ 446.949020] usb 5-1: Detected FT2232C
[ 446.949027] usb 5-1: Number of endpoints 2
[ 446.949033] usb 5-1: Endpoint 1 MaxPacketSize 64
[ 446.949040] usb 5-1: Endpoint 2 MaxPacketSize 64
[ 446.949046] usb 5-1: Setting MaxPacketSize 64
[ 446.950751] usb 5-1: FTDI USB Serial Device converter now attached to ttyUSB0
[ 446.955049] ftdi_sio 5-1:1.1: FTDI USB Serial Device converter detected
[ 446.955142] usb 5-1: Detected FT2232C
[ 446.955150] usb 5-1: Number of endpoints 2
[ 446.955156] usb 5-1: Endpoint 1 MaxPacketSize 64
[ 446.955163] usb 5-1: Endpoint 2 MaxPacketSize 64
[ 446.955169] usb 5-1: Setting MaxPacketSize 64
[ 446.956209] usb 5-1: FTDI USB Serial Device converter now attached to ttyUSB1

Now when you run openOCD device 0 disconnects. It did this when it worked.

IE, on openOCD run:
[ 2052.863601] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 2052.863648] ftdi_sio 5-1:1.0: device disconnected

Using gtkterm or cutecom you can then attach to the other tty dev. This did work for a while. I attached to it at 115 kpbs and it would work. However, now it seems to point to JTAG port. That is it prints tons of giberish when openOCD is polling and nothing when openOCD is not running. More over attaching to ttyUSB1 with openOCD shut does nothing.

Trying to attach to ttyUSB0 before the device is unregistered by running openOCD (I don't know the mechanism there), results in failure to open the port. Attaching to ttyUSB1 before openOCD results in no communication.

In windows everything prints nicely on the virtual com that is in the ICDI. This verifies my code works in the uC. So this is certainly a driver/linux configuration issue.

If anyone else out there is using Ubuntu 10.04 or similar with the ICDI and has both the JTAG and UART virtual com working please let me know how you configured it.

Edit: also verified with my scope that there UART pin is talking to the FTDI in linux that is it isn't somehow have the reset signal held or anything. The strangest thing about this is that it did work in in Ubuntu at one point. Most frustrating...

Edit 2: Now using the contrib/openocd rules for my devices but those udev rules are basically the same. Using a second FTDI vitrual com chip, the modprobe rule no longer seems to add the ttyUSBs for the 2232 (the other device is ft232R 0x6001 0x403)... This shouldn't be this hard...

Edit 3: did a full build of the toolchain in windows 7 against the binary FTDI driver everything works in windows. Though when using gnu tools I prefer to work in linux... If only these driver/config issues didn't exist.