Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -rfabb2cc72b3b94c1e02e84894ccb52d05a12d7cd -r5a17b8f1c9a44980c74eea8046d35de84f22b9f4 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision fabb2cc72b3b94c1e02e84894ccb52d05a12d7cd) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 5a17b8f1c9a44980c74eea8046d35de84f22b9f4) @@ -1,15 +1,15 @@ /************************************************************************** * -* Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2026 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file FpgaDD.c * -* @author (last) Dara Navaei -* @date (last) 14-Nov-2025 +* @author (last) Vinayakam Mani +* @date (last) 09-Feb-2026 * * @author (original) Vinayakam Mani * @date (original) 26-Aug-2024 @@ -162,7 +162,7 @@ U16 fpgaD43CondTemp; ///< Reg 576. D43 Temperature U08 fpgaD43CondReadCnt; ///< Reg 578. D43 successful read count U08 fpgaD43CondErrorCnt; ///< Reg 579. D43 error read count - U16 fpgaD63LevelSensor; ///< Reg 580. Level Sensor 1 + U16 fpgaD63LevelSensor; ///< Reg 580. Upper level Sensor U16 fpgaD46LevelSensor; ///< Reg 582. Level Sensor 2 U08 fpgaHallSensInputs; ///< Reg 584. Hall sensor Inputs U08 fpgaD42TxFIFOCnt; ///< Reg 585. Blood leak sensor transmit FIFO count @@ -178,17 +178,16 @@ U08 fpgaValveSpPWMStates; ///< Reg 599. Spare Valves PWM states U08 fpgaD11_D10_PumpFault; ///< Reg 600. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 601. Count of each incomplete seq of reads from RTD ADC. - U16 fpgaD11PumpHallSense; ///< Reg 602. Concentrate pump D11_Pump hall sensor pulse width - U16 fpgaD10PumpHallSense; ///< Reg 604. Concentrate pump D10_Pump hall sensor pulse width + U16 fpga_UnUsed_4; ///< Reg 602. Not Used + U16 fpga_UnUsed_5; ///< Reg 604. Not Used U32 fpgaD78Temp; ///< Reg 606. Outlet heat exchanger temperature U32 fpgaD1Temp; ///< Reg 610. Inlet heat exchanger temperature U32 fpgaD4Temp; ///< Reg 614. Hydraulics primary heater temperature U32 fpgaD50Temp; ///< Reg 618. Trimmer heater temperature - U08 fpga_UnUsed_1; ///< Reg 622. Not used - U08 fpgaRTDReadCnt; ///< Reg 623. Read count for all RTD sensors + U16 fpgaD98LevelSensor; ///< Reg 622. Lower level Sensor U16 fpgaD12MeasuredSpeed; ///< Reg 624. Fresh dialysate pump measured speed U16 fpgaD48MeasuredSpeed; ///< Reg 626. Spent dialysate pump measured speed - U08 fpga_UnUsed_2; ///< Reg 628. Not used + U08 fpgaRTDReadCnt; ///< Reg 628. Read count for all RTD sensors U08 fpgaD12D48PumpStatus; ///< Reg 629. Dialysate pumps Error status U16 fpgaD12CurrentFeedback; ///< Reg 630. Fresh dialysate pump current feedback U16 fpgaD48CurrentFeedback; ///< Reg 632. Spent dialysate pump current feedback @@ -204,10 +203,10 @@ U16 fpgaAdcVpVn; ///< Reg 648. TBD U16 fpgaD12PumpSpeedFeedback; ///< Reg 650. D12 Pump speed feedback U16 fpgaD48PumpSpeedFeedback; ///< Reg 652. D48 Pump Speed feedback - U16 fpgaD76PumpHallSense; ///< Reg 654. UF D76_Pump hall sensor pulse width + U16 fpga_UnUsed_6; ///< Reg 654. Not used U16 fpgaD76PumpStepCountStatus; ///< Reg 656. UF pump revolution down count status U08 fpgaD76PumpFault; ///< Reg 658: UF pump fault - U08 fpga_UnUsed_3; ///< reg 659: Not used + U08 fpga_UnUsed_3; ///< Reg 659: Not used S16 pressureP46; ///< Reg 660. P46 pressure data. U16 temperatureP46; ///< Reg 662. P46 temperature data. @@ -235,7 +234,7 @@ U16 flowRateP7; ///< Reg 704. P7 flow sensor rate. U16 flowTempP7; ///< Reg 706. P7 flow sensor temperature. U16 p12PumpTachCount; ///< Reg 708. P12 pump tachometer counter. - U16 dsPumpTachCount; ///< Reg 710. DSP tachometer counter. + U16 d79SpeedPulseWidth; ///< Reg 710. D79 pusle width feedback. U16 flowIntTempP7; ///< Reg 712. P7 flow sensor internal temperature. U08 valveIOControlReadback; ///< Reg 714. IO Valve control bits read back. U08 valveFPControlReadback; ///< Reg 715. FP Valve control enable read back. @@ -245,8 +244,9 @@ U16 p40PumpPWMReadback; ///< Reg 720. P40 pump PWM read back. U08 p7flowReadCount; ///< Reg 722. P7 Flow sensor read counter. U08 p7flowErrorCount; ///< Reg 723. P7 Flow sensor error counter. - U32 tempP23; ///< Reg 724. P23 temperature sensor reading. - U32 tempP22; ///< Reg 728. P22 ( TRO2 ) temperature sensor reading. + U16 fpgaD87PresPressure; ///< Reg 724. D87 MPM pressure sensor RAW pressure data + U16 fpgaD87PresTemp; ///< Reg 726. D87 MPM pressure sensor RAW temperature data + U32 fpgaD99Temp; ///< Reg 728. D99 temperature sensor U32 tempTax1; ///< Reg 732. ( Tax1 ) temperature sensor reading. U32 tempRTD; ///< Reg 736. spare temperature sensor reading. U08 ad7124errcnt; ///< Reg 740. Counter which increments when an invalid transaction happen between FPGA and AD7124. @@ -262,6 +262,10 @@ U16 fpgaD74CondTemp; ///< Reg 756. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 758. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 759. D74 error read count + U32 fpgaD11PumpHallSense; ///< Reg 760. Concentrate pump D11_Pump hall sensor pulse width + U32 fpgaD10PumpHallSense; ///< Reg 764. Concentrate pump D10_Pump hall sensor pulse width + U32 fpgaD76PumpHallSense; ///< Reg 768. UF D76_Pump hall sensor pulse width + U32 fpgaTestBytes; ///< Reg 772. FPGA Test 4 bytes } DD_FPGA_SENSORS_T; typedef struct @@ -286,16 +290,16 @@ U08 fpgaD12PumpControl; ///< Reg 36. DGP Control U08 fpgaD48PumpControl; ///< Reg 37. SDP Control U16 fpgaD48PumpSpeed; ///< Reg 38. SDP Speed/RPM Control - U16 fpgaD11PumpSpeed; ///< Reg 40. Acid Concentrate Pump Speed/RPM Control + U16 fpgaNotUsed_1; ///< Reg 40. Not used U08 fpgaD11PumpControl; ///< Reg 42. Acid Concentrate Pump Control U08 fpgaD10PumpControl; ///< Reg 43. BiCarb Concentrate Pump Control - U16 fpgaD10PumpSpeed; ///< Reg 44. BiCarb Concentrate Pump Speed/RPM Control + U16 fpgaNotUsed_2; ///< Reg 44. Not used U08 fpgaD42SensorTest; ///< Reg 46. Blood leak sensor test U08 fpgaD42UARTControl; ///< Reg 47. Blood leak sensor UART control U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control U08 fpgaD5HeaterPWMControl; ///< Reg 49. Primary heater PWM control U08 fpgaD45HeaterPWMControl; ///< Reg 50. Trimmer heater PWM control - U08 fpgaNotUsed; ///< Reg 51. Not used + U08 fpgaD79PWMPumpCtl; ///< Reg 51. Rinse pump PWM control U16 fpgaVBCPWMLow; ///< Reg 52. VBC PWM low ( Balancing chamber valves) U16 fpgaVBCPWMPeriod; ///< Reg 54. VBC PWM period U16 fpgaVBCPWMPullIn; ///< Reg 56. VBC PWM pull in @@ -308,7 +312,7 @@ U08 fpgaGPIOControl; ///< Reg 69. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 70. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 72. PWM period for AC relay/heater. - U16 fpgaD76PumpSpeed; ///< Reg 74. UF Pump Speed/RPM Control + U16 fpgaNotUsed_3; ///< Reg 74. Not Used U16 fpgaD76PumpRevCount; ///< Reg 76. UF pump revolution count U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control @@ -341,7 +345,10 @@ U08 fpgaConSensD43Control; ///< Reg 118. Conductivity/Temperature Sensors D43 Control registers U16 fpgaConSensD43_Addrs; ///< Reg 119. D43 Initialization Address register U32 fpgaConSensD43_Data_In; ///< Reg 121. D43 Initialization data register - + U08 fpgaNotUsed_4; ///< Reg 125. Not used. + U32 fpgaD11PumpSpeed; ///< Reg 126. Acid Concentrate Pump Speed/RPM Control + U32 fpgaD10PumpSpeed; ///< Reg 130. BiCarb Concentrate Pump Speed/RPM Control + U32 fpgaD76PumpSpeed; ///< Reg 134. UF Pump Speed/RPM Control } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -843,7 +850,7 @@ * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGAD11PumpSetStepSpeed( U16 stepSpeed ) +void setFPGAD11PumpSetStepSpeed( U32 stepSpeed ) { fpgaActuatorSetPoints.fpgaD11PumpSpeed = stepSpeed; } @@ -857,7 +864,7 @@ * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGAD10PumpSetStepSpeed( U16 stepSpeed ) +void setFPGAD10PumpSetStepSpeed( U32 stepSpeed ) { fpgaActuatorSetPoints.fpgaD10PumpSpeed = stepSpeed; } @@ -871,7 +878,7 @@ * @param stepSpeed The concentrate pump step speed period * @return none *************************************************************************/ -void setFPGAD76PumpSetStepSpeed( U16 stepSpeed ) +void setFPGAD76PumpSetStepSpeed( U32 stepSpeed ) { fpgaActuatorSetPoints.fpgaD76PumpSpeed = stepSpeed; } @@ -2223,7 +2230,7 @@ * @details \b Outputs: none * @return concentrate pump D11_Pump hall sense pulse width *************************************************************************/ -U16 getFPGAD11PumpHallSensePulseWidth( void ) +U32 getFPGAD11PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD11PumpHallSense; } @@ -2236,7 +2243,7 @@ * @details \b Outputs: none * @return concentrate pump D10_Pump hall sense pulse width *************************************************************************/ -U16 getFPGAD10PumpHallSensePulseWidth( void ) +U32 getFPGAD10PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD10PumpHallSense; } @@ -2249,7 +2256,7 @@ * @details \b Outputs: none * @return ultrafiltration pump D76_Pump hall sense pulse width *************************************************************************/ -U16 getFPGAD76PumpHallSensePulseWidth( void ) +U32 getFPGAD76PumpHallSensePulseWidth( void ) { return fpgaSensorReadings.fpgaD76PumpHallSense; } @@ -2427,6 +2434,32 @@ /*********************************************************************//** * @brief + * The getFPGAD87PresRawPressure function gets fresh dialysate post ultrafilter + * pressure sensor raw pressure value. + * @details \b Inputs: fpgaSensorReadings.fpgaD87PresPressure + * @details \b Outputs: none + * @return Fresh dialysate post ultrafilter pressure sensor raw pressure data + *************************************************************************/ +U16 getFPGAD87PresRawPressure( void ) +{ + return fpgaSensorReadings.fpgaD87PresPressure; +} + +/*********************************************************************//** + * @brief + * The getFPGAD87PresRawTemperature function gets fresh dialysate post ultrafilter + * pressure sensor raw temperature value. + * @details \b Inputs: fpgaSensorReadings.fpgaD87PresTemp + * @details \b Outputs: none + * @return Fresh dialysate post ultrafilter pressure sensor raw temperature data + *************************************************************************/ +U16 getFPGAD87PresRawTemperature( void ) +{ + return fpgaSensorReadings.fpgaD87PresTemp; +} + +/*********************************************************************//** + * @brief * The getFPGACD1ReadCount function gets D17 conductivity sensor read count. * @details \b Inputs: fpgaSensorReadings.fpgaD17CondReadCnt * @details \b Outputs: none @@ -2727,11 +2760,11 @@ /*********************************************************************//** * @brief - * The getFPGAD63LevelSensor function gets the latest FPGA D63 level sensor - * reading. + * The getFPGAD63LevelSensor function gets the latest FPGA D63 upper level + * sensor reading. * @details \b Inputs: fpgaSensorReadings.fpgaD63LevelSensor * @details \b Outputs: none - * @return last FPGA D63 level sensor reading + * @return last FPGA D63 upper level sensor reading *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { @@ -2740,6 +2773,19 @@ /*********************************************************************//** * @brief + * The getFPGAD98LevelSensor function gets the latest FPGA D98 lower level + * sensor reading. + * @details \b Inputs: fpgaSensorReadings.fpgaD98LevelSensor + * @details \b Outputs: none + * @return last FPGA D98 lower level sensor reading + *************************************************************************/ +U16 getFPGAD98LevelSensor( void ) +{ + return fpgaSensorReadings.fpgaD98LevelSensor; +} + +/*********************************************************************//** + * @brief * The getFPGAD46LevelSensor function gets the latest FPGA level sensor 2 * reading. * @details \b Inputs: fpgaSensorReadings.fpgaD46LevelSensor @@ -2842,6 +2888,18 @@ /*********************************************************************//** * @brief + * The getFPGAD99Temp function gets the fresh dialysate temperature. + * @details \b Inputs: fpgaSensorReadings + * @details \b Outputs: none + * @return Fresh dialysate temperature + *************************************************************************/ +U32 getFPGAD99Temp( void ) +{ + return fpgaSensorReadings.fpgaD99Temp; +} + +/*********************************************************************//** + * @brief * The getFPGARTDReadCount function gets the RTD sensors group read count. * @details \b Inputs: fpgaSensorReadings * @details \b Outputs: none @@ -3054,6 +3112,45 @@ /*********************************************************************//** * @brief + * The setFPGAD79RinsePumpControl function sets the control bit of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaDDSpareValveControl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaDDSpareValveControl &= value; +} + +/*********************************************************************//** + * @brief + * The setFPGAD79RinsePumpPWMControl function sets the PWM value of the rinse + * pump to turn it on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.fpgaD79PWMPumpCtl + * @return none + *************************************************************************/ +void setFPGAD79RinsePumpPWMControl( U08 value ) +{ + fpgaActuatorSetPoints.fpgaD79PWMPumpCtl = value; +} + +/*********************************************************************//** + * @brief + * The getFPGAD79RinsePumpPulseWidth function returns the 4-wire rinse pump + * pulse width. + * @details \b Inputs: d79SpeedPulseWidth + * @details \b Outputs: none + * @return fpgaSensorReadings.d79SpeedPulseWidth + *************************************************************************/ +U16 getFPGAD79RinsePumpPulseWidth( void ) +{ + return fpgaSensorReadings.d79SpeedPulseWidth; +} + +/*********************************************************************//** + * @brief * The setFPGAFPValveStates function sets the FP valve states with an 8-bit * mask of states - one bit per valve, with a 1 meaning "energized" and a 0 * meaning "de-energized". The bit positions for these bit states are as follows: @@ -3426,30 +3523,6 @@ /*********************************************************************//** * @brief - * The getFPGAP23Temperature function gets the P23 temperature sensor reading. - * @details \b Inputs: fpgaSensorReadings.tempP23 - * @details \b Outputs: none - * @return P23 temperature sensor reading - *************************************************************************/ -U32 getFPGAP23Temperature( void ) -{ - return fpgaSensorReadings.tempP23; -} - -/*********************************************************************//** - * @brief - * The getFPGAP22Temperature function gets the P22 temperature sensor reading. - * @details \b Inputs: fpgaSensorReadings.tempP22 - * @details \b Outputs: none - * @return P22 temperature sensor reading - *************************************************************************/ -U32 getFPGAP22Temperature( void ) -{ - return fpgaSensorReadings.tempP22; -} - -/*********************************************************************//** - * @brief * The getFPGAP25FloaterState function gets the P25 floater level state. * @details \b Inputs: fpgaSensorReadings.levelSwitch * @details \b Outputs: none @@ -3487,6 +3560,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP16InternalTemp function gets the P16 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP16 + * @details \b Outputs: none + * @return P16 internal temperature + *************************************************************************/ +U16 getFPGAFlowP16InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP16; +} + +/*********************************************************************//** + * @brief * The getFPGAFlowP7 function gets the P7 flow rate (in mL/min). * @details \b Inputs: fpgaSensorReadings.flowRateP7 * @details \b Outputs: none @@ -3512,6 +3598,19 @@ /*********************************************************************//** * @brief + * The getFPGAFlowP7InternalTemp function gets the P7 flow sensor + * internal temperature. + * @details \b Inputs: fpgaSensorReadings.flowIntTempP7 + * @details \b Outputs: none + * @return P7 internal temperature + *************************************************************************/ +U16 getFPGAFlowP7InternalTemp( void ) +{ + return fpgaSensorReadings.flowIntTempP7; +} + +/*********************************************************************//** + * @brief * The setFPGAP9Control function sets the FPGA P9 sensor control register * to perform a given action. * bit 4..7: unused