Wednesday, May 25, 2011

We are ePIC Win

After gluing everything together and taping things down, we have checked off. We also did our first test drive in Hoop Fountain, and even made it through the heavy water jets. Still to come are the presentation tomorrow and video of the boat driving around, once we get around to uploading it.

Sunday, May 22, 2011

CVC functional (almost)

The CVC has been entirely migrated to the soldered board, including all Molex connections. The only thing left is to transfer from wall wart to battery power on the E128. Unfortunately one battery isn't enough to power everything, and the TA office is out of them. So we have to fetch one soon. It also requires some small tweaks to the board to get a second battery on, but there is still space (barely).

Plus the CVC needs a home, but that seems to be coming very soon thanks to Matt's rapid SolidWorks skills. It'll be pretty satisfying to finally drive the boat around in the water soon.

Final Push

Glad the CVC and ACV are functional. Good job to Preyas and Matt for figuring out the problem with the voltage regulators!

The next steps seem to be finishing the CVC, including integrating a funny hat with the accelerometer. Plus wire management and connecting everything, like batteries and switches. I need to add code to reset the atoll statuses at the start of a game. And there are probably some wires that could use Molex connectors at the end. So, all the little things that will make everything finally work together.

Saturday, May 21, 2011

Trust

It was a weird day. We had both ACV and CVC soldered. We had already checked that the CVC ckt worked alright. We had failed once with the ACV circuit. We had burned a pic in the process, so Matt and I were apprehensive about testing out the same ckt again (with some modifications). So we put all the pieces and chips in the sockets and turned on the power supply. We tried to see if we got any UART response from the bus pirate when we swiped the card in front of the reader. It wasn't working. Again. We checked if some chips were getting hot, as had turned out in the last attempt, and they were this time too! Then out of respect to Jackie's efforts in soldering, we decided that there was something wrong about the way we were doing it. We traced our paths back and couldn't find any problem. Just out of whim, we decided to switch our power supply source to the batteries we had. We though that it may be wrong driving  the o/p pins of the voltage regulator with the external power supply we connected initially. Apparently the 7805 isn't reverse protected. This time, with the batteries as power, we incrementally went about testing the ckt- RFID reader output. It worked. Then we added in the RFID PIC. It worked. Then added in the Security chip related PIC. It worked. Then added in the security controller. It worked. Then added in the main PIC. It worked! I texted Jackie and congratulated her on her effort. She looked satisfied, evident from the text back.

This brings me to the thing that got us through today- trust. We just happened to trust each other more at crucial moments and prevented a mega-soldering effort that Matt and I had planned for tomorrow. I am amazed how much trust one can have in someone you know well only since last couple of weeks

Tuesday, May 17, 2011

A battle of epic proportions

I spent 3 days trying to figure out why the pickit3 debugger wasn't stopping at simple breakpoints and why a seemingly correct code worked sometimes and didn't most of the times. Things looked to have a probabilistic flavor and I was almost sure I would have to find the expected number of times I need to burn the same code, though that wouldn't guarantee anything! It was an epic battle. First I found some module variables weren't getting initialized to right value. Ruslan and I forced it to work in this case by manually setting those variables to required values. Then I included the 'finding the teammate' part of my code and things went as wrong as they can go only in hell- the code simply stopped executing at a particular fixed line. Certainly I had no clue and neither did the great Ed! Then I turned towards the simple Eric Wei and his amazing insights and asked him to use his brain's awesome computing power and fix it for me. We commented out the line where the code got stuck and tried to stop at the breakpt. And it worked! Then I uncommented that line and  it still worked! I promised him a treat, but Ed wasn't happy because now the problem was 'lost' and could not be reproduced. Being a follower of procedures, I did as Ed had told me- restarted the entire workstation devices, including the computer. Then I checked if the problem still persisted, and it did! I had given up and just decided to initialize my set of variables inside my Init function instead of initializing them outside during declaration. It seemed to make the debugger stop at the breakpts I set but it didn't stop at breakpts set later than a particular line, as if it were 'offset'. Then I decided to check what worked in my old code (the one with the old timer) and new code (new timer).I had always thought the new timer was causing the problems, but I realized that I had fewer state machines in the old code.  Just on a whim, I decide to remove one of the 3 parallel state machines I was using and instead code it up in an interrupt routine like I had in old code. I also ditched the debugger for the seemingly more reliable picstart plus programmer. This I tried in the checkpt2 code and it worked. I held my breath and tried it with the complete code, and it worked! Fittingly, it was an ePIC Win! The only explanation I can think of is that the compiler is not able to handle long codes even if it wasn't using its complete program memory. So eliminating one of the state machines and coding it up as an interrupt response routine reduced the number of lines of code to some acceptable value for the compiler. Bottomline, don't trust the Lite Mode Hitech Compiler for C for PICs.

~Preyas.

P.S. I still feel 'violated' as a manner of speaking because the stupid compiler was at fault and wasted precious 3 days that I could have used for something else. And boasted about in the spdl. Damn all the Murphys of the world.

Next: Battle of the Xbee, Jackie

Sunday, May 15, 2011

Screwed Up Project Specs

Fixed the problem with the RFID and security chip. It wasn't sending valid codes! wasted almost half a day on figuring that out. They should have made project specs clearer, specially with ACV replacing DCH everywhere :P.  Ryan and Will have done well though. Couldn't have had better TAs.
Also came across the weirdest compiler thing. Ruslan and I sat down and fixed it. Now we have sweet 8 software timers at out disposal. Aye aye, Barbosa!

Monday 16 May, 12pm 44min 34s (Pacific Time): finished coding on ACV. works fine

Status

Into the final 11 days. We are at a good position. Major part of coding is over. Soldering the electrical circuits now. Facing a couple of problems in talking with the atoll. should be able to address them soon. Otherwise, we are ready for chkpt 2 3 days before it! Matt finally working on some respectable prototype and things seem to be exciting.