Configuring FT4232H using the ftdi_eeprom

System ProgrammingDevelopment for LinuxProgramming microcontrollers
Tutorial


The FT4232H is USB 2.0 High speed to UART IC converter. The FT4232H has four UART ports and one USB port.


By connecting EEPROM memory to this chip, you can set specific operating modes or change the manufacturer's data.


Let's look at the example and configure FT4232H directly on a system running GNU/Linux. We will do this using the ftdi_eeprom.


Installing ftdi_eeprom


The ftdi_eeprom is part of the open-source library libFTDI and depends on libconfuse.


  • To install ftdi_eeprom on Ubuntu or Debian, running the following command on terminal:


    sudo apt-get update
    sudo apt-get install ftdi-eeprom

  • If you are preparing your own distribution using Yocto Project (thud), ftdi_eeprom pakage can be installed by adding recipes:


    recipes-support/confuse/confuse_2.7.bb


    DESCRIPTION = "Library for parsing configuration files."
    HOMEPAGE = "http://www.nongnu.org/confuse/"
    SECTION = "libs"
    LICENSE = "ISC"
    LIC_FILES_CHKSUM = "file://NEWS;md5=18e885b42b86362019e0cab8dc2a393b"
    
    SRC_URI = "http://download.savannah.gnu.org/releases/confuse/confuse-${PV}.tar.gz"
    SRC_URI[md5sum] = "45932fdeeccbb9ef4228f1c1a25e9c8f"
    SRC_URI[sha256sum] = "e32574fd837e950778dac7ade40787dd2259ef8e28acd6ede6847ca895c88778"
    
    inherit autotools binconfig pkgconfig lib_package gettext
    
    EXTRA_OECONF = "--enable-shared"
    
    BBCLASSEXTEND = "native"

    recipes-support/libftdi/libftdi_%.bbappend


    PACKAGECONFIG += "ftdi-eeprom"
    PACKAGECONFIG[ftdi-eeprom] = "-DFTDI_EEPROM=on,-DFTDI_EEPROM=off,confuse"
    PACKAGES =+ "ftdi-eeprom"
    FILES_ftdi-eeprom += "${bindir}/ftdi_eeprom"


Configuring FT4232H


By default there are four UART ports of FT4232H operate in RS232 mode, the manufacturer name is FTDI and the product name is Quad RS232-HS.



Let's change the manufacturer name to habr.com, the product name to Quad RS485 and set for UART ports RS485 operate mode.


Let's prepare the configuration file habr.conf


# Filename of the EE file to be generated. Leave empty to skip file writing.
filename=habr.bin

# Vendor ID. FT4232H factory default 0x0403.
vendor_id=0x0403

# Product ID. FT4232H factory default 0x6011.
product_id=0x6011

# EEPROM Type: 0x46 for 93xx46, 0x56 for 93xx56 and 0x66 for 93xx66.
eeprom_type=0x56

manufacturer="habr.com"
product="Quad RS485"
serial="1234"

# Use the serial number string.
use_serial=true

# Max. power consumption: value * 2 mA. Use 0 if self_powered = true.
max_power=0

# Turn this off for bus powered.
self_powered=true

# Turn this on for remote wakeup feature.
remote_wakeup=false

# Set port operate mode.
cha_type=UART
chb_type=UART

# Use virtual com-port driver.
cha_vcp=true
chb_vcp=true
chc_vcp=true
chd_vcp=true

# Enable RS485 mode.
cha_rs485=true
chb_rs485=true
chc_rs485=true
chd_rs485=true

Using the ftdi_eeprom pakage, load our configuration into EEPROM memory by running the following command on terminal:


ftdi_eeprom --flash-eeprom habr.conf

After rebooting the device, you can see the results of the work:


Tags:ftdift4232hftdi_eepromyoctolibftdi
Hubs: System Programming Development for Linux Programming microcontrollers
+2
331 0
Leave a comment
Безопасность Linux
February 12, 202130,000 ₽OTUS
SEO-специалист
January 25, 202136,000 ₽GeekBrains
Профессия Android-разработчик
January 25, 202130,000 ₽Loftschool
UI-дизайнер
January 25, 202159,900 ₽Нетология
UX/UI дизайнер
January 25, 2021104,900 ₽Нетология

Top of the last 24 hours