Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r8d390efa9309c8a0f430ba4652528fdbdbb6e2b8 -rfefb47e88a5285e99498efb830fdceb9e95c2c3e --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 8d390efa9309c8a0f430ba4652528fdbdbb6e2b8) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision fefb47e88a5285e99498efb830fdceb9e95c2c3e) @@ -76,10 +76,10 @@ #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define FPGA_CONC_PUMP_FAULT_BITS 0x03 ///< Concentrate pump fault bits mask. -#define FPGA_CP1_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. -#define FPGA_CP2_PARKED_BIT 0x10 ///< Concentrate pump 2 parked status bit mask. -#define FPGA_CP1_PARK_FAULT_BIT 0x08 ///< Concentrate pump 1 park fault status bit mask. -#define FPGA_CP2_PARK_FAULT_BIT 0x20 ///< Concentrate pump 2 park fault status bit mask. +#define FPGA_CPA_PARKED_BIT 0x04 ///< Concentrate pump 1 parked status bit mask. +#define FPGA_CPB_PARKED_BIT 0x10 ///< Concentrate pump 2 parked status bit mask. +#define FPGA_CPA_PARK_FAULT_BIT 0x08 ///< Concentrate pump 1 park fault status bit mask. +#define FPGA_CPB_PARK_FAULT_BIT 0x20 ///< Concentrate pump 2 park fault status bit mask. #define FPGA_CONC_PUMP_PARK_COMMAND 0x80 ///< Park command bit for the concentrate pumps. #define FPGA_THD_CONTROL_COMMAND 0X01 ///< FPGA THd control command. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. @@ -182,6 +182,29 @@ U08 fpgaValveBCPWMStates; ///< Reg 351. Balancing Chamber Valve PWM states U08 fpgaValveUFStates; ///< Reg 352. Ultrafiltration Valves states U08 fpgaValveUFPWMStates; ///< Reg 353. Ultrafiltration Valves PWM states + U08 fpgaCPACPBFault; ///< Reg 354. Concentrate pump fault register for CPA and CPB + U16 fpgaCPAHallSense; ///< Reg 355. Concentrate pump CPA hall sensor pulse width + U16 fpgaCPBHallSense; ///< Reg 357. Concentrate pump CPB hall sensor pulse width + + F32 fpgaTax1Temp; ///< Reg 359. Inlet heat exchanger temperature + F32 fpgaTH2Temp; ///< Reg 363. Inlet heat exchanger temperature + F32 fpgaTH1Temp; ///< Reg 367. Hydraulics primary heater temperature + F32 fpgaTH3Temp; ///< Reg 371. Trimmer heater temperature + U08 fpgaRTDReadCnt; ///< Reg 375. Read count for all RTD sensors + + U08 fpgaBaroReadCount; ///< Reg 376. Barometric sensor read count + U08 fpgaBaroErrorCount; ///< Reg 377. Barometric sensor error count + U16 fpgaBaroManufacInfo; ///< Reg 378. Barometric sensor manufacturing information + U16 fpgaBaroPROMCoeff1; ///< Reg 380. Barometric sensor PROM coefficient 1 + U16 fpgaBaroPROMCoeff2; ///< Reg 382. Barometric sensor PROM coefficient 2 + U16 fpgaBaroPROMCoeff3; ///< Reg 384. Barometric sensor PROM coefficient 3 + U16 fpgaBaroPROMCoeff4; ///< Reg 386. Barometric sensor PROM coefficient 4 + U16 fpgaBaroPROMCoeff5; ///< Reg 390. Barometric sensor PROM coefficient 5 + U16 fpgaBaroPROMCoeff6; ///< Reg 392. Barometric sensor PROM coefficient 6 + U16 fpgaBaroPROMCRC; ///< Reg 394. Barometric sensor PROM CRC + U32 fpgaBaroPressure; ///< Reg 396. Barometric sensor pressure value + U32 fpgaBaroTemperature; ///< Reg 400. Barometric sensor temperature sensor + } DD_FPGA_SENSORS_T; typedef struct @@ -521,7 +544,7 @@ /*********************************************************************//** * @brief * The setFPGABicarbSetStepSpeed function sets the step speed period for - * concentrate pump CP2. + * concentrate pump CPB. * @details \b Inputs: none * @details \b Outputs: fpgaActuatorSetPoints.fpgaCPBSpeed * @param stepSpeed The concentrate pump step speed period @@ -1271,6 +1294,109 @@ /*********************************************************************//** * @brief + * The getFPGAConcentratePumpsFault function gets concentrate pumps fault + * reported by FGPA. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return Latest concentrate pumps fault value + *************************************************************************/ +U08 getFPGAConcentratePumpsFault( void ) +{ + return fpgaSensorReadings.fpgaCPACPBFault & FPGA_CONC_PUMP_FAULT_BITS; +} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpIsParked function gets whether the acid pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if acid pump is parked, FALSE if not + *************************************************************************/ +BOOL getFPGAAcidPumpIsParked( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARKED_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpIsParked function gets whether the bicarb pump is currently + * parked. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if bicarb pump is parked, FALSE if not + *************************************************************************/ +BOOL getFPGABicarbPumpIsParked( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARKED_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGAAcidPumpParkFault function gets whether the acid pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if acid pump park command faulted, FALSE if not + *************************************************************************/ +BOOL getFPGAAcidPumpParkFault( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPA_PARK_FAULT_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGABicarbPumpParkFault function gets whether the bicarb pump park command + * has faulted. + * @details \b Inputs: fpgaSensorReadings.fpgaCPACPBFault + * @details \b Outputs: none + * @return TRUE if bicarb pump park command faulted, FALSE if not + *************************************************************************/ +BOOL getFPGABicarbPumpParkFault( void ) +{ + U08 mask = fpgaSensorReadings.fpgaCPACPBFault & FPGA_CPB_PARK_FAULT_BIT; + BOOL result = ( mask > 0 ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getFPGACPAHallSensePulseWidth function gets concentrate pump CPA + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCPAHallSense + * @details \b Outputs: none + * @return concentrate pump CPA hall sense pulse width + *************************************************************************/ +U16 getFPGACPAHallSensePulseWidth( void ) +{ + return fpgaSensorReadings.fpgaCPAHallSense; +} + +/*********************************************************************//** + * @brief + * The getFPGACPBHallSensePulseWidth function gets concentrate pump CPB + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaCPBHallSense + * @details \b Outputs: none + * @return concentrate pump CPB hall sense pulse width + *************************************************************************/ +U16 getFPGACPBHallSensePulseWidth( void ) +{ + return fpgaSensorReadings.fpgaCPBHallSense; +} + +/*********************************************************************//** + * @brief * The getFPGAValveStates function gets the latest sensed valve states. * See setFPGAValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates @@ -1845,6 +1971,223 @@ /*********************************************************************//** * @brief + * The getFPGAInletHeatExchangerTemp function gets the inlet heat exchanger + * temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return inlet heat exchanger temperature + *************************************************************************/ +U32 getFPGAInletHeatExchangerTemp( void ) +{ + return fpgaSensorReadings.fpgaTax1Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGAOutletHeatExchangerTemp function gets the outlet heat exchanger + * temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return outlet heat exchanger temperature + *************************************************************************/ +U32 getFPGAOutletHeatExchangerTemp( void ) +{ + return fpgaSensorReadings.fpgaTH2Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGAHydraulicsPrimaryHeaterTemp function gets the hydraulics primary + * heater temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return hydraulics primary heater temperature + *************************************************************************/ +U32 getFPGAHydraulicsPrimaryHeaterTemp( void ) +{ + return fpgaSensorReadings.fpgaTH1Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGATrimmerHeaterTemp function gets the trimmer heater temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return trimmer heater temperature + *************************************************************************/ +U32 getFPGATrimmerHeaterTemp( void ) +{ + return fpgaSensorReadings.fpgaTH3Temp; +} + +/*********************************************************************//** + * @brief + * The getFPGARTDReadCount function gets the RTD sensors group read count. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return RTD read count + *************************************************************************/ +U08 getFPGARTDReadCount( void ) +{ + return fpgaSensorReadings.fpgaRTDReadCnt; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroReadCount function gets the FPGA barometric sensor read count. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor read count + *************************************************************************/ +U08 getFPGABaroReadCount( void ) +{ + return fpgaSensorReadings.fpgaBaroReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroErrorCount function gets the FPGA barometric sensor error count. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor error count + *************************************************************************/ +U08 getFPGABaroErrorCount( void ) +{ + return fpgaSensorReadings.fpgaBaroErrorCount; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroMfgInfo function gets the FPGA barometric pressure + * sensor manufacturing information. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor manufacturing information + *************************************************************************/ +U16 getFPGABaroMfgInfo( void ) +{ + return fpgaSensorReadings.fpgaBaroManufacInfo; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressureSensitivity function gets the FPGA barometric pressure + * sensor sensitivity. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor sensitivity + *************************************************************************/ +U16 getFPGABaroPressureSensitivity( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff1; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressureOffset function gets the FPGA barometric pressure + * sensor offset. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor offset + *************************************************************************/ +U16 getFPGABaroPressureOffset( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff2; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfPressSensitvity function gets the FPGA barometric + * pressure sensor temperature coefficient of pressure sensitivity. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor temperature coefficient of pressure sensitivity + *************************************************************************/ +U16 getFPGABaroTempCoeffOfPressSensitvity( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff3; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfPressOffset function gets the FPGA barometric + * pressure sensor temperature coefficient of pressure offset. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor temperature coefficient of pressure offset + *************************************************************************/ +U16 getFPGABaroTempCoeffOfPressOffset( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff4; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroReferenceTemperature function gets the FPGA barometric pressure + * sensor reference temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor reference temperature + *************************************************************************/ +U16 getFPGABaroReferenceTemperature( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff5; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTempCoeffOfTemperature function gets the FPGA barometric pressure + * sensor temperature coefficient of temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor temperature coefficient of temperature + *************************************************************************/ +U16 getFPGABaroTempCoeffOfTemperature( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCoeff6; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroCoeffsCRC function gets the FPGA barometric pressure + * sensor temperature coefficients' CRC. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor temperature coefficients' CRC + *************************************************************************/ +U16 getFPGABaroCoeffsCRC( void ) +{ + return fpgaSensorReadings.fpgaBaroPROMCRC; +} + +/*********************************************************************//** + * @brief + * The getFPGABaroPressure function gets the FPGA barometric pressure sensor + * pressure. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor pressure + *************************************************************************/ +U32 getFPGABaroPressure( void ) +{ + return ( fpgaSensorReadings.fpgaBaroPressure & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief + * The getFPGABaroTemperature function gets the FPGA barometric pressure sensor + * temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return barometric pressure sensor temperature + *************************************************************************/ +U32 getFPGABaroTemperature( void ) +{ + return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); +} + +/*********************************************************************//** + * @brief * The checkFPGACommFailure function increments the FPGA comm failure * windowed timer and returns whether or not the number of failures in * the window have been reached.