Wow! I haven't had a circuit kick my ass like this one in a LONG time. I have two boards that need to exchange (4) bytes of information from board
-A to board-B only.
Unfortunately, the original designer (me) didn't really think ahead, and so there really is no provision for the two boards to talk to each other.
So, (and I'm in a rush, as usual), I thought I could take an easy way out ( which is now turning into a mini-nightmare.)
Board-A powers-up the regulators on Board-B, which take several millisecond s to ramp-up, and for the Board-B processor to come out of reset.
OK - no problem so far -- works exactly as expected. Board A "knows" that timing, and so Board-B can be inferred (sloppily) sinc e the range of startup time across Board-B samples isn't significant.
So, I figured all I would have to do is to time the data exchange. (i.e., send out a byte every 100mS or so, hold it on the port, and have boa rd-A sample it somewhere near the middle of the windows.)
Speed is not important.
And I can't get this damn thing to work!
The timing is perfect (verified on a scope to within 20 uSec timing), in a window 100 mS wide. And I still can't get the damn thing to work.
And by work: I mean.... Of the (4) bytes I'm trying send -- three of them always transfer and work just fine. The forth one (which also always arrives on time), always has (
2) bits forced LOW.And for the life of me, I don't know why. ??! It is frustrating beyond belief.
I have done the "divide and conquer" thing, and have it narrowed down to th e interface (which is just 8 opto's) Good to 100 kHz, no problem there. A ND - did I mention, work just fine with the other bytes, and also with some test code just rotating bits.
But hook it up to the real Board-B and everything goes to shit. Well, not everything, just the two bits of the aforementioned byte. So, I go in the code and FORCE those values, and the same two bits are bad. It's like havi ng a bad connector that selectively ohms out OK, depending on what data you send. It is driving me batty!!
I am honestly out of ideas. Well - one thing I haven't checked (and is super-highly-unlikely to be the problem): is that maybe the Compiler is screwing me over. But that's a rea ch.
OK. My mini-rant is over. At this point, I could have redesigned both boards and been ahead of the ga me. (And of course, I'm under some pressure to get the boards released.)
Right.....