Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to write channel_a_type = 1 to EEPROM connected to FT232H causes KeyError: '1' exception #380

Open
FreddieChopin opened this issue Jun 16, 2024 · 1 comment

Comments

@FreddieChopin
Copy link

FreddieChopin commented Jun 16, 2024

I have a custom device based on FT232H with external EEPROM. Programming it with pyftdi versions 0.55.0 and below worked fine. However with the most recent 0.55.4 I get an error with the most basic re-programming operation - I cannot write the EEPROM dump that I have just read from exactly the same device:

$ ftconf.py -P 0403:8220 ftdi://0x0403:0x8220/1 -o dump.ini 
$ ftconf.py -P 0403:8220 ftdi://0x0403:0x8220/1 -i dump.ini 
Traceback (most recent call last):
  File "/usr/bin/ftconf.py", line 192, in <module>
    main()
  File "/usr/bin/ftconf.py", line 129, in main
    eeprom.load_config(args.input, args.load)
  File "/usr/lib/python3.12/site-packages/pyftdi/eeprom.py", line 443, in load_config
    self.set_property(opt, value)
  File "/usr/lib/python3.12/site-packages/pyftdi/eeprom.py", line 501, in set_property
    val = self.CHANNEL[value]
          ~~~~~~~~~~~~^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: '1'

I attach this dump.ini file. dump.zip

Generally the same thing happens if I have an "erased" EEPROM and want to write my configuration there.

I believe this may be related to this commit, however this is just my guess: e68e4c3

After a bit of debugging it seems that the key-value that causes this is channel_a_type = 1 - if I remove this one line from the dump.ini file, the dry-run programming works fine.

@phartleyp
Copy link

I found the same issue, and came to the same conclusion that it is caused by e68e4c3.

Unfortunately ftconf.py with the -o option saves channel_a_type = 1 but ftconf.py with the -i option to ingest the just-generated file expects channel_a_type = FIFO (or one of the CONFIG flags). It looks like you can avoid this issue by updating channel_a_type in your config file as follows:

  • 0: UART
  • 1: FIFO
  • 2: OPTO
  • 4: CPU
  • 8: FT128
  • 16: RS485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants