Linux/FTDI: Difference between revisions

From Omnia
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 35: Line 35:
  ftdi_eeprom --read-eeprom ftdi.conf
  ftdi_eeprom --read-eeprom ftdi.conf
  ftdi_eeprom --verbose --read-eeprom ftdi.conf
  ftdi_eeprom --verbose --read-eeprom ftdi.conf
  ftdi_eeprom --device i:0x0403:0x6011 --read-eeprom ftdi.conf
  ftdi_eeprom --device i:0x0403:0x6011 --read-eeprom ftdi.conf
ftdi_eeprom --verbose --device i:0x0403:0x6011 --read-eeprom ftdi.conf
ftdi_eeprom --verbose --device i:0x0403:0x6011 --flash-eeprom ftdi.conf


ftdi.conf:
ftdi.conf:
Line 51: Line 55:
</pre>
</pre>


ftdi.conf:
<pre>
vendor_id=0x0403
product_id=0x6001
max_power=150
manufacturer="Other"
product="Snow"
serial="00001"
filename="eeprom.new"
</pre>


---
---
Line 181: Line 198:
--verbose              Print more information
--verbose              Print more information
</pre>
</pre>
=== ftdi config file ===
https://manpages.debian.org/testing/ftdi-eeprom/ftdi_eeprom.1.en.html
Comments start with #. The beginning of such a file might look like the following:
<pre>
vendor_id=0x0403        # Vendor ID
product_id=0x6001      # Product ID
max_power=0            # Max. power consumption: value * 2 mA. Use 0 if self_powered = true.
###########
# Strings #
###########
manufacturer="ACME Inc"                # Manufacturer
product="USB Serial Converter"          # Product
serial="08-15"                          # Serial
</pre>
The example configuration file that could be found in /usr/share/doc/ftdi-eeprom/ is quite well commented so you should be able to use it as a basis. The following keys are supported:
vendor_id
Set the vendor ID of the device. This value could be entered in decimal or hexadecimal form, and should be in the range 0-65535 or 0x0000-0xffff, respectively.
product_id
Set the product ID of the device. This value could be entered in decimal or hexadecimal form, and should be in the range 0-65535 or 0x0000-0xffff, respectively.
max_power
Set the maximum current the device will use, in 2 mA unit. Use 0 if self_powered = true.
manufacturer
Set the manufacturer string which normally holds the name of the manufacturer.
product
Set the product string which normally holds the name of the product.
serial
Set the serial string which normally holds the serial number of the product.
self_powered
Specify if the device is self-powered or not. The value should be true or false.
remote_wakeup
Specify if the device supports remote wake-ups. The value should be true or false.
use_serial
If this value is set to true, the serial string will be used. Otherwise the default serial string will be used.
BM_type_chip
This value have to be set to true if you are using a BM chip.
in_is_isochronous
If set to true this option specify that the input endpoint is in isochronous mode.
out_is_isochronous
If set to true this option specify that the output endpoint is in isochronous mode.
suspend_pull_downs
If this value is set to true the pull downs are enabled during suspend for lower power consumption.
change_usb_version
This value has to be set to true if you want to force the USB version using the usb_version key. Otherwise the default USB version will be used.
usb_version
Set the USB version of the device. The change_usb_version value has to be set to true.
filename
Specify a filename if you want to dump the content of the eeprom into it.


=== UDEV ===
=== UDEV ===

Latest revision as of 09:16, 6 December 2025

FTDI Driver

To detect the FTDI device, install the extra module package:

apt install linux-image-extra-`uname -r`

Then either reboot, or manually load the module

modprobe ftdi_sio

Find with:

/dev/ttyUSB0

FTDI Programming

sudo apt install ftdi-eeprom
sudo modprobe ftdi_sio
sudo udevadm info -a /dev/ttyUSB0 | less
sudo modprobe -r ftdi_sio
ftdi_eeprom --read-eeprom asmith.conf
modprobe ftdi_sio
tio /dev/ttyUSB0


udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) | less
   ATTRS{idProduct}=="6011"
   ATTRS{idVendor}=="0403"


---

ftdi_eeprom --read-eeprom ftdi.conf
ftdi_eeprom --verbose --read-eeprom ftdi.conf
ftdi_eeprom --device i:0x0403:0x6011 --read-eeprom ftdi.conf
ftdi_eeprom --verbose --device i:0x0403:0x6011 --read-eeprom ftdi.conf
ftdi_eeprom --verbose --device i:0x0403:0x6011 --flash-eeprom ftdi.conf

ftdi.conf:

vendor_id=0x0403
product_id=0x6011

max_power=0

manufacturer="Aznot"
product="Aznot Device"
serial="1944d0021"

filename="eeprom.new"

ftdi.conf:

vendor_id=0x0403
product_id=0x6001

max_power=150

manufacturer="Other"
product="Snow"
serial="00001"

filename="eeprom.new"

---

Hint: Self powered devices should have a max_power setting of 0.

---


# ftdi_eeprom --read-eeprom test.conf

FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource@intra2net.com>
FTDI read eeprom: 0
EEPROM size: 128
FTDI close: 0


---

# ftdi_eeprom --erase-eeprom asmith.conf

FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource@intra2net.com>
FTDI read eeprom: 0
EEPROM size: -1
FTDI erase eeprom: 0
Used eeprom space: 224 bytes
Writing to file: eeprom.new
FTDI close: 0

---

# ftdi_eeprom --flash-eeprom asmith.conf

FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource@intra2net.com>
FTDI read eeprom: 0
EEPROM size: -1
Used eeprom space: 96 bytes
FTDI write eeprom: 0
Writing to file: eeprom.new
FTDI close: -1

---

# ftdi_eeprom --flash-eeprom asmith.conf

FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource@intra2net.com>
FTDI read eeprom: 0
EEPROM size: 256
Used eeprom space: 224 bytes
FTDI write eeprom: 0
Writing to file: eeprom.new
FTDI close: 0

---

[18849.738246] usb 1-5: new high-speed USB device number 6 using xhci_hcd
[18849.880956] usb 1-5: New USB device found, idVendor=0403, idProduct=6011
[18849.880957] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[18849.880958] usb 1-5: Product: Aznot Device
[18849.880959] usb 1-5: Manufacturer: Aznot
[18849.882541] ftdi_sio 1-5:1.0: FTDI USB Serial Device converter detected
[18849.882555] usb 1-5: Detected FT4232H
[18849.882635] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB0
[18849.883942] ftdi_sio 1-5:1.1: FTDI USB Serial Device converter detected
[18849.883953] usb 1-5: Detected FT4232H
[18849.884028] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB1
[18849.885338] ftdi_sio 1-5:1.2: FTDI USB Serial Device converter detected
[18849.885349] usb 1-5: Detected FT4232H
[18849.885423] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB2
[18849.886763] ftdi_sio 1-5:1.3: FTDI USB Serial Device converter detected
[18849.886779] usb 1-5: Detected FT4232H
[18849.886866] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB3

---

that means that the EEPROM is erased (all 0xff); see ftdi_read_eeprom() in ftdi.c: "Guesses size of eeprom ... will not work with blank eeprom"

> Checksum Error: aaaa 0000 > Malloc failed, aborting

these errors follow from EEPROM size being -1

with an erased EEPROM the FTDI chip falls back to the default vendor:product (which is 0403:6011)

ref: [1]

---

Source:

https://chromium.googlesource.com/chromiumos/third_party/libftdi/+/b790d38e9fac3e2144293a84bfc6de72b01a6c6d/src/ftdi.c

ftdi_eeprom help

# ftdi_eeprom

FTDI eeprom generator v0.17
(c) Intra2net AG and the libftdi developers <opensource@intra2net.com>
Syntax: ftdi_eeprom [...options...] <config-file>
Valid Options:
--device <description>  Specify device to open by description string. One of:
         d:<device node>
         i:<vendor>:<product>
         i:<vendor>:<product>:<index>
         s:<vendor>:<product>:<serial>
--read-eeprom           Read eeprom and write to -filename- from config-file
--build-eeprom          Build eeprom image
--erase-eeprom          Erase eeprom
--flash-eeprom          Flash eeprom
--verbose               Print more information

ftdi config file

https://manpages.debian.org/testing/ftdi-eeprom/ftdi_eeprom.1.en.html

Comments start with #. The beginning of such a file might look like the following:

vendor_id=0x0403        # Vendor ID
product_id=0x6001       # Product ID
max_power=0             # Max. power consumption: value * 2 mA. Use 0 if self_powered = true.
###########
# Strings #
###########
manufacturer="ACME Inc"                 # Manufacturer
product="USB Serial Converter"          # Product
serial="08-15"                          # Serial

The example configuration file that could be found in /usr/share/doc/ftdi-eeprom/ is quite well commented so you should be able to use it as a basis. The following keys are supported:

vendor_id
Set the vendor ID of the device. This value could be entered in decimal or hexadecimal form, and should be in the range 0-65535 or 0x0000-0xffff, respectively.
product_id
Set the product ID of the device. This value could be entered in decimal or hexadecimal form, and should be in the range 0-65535 or 0x0000-0xffff, respectively.
max_power
Set the maximum current the device will use, in 2 mA unit. Use 0 if self_powered = true.
manufacturer
Set the manufacturer string which normally holds the name of the manufacturer.
product
Set the product string which normally holds the name of the product.
serial
Set the serial string which normally holds the serial number of the product.
self_powered
Specify if the device is self-powered or not. The value should be true or false.
remote_wakeup
Specify if the device supports remote wake-ups. The value should be true or false.
use_serial
If this value is set to true, the serial string will be used. Otherwise the default serial string will be used.
BM_type_chip
This value have to be set to true if you are using a BM chip.
in_is_isochronous
If set to true this option specify that the input endpoint is in isochronous mode.
out_is_isochronous
If set to true this option specify that the output endpoint is in isochronous mode.
suspend_pull_downs
If this value is set to true the pull downs are enabled during suspend for lower power consumption.
change_usb_version
This value has to be set to true if you want to force the USB version using the usb_version key. Otherwise the default USB version will be used.
usb_version
Set the USB version of the device. The change_usb_version value has to be set to true.
filename
Specify a filename if you want to dump the content of the eeprom into it.

UDEV

See Linux/udev

Notes

Barnaby Walters • How to read and program the EEPROM and configuration of FTDI FT2xx ICs on Linux or Mac OS X https://waterpigs.co.uk/articles/ftdi-configure-mac-linux/

Flashing the FTDI EEPROM under linux · mozilla-sensorweb/sensorweb-wiki Wiki · GitHub https://github.com/mozilla-sensorweb/sensorweb-wiki/wiki/Flashing-the-FTDI-EEPROM-under-linux

developer.intra2net.com Git - libftdi/blob - README.build http://developer.intra2net.com/git/?p=libftdi;a=blob;f=README.build


After updating the EEPROM, you should unplug and replug the board.

keywords