pyftdi
pyftdi copied to clipboard
F232H - Lock on High State for CBUS pins
Hello,
Hello
With FTPROG i have switched the cbus_0 on "DRIVE1" and the LED turned on. Then i switched to "DRIVE0" but the LED stays into HIGH state.
Please could you explain why this is happening ? What should i do ?
Also, i have difficult to understand what i should put into theses functions to control the GPIOs:
Thanks a lot for your help!! :) Clément
Whenever you update the EEPROM, you need to power cycle the device so that the EEPROM content is read and used.
Usage example on an UM232H board (FT232H module):
-
Load the current EEPROM content into a file
pyftdi/bin/ftconf.py -P 15ba:002a -o ft232h.ini ftdi://:232h/1
-
Create a backup file if something goes wrong
cp ft232h.ini ft232h_backup.ini
-
Edit the INI file
[values] ; ... cbus_func_8 = DRIVE0 cbus_func_9 = DRIVE1
-
Update the EEPROM
pyftdi/bin/ftconf.py -i ft232h.ini -l values -u ftdi://:232h/1
-
Unplug/plug back the UM232H module
- yellow led lights up, green led is off
-
Edit the INI file
[values] ; ... cbus_func_8 = DRIVE1 cbus_func_9 = DRIVE0
-
Update the EEPROM
pyftdi/bin/ftconf.py -i ft232h.ini -l values -u ftdi://:232h/1
-
Unplug/plug back the UM232H module
- green led lights up, yellow led is off
-
Edit the INI file
[values] ; ... cbus_func_8 = GPIO cbus_func_9 = GPIO
-
Unplug/plug back the UM232H module
- Now the module is ready to accept CBUS commands, so that AC8 and AC9 output can be changed dynamically
-
Run a small Python test On FT232H, CBUS drivable pins are ACBUS5, ACBUS6,ACBUS8, ACBUS9, from FT232H datasheet, therefore:
- AC5 is b0, AC6 is b1, AC8 is b3, AC9 is b4.
- to use AC8 and AC9, the mask is therefore 0b1100 or 0x0c; to use GPIO as output, the direction is 0xc as well
#!/usr/bin/env python3 from time import sleep from pyftdi.ftdi import Ftdi, FtdiError from pyftdi.eeprom import FtdiEeprom ftdi = Ftdi() ftdi.open_from_url('ftdi://:232h/1') # sanity check: device should support CBUS feature assert(ftdi.has_cbus == True) eeprom = FtdiEeprom() eeprom.connect(ftdi) # sanity check: device should have been configured for CBUS GPIOs assert(eeprom.cbus_mask & 0xc == 0xc) # configure CBUS8 and CBUS9 as output ftdi.set_cbus_direction(0xc, 0xc) loop = 10 # alternate led blinking while loop: loop -= 1 ftdi.set_cbus_gpio(0x8) sleep(0.2) ftdi.set_cbus_gpio(0x4) sleep(0.2) ftdi.close()
I don't have any questions. I just want to thank you for the great example you've left in this thread @eblot! 👏
ftdi.set_cbus_gpio(0x8)
My FT232R is configured in this way:
But,
eeprom.cbus_mask 0
What should I do to access the 2 LEDS from python?