Index: App/Services/FPGA.c =================================================================== diff -u -rc8c2c1b2a5b2d4836d19fa3c719446c3089c4a36 -ra1c9eabfc633bc7e3ef370096b655b87a08e2e52 --- App/Services/FPGA.c (.../FPGA.c) (revision c8c2c1b2a5b2d4836d19fa3c719446c3089c4a36) +++ App/Services/FPGA.c (.../FPGA.c) (revision a1c9eabfc633bc7e3ef370096b655b87a08e2e52) @@ -476,8 +476,13 @@ // did FPGA Ack the read command? if ( fpgaReadResponseBuffer[0] == FPGA_READ_CMD_ACK ) { + U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(FPGA_HEADER_T); + U32 crcPos = rspSize; + U16 crc = MAKE_WORD_OF_BYTES( fpgaReadResponseBuffer[crcPos+1], fpgaReadResponseBuffer[crcPos] ); + // does the FPGA response CRC check out? - if ( 1 ) // TODO - check response CRC + if ( crc == crc16( fpgaReadResponseBuffer, rspSize ) ) +// if ( 1 ) // TODO - remove when FPGA CRCs are implemented { fpgaCommRetryCount = 0; // capture the read values @@ -571,7 +576,7 @@ // check bulk write command success if ( ( FALSE == fpgaWriteCommandResponseReceived ) || ( fpgaWriteResponseBuffer[0] != FPGA_WRITE_CMD_ACK ) ) { - // TODO - ??? + fpgaCommRetryCount++; } // if bulk read command is ACK'd, collect the readings @@ -580,8 +585,13 @@ // did FPGA Ack the read command? if ( fpgaReadResponseBuffer[0] == FPGA_READ_CMD_ACK ) { + U32 rspSize = FPGA_READ_RSP_HDR_LEN + sizeof(FPGA_SENSORS_T); + U32 crcPos = rspSize; + U16 crc = MAKE_WORD_OF_BYTES( fpgaReadResponseBuffer[crcPos+1], fpgaReadResponseBuffer[crcPos] ); + // does the FPGA response CRC check out? - if ( 1 ) // TODO - check response CRC + if ( crc == crc16( fpgaReadResponseBuffer, rspSize ) ) +// if ( 1 ) // TODO - remove when FPGA CRCs are implemented { fpgaCommRetryCount = 0; // capture the read values