Index: App/Services/FPGA.c =================================================================== diff -u -r4e49b5f4036964295a7f8341a860023d319569cc -r1bd1ef307be5997209c42219d5be381bbeffabe4 --- App/Services/FPGA.c (.../FPGA.c) (revision 4e49b5f4036964295a7f8341a860023d319569cc) +++ App/Services/FPGA.c (.../FPGA.c) (revision 1bd1ef307be5997209c42219d5be381bbeffabe4) @@ -140,6 +140,8 @@ static void setupDMAForReadResp( U32 bytes2Receive ); static void startDMAReceiptOfReadResp( void ); +static void consumeUnexpectedData( void ); + /************************************************************************* * @brief initFPGA * The initFPGA function initializes the FPGA module. @@ -240,6 +242,9 @@ fpgaDMAReadRespControlRecord.ELSOFFSET = 0; // not used fpgaDMAReadRespControlRecord.FRDOFFSET = 0; // not used fpgaDMAReadRespControlRecord.FRSOFFSET = 0; // not used + + // there shouldn't be any data pending yet + consumeUnexpectedData(); } /************************************************************************* @@ -471,6 +476,9 @@ } + // shouldn't be any data received at this time + consumeUnexpectedData(); + return result; } @@ -562,6 +570,9 @@ // TODO - ??? } + // shouldn't be any data received at this time + consumeUnexpectedData(); + return result; } @@ -790,3 +801,24 @@ fpgaHeader.fpgaControl = ctrl; } +/************************************************************************* + * @brief consumeUnexpectedData + * The consumeUnexpectedData function checks to see if a byte is sitting in \n + * the SCI2 received data register. + * @details + * Inputs : fpgaHeader + * Outputs : none + * @param none + * @return fpgaDiag + *************************************************************************/ +static void consumeUnexpectedData( void ) +{ + // clear any errors + sciRxError( scilinREG ); + // if a byte is pending read, read it + if ( 0 != sciIsRxReady( scilinREG ) ) + { + sciReceiveByte( scilinREG ); + } +} +