I've got a simple application that hangs on power reset. I'm programming it with the P&E USB Multilink through the debug screen in CodeWarrior. The target is set correctly.
Once I disconnect the P&E and do a power cycle, the chip just hangs. I'm using LEDs to verify correct operation.
However, if I comment out my readData (listed below) function which reads data from the UART, everything will function on a power reset. I've tried both interrupt based and polling for the UART, and it makes no difference.
//=============================================================================
// readData
//-----------------------------------------------------------------------------
//=============================================================================
int readData(void *dataBuffer, int dataBufferSize)
{
int returnValue = 0;
int i;
// If we have a bad data buffer pointer then we fail.
if(dataBuffer == 0)
{
goto EXIT;
}
for(i=0;i<dataBufferSize;i++) {
while (SCIS1_RDRF == 0);
((unsigned char*)dataBuffer)[i] = SCID;
SCIS1_RDRF = 0; //acknowledge Receiver Full flag
}
returnValue = 1;
EXIT:
return returnValue;
}
Is there something about the RX on the UART that would prevent the chip from reseting properly?
I also have a TX function in there and it works fine. So I don't think it's the entire UART.
Any help is greatly appreciated.
James