OpenOCD та FTDI-MPSSE

Зрідка щось пробуючи на LPC1766, вже доволі тривалий час не зазирав у новини OpenOCD. Як зібрав колись 6-тої версії, так і працював. Ще раніше, коли робив собі плату на FT2232H, трохи промахнувся і керування драйверами зробив несумісним з жодним з підтримуваних OpenOCD 6.x адаптерів. Тому для роботи з кортексами діставав напівмакетку (плата з FT2232D та шинником, перерізана на сумісність з Amontec JTAGkey).

А оце підтягнув git-ом свіжий стан, а там вже 8.0. А з 7.0 вже для FTDI/MPSSE підтримується довільне призначення службових виводів (reset, керування драйверами). Навіть краще, ніж в avreal, бо можна задати довільне своє ім’я сигналу, прив’язати його до ніжки і керувати ним командами OpenOCD — інтерактивно або з командного рядка. Додав у makefile в частині формування командного рядка вмикання червоного світлодіода на початку програмування і вимикання в кінці. Все чудово запрацювало, через FT2232H програма зашивається у півтора-два рази швидше, ніж через FT2232D, веріфікується у три-чотири рази швидше. І таке враження, що і через FT2232D свіжа версія OpenOCD працює відчутно швидше, ніж 6.x, але вже ніде перевірити, а спеціально збирати ліньки.

І дуже вчасно я сьогодні (хм… вже вчора) за це взявся — через хвилин двадцять після того, як зберіг на флешку конфігураційний файл та приклад makefile, подзвонив колега і сказав, що на роботі полетів J-Link. А там у мене точно така ж плата з FT2232H лежить.

bug in resync (MPSSE)

Bug was found in SCK-pulse synchronisation in following conditions:

  • firmware sets high level on SCK pin;
  • an MPSSE-based adapter is used (FT2232, FT4232, FT232H).

Microcontroller can be programmed again via USB-based adapter after erasing via LPT-based adapter.

In my case the bug appears with AT90S8515 but not reproduced for ATmega168.

Bugfix will be published as soon as possible.


The bug has been fixed in version 1.28r13.

AVReAl/Linux and root privileges

Originally AVReAl/Linux worked with LPT directly, by processor in/out instructions. This method requires root privileges. Later /dev/parport support was added. It is enough to add a user in lp group for this access method. Both ways are described in AVReAl and LPT in Linux post.

Then FTDI MPSSE support was added. I noticed that without administrator rights the program can’t connect to FT2232 chip. But all AVReAl versions on my PC run with root priveleges because it is required for LPT direct acces testing. So, the program works fine with FTDI chips and I had no need to dig deeper.

Finally I decided to investigate the matter. As often happens, to do right you just stop and spend a little time to read and think.

To work with FTDI-based programmers without root priveleges add a file named, for example 55-ftdi.rules to directory /etc/udev/rules.d/. The file must have the following content:

# FTDI-based devices
#
# FTDI vid=0403
# FT2232, FT2232H: pid=6010
# FT4232H:  pid=6011
# FT232H:   pid=6014
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010|6011|6014", OWNER="root", GROUP="root", MODE="0666"

You need not reboot. It is enough to reconnet the programming adapter.

The rules use default vid/pid for FTDI chips. If you use an adapter with different vid/pid, add appropriate line into the file.

OpenOCD contains a file with rules for all adapters supported by this program. If FTDI-based adapter listed in the file is used with AVReAl, you can simply copy the file into /etc/udev/rules.d/ directory. OpenOCD rules use GROUP="plugdev", MODE="0664". As for me it is no difference between this two variants for desktop PC because all users are already included in plugdev group.

Of course, you must have administrator rights to create the file. After that you will be able to work with AVReAl without root privileges.

Attached Files:

FT2232C, FT2232L, FT2232D

Час від часу зустрічаю запитання по відмінностях між цими мікросхемами. В описах чи відкритих проектах в інтернеті згадується FT2232C, а в продажу зараз є FT2232D. Виникають сумніви у сумісності програм та адаптерів.
Як це часто буває, всі ці сумніви розвіюються при перегляді сторінки опису FT2232D. Але чомусь багатьом легше не подивитися на сайті виробника, а спитати на форумі чи набрати рядок «різниця FT2232C та FT2232D» в пошуковику. Ну що ж, ось він, цей рядок для нього, хай йому буде легше 🙂

Документації на старіші версії мікросхем на сайті вже немає, але безпосередньо на сторінці сказано:

The FT2232D is the 3rd generation of FTDI’s popular USB UART/FIFO IC. The FT2232D is an updated version of the FT2232C and its lead free version, the FT2232L. Please note that the FT2232D is not an new generation of device.

The FT2232D is lead free and pin compatible with the original FT2232C and FT2232L devices. All the original device features are supported with some additional features available including a CPU-style FIFO mode and an extended operating temperature range.

І що ж все це означає? » » »

How to install two versions of libftd2xx

As it was published before 64-bit libftd2xx.so libraries version 1.0.0 and above are not compatible with earlier ones. There are no problems with 32-bit libraries.
It is necessary to install old libftd2xx package for 64-bit avreal/Linux. The package can be downloaded from here.
AVReAl beginning from 1.28r6 loads the library by name libftd2xx.so.0 but not libftd2xx.so. That allows to install both library versions.
Let review installation process.

Continue reading ‘How to install two versions of libftd2xx’ »

The FTDI’s gift

The FTDI’s gift is very interesting.

Keeping the “See Figure 1.” motto in their minds, they have changed data types when switching over from library libftd2xx.so versions 0.4.x to libftd2xx.so.1.0.0. The gift affects on 64-bit libraries only. There is no problem for 32-bit ones.

ftd2xx library was born in Windows and contains WinAPI-like UART support functions FT_W32_ххх(). That’s why WinAPI standard types DWORD, BYTE and so on are used in the library. For Linux version of the library they have added WinTypes.h header file with typedefs for these types. In general, it seems to be a logical step, but…

Continue reading ‘The FTDI’s gift’ »

avreal/linux and libftd2xx.so.1.0.0 64-bit

At the beginning of december FTDI gave us a small gift — a new version 1.0.0 of libftd2xx.so library. But avreal/Linux 64 bit doesn’t work with the library. I will check avreal code later. I have placed previous version 0.4.16 of libftd2xx.so with which avreal works properly, on the download page.


Read more in another post: “The FTDI’s gift”

[flagcounter image]