Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r19056bcb960b73405326d038abcea63b6862e344 -rb9d28fa9e2605dbb331da473fcf166dbf5346be5 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 19056bcb960b73405326d038abcea63b6862e344) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision b9d28fa9e2605dbb331da473fcf166dbf5346be5) @@ -29,6 +29,7 @@ #include "OperationModes.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" +#include "Timers.h" #include "Utilities.h" /** @@ -93,6 +94,8 @@ /// FPGA size of V3 read bytes. #define FPGA_SIZE_OF_V3_READ_BYTES ( FPGA_READ_V3_END_BYTE_NUM - FPGA_READ_V3_START_BYTE_NUM ) +#define PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE 1 ///< Tolerance for processor clock speed check against FPGA clock. + // FPGA header struct. #pragma pack(push,1) typedef struct @@ -340,6 +343,11 @@ static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. static U08 fpgaReadByteSize; ///< FPGA read byte size. +#ifndef DEBUG_ENABLED +static U16 currentFPGATimerCount_ms; ///< Current FPGA timer count in ms. +static U32 currentTimerCount_ms; ///< Current processor timer count in ms. +#endif + // ********** private function prototypes ********** static FPGA_STATE_T handleFPGAReadHeaderState( void ); @@ -901,7 +909,7 @@ U32 const diffFPGATimerCount = (U32)u16DiffWithWrap( currentFPGATimerCount_ms, newFPGATimerCount_ms ); U32 const diffTimerCount = u32DiffWithWrap( currentTimerCount_ms, newTimerCount_ms ); - if ( getCurrentOperationMode() > MODE_INIT ) + if ( getCurrentOperationMode() != MODE_INIT ) { if ( abs( diffFPGATimerCount - diffTimerCount ) > PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE ) { @@ -913,6 +921,7 @@ currentTimerCount_ms = newTimerCount_ms; #endif } + /*********************************************************************//** * @brief * The setupDMAForWriteCmd function sets the byte count for the next DMA