libFTDI based program does not read properly pin state of FT245
This post was updated on .
I use Asus router (based on ARMv7 proc) with Advanced Tomato installed
on it as my ARMv7 developer platform. I install compiler (gcc - 5.4.0-1)
plus dependencies and libFTDI (libftdi1 - 1.3-1) from OpenWRT Linux
I wrote a program on Linux x86_64 platform, using `ftd2xx` library taken from chip manufacturer producer. It works properly. But now I want to port it on ARMv7 platform, using Open Source `libFTDI` library.
I use ft245 chip based board. Pins number 0 to 3 acts as relay outputs while pins 4-7 as optoisolated inputs. My goal is, that running program (named arco) with parameter 0 to 15 turns on/off appropriate relays. Additionally, after such running, program returns actual state of all pins in hex. Running program without parameter, simply returns state of all 8 pins as hex number.
My problem is that when I run program using syntax for example `arco 7` it turn on relays number 0 to 2 and turn off relay number 3. So it is correct. But `ftdi_read_data` returns not actual state of pins but previous. When I run `arco` for the second time (without parameters) it returns correct value.