Closed jasongaunt closed 2 years ago
Probably better off raising this directly with pyftdi developers?
Hi @rm-hull , sadly it's actually a bug in luma.core. It's a really easy fix though, this was all that was required;
In luma/core/interface/serial.py
on line 493 is this line...
gpio.set_direction(pins, pins & 0xFF)
This needs to be changed to the following;
if (gpio.width == 16):
gpio.set_direction(pins, pins & 0xFFFF)
else:
gpio.set_direction(pins, pins & 0xFF)
Or as a quick dirty one-liner;
gpio.set_direction(pins, pins & ((1 << gpio.width) - 1))
Hope this helps š
great, could you make a pull request @jasongaunt?
@jasongaunt thanks for investigating. Do you happen to know what are the permissible values of gpio.width
are?
I would assume 8, 16, 32, ... if so, then the one-liner is probably a better choice
Good morning @rm-hull and @thijstriemstra ,
According to the GPIO API page on pyftdi the following GPIO configurations exist;
I don't quite know if there'll be any issues accessing the devices with two or four ports, I don't have one to test. I'll see if I can get hold of one though.
Lets get it working for the single ports first and assess if this needs to be fixed for the dual / quad port chips later. Purely based on the first 4 bullets above I'd say the one-liner is the best option for scalability.
Pull request #257 has been raised š
FT2232H-based dev kit (2x 16-bit wide GPIO ports) ordered for testing and I have a spare ST7735-based LCD display in the "I'm bored now" box š
Edit: Tigard dev board now due Weds (12th Oct 2022)
So Amazon managed to lose it...
Have chosen an alternative and it's on its way; https://www.mouser.co.uk/ProductDetail/895-FT2232HMINIMOD
Pull request https://github.com/rm-hull/luma.core/pull/257 has been raised
Closing.
System: Ubuntu 22.04 Linux Kernel: 5.15.0-48-generic Python version: 3.10.6
This is potentially an odd one, fringe case or even PICNIC.
I'm trying to utilise a SSD1322 OLED display through an FTDI FT232h USB adapter. The chip on the adapter has 2x GPIO banks (the usual ADBUS pins 0-7 labelled as D0-7, and the secondary ACBUS pins 0-7 labelled as pins C0-7)...
This used to work fine under Ubuntu 16.04 using the Adafruit_GPIO Python2.7 module to wrap the SPI interface (it provided an abstraction of FT232H) with the following pin configuration...
...however this has been completely dropped and I've migrated to pyftdi to try and return to what the luma.core documents state. In migrating, I now find myself with this error:
This is the code I've written to try and initialise it;
To which I get the following traceback;
Sadly I cannot simply "rewire" - this was a small run custom PCB made by an Aida64 forum member and as such, immutable.
The pyftdi module references 16-bit wide GPIOs for the 232h so I know this is possible. Richard (or perhaps another developer), please can you look into this when you find yourself with a few mins? š„°