We had been fighting the
Camera: Inititialized abnormally with code 131 error. Sometimes the camera would work perfectly. Then other times it would fail initialization. It was very inconsistant. Sometimes we would have to pull the backup battery and reset the RC to get it to initialize.
When I tried using the cmu cam on a VEX it happened everytime. I thought it was a hardware communication problem.
My theory is that sometimes the camera "misses" the commands sent during boot initialization. Possibly the camera processor is still initializing? I think the problem is worse on a vex because the getdata loop time is only 18ms on the vex vs 26ms on a FRC.
I added a bit of code in the camera initialization routine. If the initialization fails with error 131 it resets the boot initialization flag.
So far this has completely fixed the problem. The initialization will still fail the first time at state 3. The camera then initializes sucessfully at the next call to Initialize_Camera. It now works great on both the FRC and VEX controllers.
I added the below code to the end of the Initialize_Camera routine in Kevin's camera.c. It goes just before
return(return_value);
Code:
//Added 3/26/2006 AAT
//If initialization fails after waiting for first ACK
//in state 3, retry boot initialization.
if(return_value == 131)
{
boot_initialization_flag = 1;
}
alan