I had a nice working FT232 program that was doing well for days. I restarted it often, rewired, reconnected the device, etc. and it was working great. Then I came back a week later and it didn’t work! What could have happened? Loose wires would seem obvious, but that didn’t check out. Fried chip? I hoped not but swapped them out. Bad breadboard? That was a longshot but I was getting desperate. Forgotten last minute code change? I couldn’t see it. What could the issue be?
Strangely, other programs worked fine with the same or similar components. Then I minimalized the circuit and code and it still behaved strangely (wouldn’t even toggle a single bit). Finally it occurred to me that my code no longer set the bit mode before each write. At one point I had assumed that could be rarely done and the code would work, and maybe that would speed things a bit. And generally that seems to be true, as evidenced by my earlier experience. But under some circumstances (I’m not sure what, but something to do with running other programs, I suppose), this detail can become important.
So the conclusion is: to be safe, set the bit mode before your writes:
SM.bitBang_SetBitMode(ftHandle, 15, 0x1); // use the first 4 bits of the D bus