Camera glitch / failure

I am having a problem with the 2005 camera code and the 2006 controller. The camera will “glitch” randomly and never recover. I have had the thing run for 30 minutes with no problems, and yet sometimes it will give out in five seconds!

It is giving all the appearences of a receive failure, and resetting the RC is the only thing that can make it recover. I have tried 2 different camera boards, with and without the TTL converter (made a special cable for without!). I have tried software and hardware resetting the camera board, to no avail. (It resets the camera board, but the RC never seems to receive anything, including the power-on ACKs, after the failure).

Can anyone help me on this? It is frustrating me to no end. When I say random, I mean random! :ahh: :confused: :frowning: :mad:

I wonder if this will clear up the problem? It looks as if maybe we are setting the RX overflow bit now and them (maybe due to a coincidental firing of a lot of interrupts in a short period of time), and this will halt the RX completely until the following code is called.

Kevin, could you please help me with this? I haven’t worked directly with the PIC USARTs before. :slight_smile:

    RCSTA2bits.CREN = 0;		// Make sure the receive is still enabled!
    RCSTA2bits.CREN = 1;
    RXINTE2 = 1;

Make sure the serial port receive interrupts are the first to get serviced in the low-priority ISR. If it is an overrun error, you can only fix it by resetting the serial port Rx circuit with this code:

// if the interrupt handler was disabled while data was being received,
// data may have backed-up in the receiver circuitry, causing an overrun
// condition. So let's check the OERR bit to see if this has happened
// and if it has, we'll need to reset the serial port receiver circuitry
// to get data flowing again.
// reset by turning off the receiver circuitry, then...
RCSTA1bits.CREN = 0;
// ...turn it back on
RCSTA1bits.CREN = 1;
// indicate that we've had an error

If you’re using my serial port driver, this is automatically handled in the Rx ISRs. If you aren’t using my code, you can place this code in the fast loop.


OK, thanks. That worked just great! :slight_smile:

It is maddening to waste a few days trying to fix an error that can be fixed by flipping one bit. :rolleyes: