Giter Site home page Giter Site logo

Access ACBUS and use it as GPIO? about pyftdi HOT 10 CLOSED

eblot avatar eblot commented on August 19, 2024
Access ACBUS and use it as GPIO?

from pyftdi.

Comments (10)

 avatar commented on August 19, 2024

I found some useful code as a work around in issue 38 by chadkennedyonline:
#38

but I'm still wondering is it possible to add acbus control in library?

from pyftdi.

eblot avatar eblot commented on August 19, 2024

Yes it should be possible using the SET_BITS_HIGH command. It has already been implemented with SPI mode.

from pyftdi.

 avatar commented on August 19, 2024

Thanks a lot,I can configure the ACBUS using SpiController().get_gpio() now.

from pyftdi.

eblot avatar eblot commented on August 19, 2024

Re-opening this feature request as it would be great to provide GPIO support for ACBUS with bit bang mode as well.

from pyftdi.

darlington72 avatar darlington72 commented on August 19, 2024

Dear all,

Finally, is it possible to control both SPI on AD0/1/2 and CS on AD4 + an extra gpio output on AC3 with an FT2232D?
In my case, the SPI perfectly works with AD0/1/2 and CS on AD4 but I can't add the extra gpio output on AC3.

Im in an Ubuntu environnement, with python3, pylibftdi 0.16.1.2, pyusb 1.0.0 and pyftdi 0.28.5.
I tried the example "Example: communication with a SPI device and an extra GPIO".

Thank you!

from pyftdi.

eblot avatar eblot commented on August 19, 2024

There was an issue with ACBUS, it should now be supported (v0.28.7), which has been tested with a FTDI2232H.

I do not have a FT2232D at hand - this is a really legacy device, I'm afraid I cannot test it by now.

from pyftdi.

darlington72 avatar darlington72 commented on August 19, 2024

Dear Mr Blot,

Thanks for your answer and to added example on spi with gpio access.
I don't understand the philosophy on how to use functions. In my case, I'm working with:
AD0: SCLK, AD1: MOSI, AD2: MISO, AD4: /CS (AD3 unused)
+AC3 a gpio output.
I suppose I should:

  1. self._spi.get_port(0, freq=1E6, mode=0)
  2. self._spi.get_gpio()
  3. self._io.set_direction(?,?)
  4. self._io.write(?)
  5. self._port.exchange(data,length)
  6. self._io.write(0)

Is that the correct way to dessert the gpio pin, do an spi access (with CS on AD4) and then reassert the gpio pin? Which value should I put on the parameters?

I'll be able to confirm (or not) that the issue with ACBUS is supported on FT2232D.

Thank you!

from pyftdi.

eblot avatar eblot commented on August 19, 2024

/CS are supposed (at least with PyFtdi) be in-order, starting from the first pin after the three mandatory SPI signals (AD0/AD1/AD2). If you do not use AD3 for /CS, but you use AD4 for the first /CS signal, AD3 is still reserved for another /CS and cannot be re-used for GPIOs, i.e. in your case:

  • AD0: SCLK
  • AD1: MOSI
  • AD2: MISO
  • AD3: N.C.
  • AD4: /CS
  • AD5,AD6,AD7: GPIOs
  • AC0,AC1,AC2,AC3: GPIOs

You still need to declare 2 /CS signal, and only use the second one, i.e.

 self._spi = SpiController(cs_count=2)  # AD3, AD4
 port = self._spi.get_port(1, freq=6E6, mode=3)  # port 0 is AD3, not used

then if you want to re-use the SPIO GPIO unit test, you need to perform the test on only 3 pins instead of 4, as there are only 3 AD pins available for GPIO, i.e. something roughly like this:

 ad_pins = ((1 << 3) - 1) << 5  # AD5-AD7 as input
 ac_pins = ((1 << 3) - 1) << 9  # AC1-AC3 as output
 io_pins = ad_pins | ac_pins

 # ...

 for ac_ in range(1 << 3):  # only 3 pins
    ac = ac_ << 1           # skip LSB (AD4/AC0)
    # ...

with:

  • AD5 connected to AC1
  • AD6 connected to AC2
  • AD7 connected to AC3
  • AC0 not connected

from pyftdi.

darlington72 avatar darlington72 commented on August 19, 2024

I have an equipment (fpga) behind the ft2232D, so when I deassert and reassert AC gpios, I have something different than the example. But in my case, I confirm that your example with SPI + 2 extra GPIOS (/CS and ACBUS) perfectly works on the FT2232D.

Thank you!!

from pyftdi.

eblot avatar eblot commented on August 19, 2024

Ok, thanks for the feedback!

from pyftdi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.