Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -ra9983d3e6b07e7c927fab3d16e80b715594fe221 -r3cc784af591b14e5d292f92c796db70bcbd5a40b --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision a9983d3e6b07e7c927fab3d16e80b715594fe221) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 3cc784af591b14e5d292f92c796db70bcbd5a40b) @@ -244,6 +244,8 @@ U16 fpgaD74CondTemp; ///< Reg 438. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 440. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 441. D74 error read count + U16 fpgaD76PumpHallSense; ///< Reg 442. UF D76_Pump hall sensor pulse width + U16 fpgaD76PumpStepCountStatus; ///< Reg 444. UF pump revolution down count status } DD_FPGA_SENSORS_T; typedef struct @@ -342,7 +344,9 @@ U08 fpgaConSensD74Control; ///< Reg 152. Conductivity/Temperature Sensors D74 Control registers U16 fpgaConSensD74_Addrs; ///< Reg 153. D74 Initialization Address register U32 fpgaConSensD74_Data_In; ///< Reg 155. D74 Initialization data register - + U16 fpgaD76PumpSpeed; ///< Reg 159. UF Pump Speed/RPM Control + U08 fpgaD76PumpControl; ///< Reg 161. UF Pump Control + U16 fpgaD76PumpRevCount; ///< Reg 162. UF pump revolution count } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -637,6 +641,20 @@ /*********************************************************************//** * @brief + * The setFPGAD76PumpSetStepSpeed function sets the step speed period for + * UF D76_Pump. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpSpeed + * @param stepSpeed The concentrate pump step speed period + * @return none + *************************************************************************/ +void setFPGAD76PumpSetStepSpeed( U16 stepSpeed ) +{ + fpgaActuatorSetPoints.fpgaD76PumpSpeed = stepSpeed; +} + +/*********************************************************************//** + * @brief * The setFPGAD11PumpControl function sets the DVT concentrate pump 1 * (acid pump) control mode. * bit 7: Park (set in different function) @@ -679,6 +697,27 @@ /*********************************************************************//** * @brief + * The setFPGAD76PumpControl function sets the UF pump + * (D76 pump) control mode. + * bit 7: Park (set in different function) + * bit 6: nSleep + * bit 5: nReset + * bit 4: nEnable + * bit 3: Direction (1=Fwd, 0=Rev) + * bit 0-2: Microstepping resolution + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl + * @param control UF pump control set + * @return none + *************************************************************************/ +void setFPGAD76PumpControl( U08 control ) +{ + fpgaActuatorSetPoints.fpgaD76PumpControl &= FPGA_CONC_PUMP_PARK_COMMAND; // preserve msb (park command bit) + fpgaActuatorSetPoints.fpgaD76PumpControl |= control; +} + +/*********************************************************************//** + * @brief * The setFPGAD11PumpParkCmd function sets the DVT concentrate pump 1 * (acid pump) park command bit. * bit 7: Park command bit @@ -711,6 +750,22 @@ /*********************************************************************//** * @brief + * The setFPGAD76PumpParkCmd function sets the Ultrafiltration pump + * (D76 pump) park command bit. + * bit 7: Park command bit + * bit 0-6: Other pump control bits (set in different function) + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl + * @param Park command bit set + * @return none + *************************************************************************/ +void setFPGAD76PumpParkCmd( void ) +{ + fpgaActuatorSetPoints.fpgaD76PumpControl |= FPGA_CONC_PUMP_PARK_COMMAND; // this bit must be cleared after next transmit to prevent continuous park commands +} + +/*********************************************************************//** + * @brief * The setFPGAD17CondReset function resets the FPGA Conductivity * Sensor D17. * @details \b Inputs: none @@ -1505,6 +1560,20 @@ /*********************************************************************//** * @brief + * The setFPGAD76PumpRevolutionCount function sets the UltraFilteration + * pump revolution count. + * @details \b Inputs: none + * @details \b Outputs: fpgaD76PumpRevCount + * @param count the number of revolution to be rotated for the pump. + * @return none + *************************************************************************/ +void setFPGAD76PumpRevolutionCount( U16 count ) +{ + fpgaActuatorSetPoints.fpgaD76PumpRevCount = count; +} + +/*********************************************************************//** + * @brief * The setFPGAD5HeaterOnOffControl function sets the primary heater * On/Off control. * @details \b Inputs: none @@ -1784,6 +1853,25 @@ /*********************************************************************//** * @brief + * The getFPGAD76PumpControlStatus function gets the Ultrafilteration pump + * (D76 pump) control mode. + * bit 7: Park (set in different function) + * bit 6: nSleep + * bit 5: nReset + * bit 4: nEnable + * bit 3: Direction (1=Fwd, 0=Rev) + * bit 0-2: Microstepping resolution + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD76PumpControl + * @return UF pump control status bit + *************************************************************************/ +U08 getFPGAD76PumpControlStatus( void ) +{ + return fpgaActuatorSetPoints.fpgaD76PumpControl; +} + +/*********************************************************************//** + * @brief * The getFPGAConcentratePumpsFault function gets concentrate pumps fault * reported by FGPA. * @details \b Inputs: fpgaSensorReadings.fpgaD11_D10_PumpFault @@ -1887,6 +1975,19 @@ /*********************************************************************//** * @brief + * The getFPGAD76PumpHallSensePulseWidth function gets UF pump D76_Pump + * hall sense pulse width. + * @details \b Inputs: fpgaSensorReadings.fpgaD76PumpHallSense + * @details \b Outputs: none + * @return ultrafilteration pump D76_Pump hall sense pulse width + *************************************************************************/ +U16 getFPGAD76PumpHallSensePulseWidth( void ) +{ + return fpgaSensorReadings.fpgaD76PumpHallSense; +} + +/*********************************************************************//** + * @brief * The getFPGAValveStates function gets the latest sensed valve states. * See setFPGAValveStates for valve state bit positions. * @details \b Inputs: fpgaSensorReadings.fpgaValveStates @@ -2928,6 +3029,19 @@ /*********************************************************************//** * @brief + * The getFPGAD76PumpRevolutionCountStatus function gets the current revolution of + * UF pump (down counter) status. + * @details \b Inputs: fpgaD76PumpStepCountStatus + * @details \b Outputs: none + * @return the current revolution of the UF pump + *************************************************************************/ +U16 getFPGAD76PumpRevolutionCountStatus( void ) +{ + return fpgaSensorReadings.fpgaD76PumpStepCountStatus; +} + +/*********************************************************************//** + * @brief * The checkFPGAAFEOEFailure function increments the FPGA comm failure * windowed timer if an FE or OE error has occurred and returns whether * or not the number of failures in