(obligatory vocabulary builder link.)
Two all-nighters in a row. That's a new record for me. 5 hours of sleep in the last 36. All worth it, though. About 6:30am I was staring failure straight in the face. But I bulled through, jack-ass stubborn as I am. This project is two weeks overdue already, and I wasn't about to go to a second demo at the customer site without something to show for it. Especially since we had to call them and delay the demo yesterday.
Everything I said earlier about bad tools extends to silicon too. Someone at Microchip deserves a sharp poke in the eye for making the proper functionality of a countdown timer entirely dependent on a register bit that the data sheet explicitly labels as "don't care." (Not "unimplemented, read as zero" - it actually says "if this other bit is 0, this bit is a don't care.") Though another thing that cost me hours was my own fault. It turns out my checksum routine had been failing to check and/or sum the last character of each packet. I hadn't noticed before because the checksum is a simple XOR, and the character it wasn't checksumming was a 0 byte. Argh. The checksum is now seeded with 0xAA, in an effort to prevent that kind of thing from happening, and make it more difficult for bytes with a high bit set (easy to confuse with the beginning-of-packet address) to slip through.
The demo itself went pretty well, modulo a few hardware issues. Interesting thing about car batteries - they're designed to be able to throw down a few hundred amps of current in milliseconds. Guess what happens when you hook up power and ground wrong? Yeah. I have never seen a tantalum capacitor glowing orange-hot before. Hehe. We're still blowing up H bridge boards, and we don't know why. We've blown up our main microcontroller once already due to feedback from the motor board too, and today we fried a CPLD the same way. So that's pretty much all bad just now. ;]
Going back Monday, hopefully with a few more spare pieces of hardware. But I think we're pretty close to wrapping this one up. Finally!