As a bit of a backup to the whole bootloader thing, I bought an Olimex ARM-USB-OCD JTAG adaptor. This is a multi purpose device that provides you with a USB JTAG interface to the ARM, a USB serial port and a power supply for your target board. It looks pretty useful and is supported by the openOCD project as well as Rowley Crossworks. JTAG is fast for flash programming and pretty well a one-touch solution in Crossworks. I was quite excited when it arrived and hurried to get it set up. By now, I should know better…
When I plugged it in to the Mac, Crossworks just would not talk to it. I tried all sorts but Crossworks stubbornly refused to open the JTAG adaptor. I wasted ages looking for solutions on the web, unplugging it, plugging it back in, and I was beginning to believe it was broken when I cam across a couple of pointers to the problem. There are two issues.
First, it seems that one of my USB leads is out of spec somehow. I had the JTAG adaptor plugged into a PC and discovered, quite by chance that it would work with one cable but not the other. This is a bit mystifying as I had seen no problems with the ‘bad’ cable before – it simply would not work with the Olimex adaptor. YOu see plenty of cables marked up these days as USB 2.0 standard but I had rather assumed this was just a way to get people to buy new cables. Maybe they are different. A bit of checking shows that the USB 3 standard has a specific cable requirement. Anyway, the ’good’ cable was used and the adaptor plugged back into the Mac. No good. Still could not open the JTAG adaptor. that was when I came across the other pointer on the web.
This type of JTAG adaptor is based on the FTDI USB to serial chip. I expect the software uses the serial port to waggle the port control lines to talk to the JTAG port. Anyway, Mac OS X Leopard has drivers built in for these so that wasn’t the problem. Indeed, when I looked at the available serial ports, I could see two associated with the JTAG adaptor. you can find these ports with a command like this:
IMAC:peterharrison$ ls -al /dev/tty.usb*
crw-rw-rw- 1 root wheel 10, 114 8 May 19:10 /dev/tty.usbserial-000014FDA
crw-rw-rw- 1 root wheel 10, 114 8 May 19:10 /dev/tty.usbserial-000014FDB
crw-rw-rw- 1 root wheel 10, 100 8 May 19:18 /dev/tty.usbserial-FTD3TMCH
That is where the problem lay. Since the kernel had seen the device before Crossworks had a chance to see the it, it had nabbed them and turned on both serial ports thus preventing it from behaving like a JTAG adaptor.
To my surprise, it turns out that the Leopard installation actually knows all about the Olimex adaptor and describes it as having two serial ports so they both get turned on. To make all this work properly, you have to tell the kernel to leave the first port alone. If you have a look on your Mac, you should be able to find the FTDI driver property list file here:
It is a text file so it can be edited with any suitable editor. You may need to set permissions or do it from the command line with sudo. CAUTION – make a copy. If you delete this file, all your FTDI serial devices will stop working when you next restart your computer.
When you have it in an editor, look for this section:
<key>Olimex OpenOCD JTAG A</key>
Delete it, leaving the similar ‘B’ section alone. If you then restart your Mac, you should find that only one serial port is listed for this device and Rowley Crossworks, if you have it, can recognise the JTAG adaptor. For those of you who are proud of how long your Mac has gone without a restart you might want to manually unload the kernel drivers and then reload them with the following commands:
IMAC:peterharrison$ sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext/
IMAC:peterharrison$ sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext/
The result will be the same.
Incoming search terms:
- olimex arm-usb-ocd crossworks (1)
- stm32 olimex (1)