Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r9826fc85bd1497ec617ae0e825f78b91972de2b3 -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 9826fc85bd1497ec617ae0e825f78b91972de2b3) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -850,11 +850,16 @@ *************************************************************************/ static void monitorHeatersVoltage( void ) { - F32 mainPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_PRIM_HTR_V ); - // NOTE: it is assumed that the main and small primary heaters have equal voltage since the PWMs are divided into 2 - // before applying the PWMs to the heaters. Right now, there is no ADC channel available for the small primary - // heater so the main primary heater's ADC channel is used for the small primary heater as well. - F32 smallPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_PRIM_HTR_V ); + // NOTE: Default to using Primary heater voltage from FPGA + F32 mainPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_PRIM_HTR_V );; +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) + { + // V3 use CPU based value for Primary, same as Secondary + mainPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_SEC_HTR_V ); + } +#endif + F32 smallPriVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_SEC_HTR_V ); F32 trimmerVoltage = getMonitoredLineLevel( MONITORED_LINE_24V_TRIM_HTR_V ); // Voltage to PWM is reverse. If PWM = 0 -> V = 24V Index: firmware/App/Controllers/Voltages.c =================================================================== diff -u -r3dd12fb9d032f85126db82ca48812a4652a5b75f -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Controllers/Voltages.c (.../Voltages.c) (revision 3dd12fb9d032f85126db82ca48812a4652a5b75f) +++ firmware/App/Controllers/Voltages.c (.../Voltages.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -22,6 +22,7 @@ #include "TaskGeneral.h" #include "Timers.h" #include "Voltages.h" +#include "FPGA.h" /** * @addtogroup Voltages @@ -33,14 +34,32 @@ #define VOLTAGES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the voltages data is published on the CAN bus. #define VOLTAGES_ALARM_PERSISTENCE ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Alarm persistence period for voltage monitor alarms. #define DATA_PUBLISH_COUNTER_START_COUNT 1 ///< Data publish counter start count. +#define SIZE_OF_ROLLING_AVG 16 ///< Number of DG FPGA ADC samples in rolling average calculations for each channel. +#define ROLLING_AVG_SHIFT_DIVIDER 4 ///< Rolling average shift divider for DG FPGA ADC readings. +#define FPGA_ADC_BITS_PER_CHANNEL 12 ///< DG FPGA ADC bits per channel. +#define FPGA_ADC_FULL_SCALE_BITS ((1<> ROLLING_AVG_SHIFT_DIVIDER; + adcReadingsIdx[ ch ] = INC_WRAP( adcReadingsIdx[ ch ], 0, SIZE_OF_ROLLING_AVG - 1 ); + fpgaVoltage[ch] = (F32)adcReadingsAvgs[ ch ] * FPGA_ADC_READ_TO_UNITS[ ch ]; + } +} + +/*********************************************************************//** + * @brief * The checkVoltageRanges function checks each monitored voltage or current * against its minimum and maximum range. * @details Inputs: voltageAlarmPersistenceCtr, MAX_VOLTAGES[], MIN_VOLTAGES[], voltages[] @@ -296,6 +376,8 @@ data.adc5VPSGateDriver = getMonitoredLineLevel( MONITORED_LINE_PS_GATE_DRIVER_V ); data.adc24V = getMonitoredLineLevel( MONITORED_LINE_24V_MAIN ); data.adc24VPrimaryHtr = getMonitoredLineLevel( MONITORED_LINE_24V_PRIM_HTR_V ); + data.adc24VPrimaryHtrGnd = getMonitoredLineLevel( MONITORED_LINE_24V_PRIM_HTR_V ); + data.adc24VSecondaryHtr = getMonitoredLineLevel( MONITORED_LINE_24V_SEC_HTR_V ); data.adc24VTrimmerHtr = getMonitoredLineLevel( MONITORED_LINE_24V_TRIM_HTR_V ); broadcastData( MSG_ID_DG_VOLTAGES_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( VOLTAGES_DATA_PAYLOAD_T ) ); Index: firmware/App/Controllers/Voltages.h =================================================================== diff -u -ra9315539f527b92523b1598ff91e47db4d71dae2 -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Controllers/Voltages.h (.../Voltages.h) (revision a9315539f527b92523b1598ff91e47db4d71dae2) +++ firmware/App/Controllers/Voltages.h (.../Voltages.h) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -49,6 +49,8 @@ MONITORED_LINE_PS_GATE_DRIVER_V, ///< P/S gate driver voltage (5V) MONITORED_LINE_LAST_RANGE_CHECKED_LINE = MONITORED_LINE_PS_GATE_DRIVER_V, ///< The last monitored line that is checked per fixed range. MONITORED_LINE_24V_PRIM_HTR_V, ///< Primary heater voltage (24V) + MONITORED_LINE_24V_PRIM_HTR_GND_V, ///< Primary heater ground voltage (24V when off, <5V when on) + MONITORED_LINE_24V_SEC_HTR_V, ///< Secondary heater voltage (24V) MONITORED_LINE_24V_TRIM_HTR_V, ///< Trimmer heater voltage (24V) NUM_OF_MONITORED_LINES ///< Number of monitored voltages } MONITORED_VOLTAGES_T; @@ -69,7 +71,9 @@ F32 adc5VSensors; ///< Internal ADC channel for 5V to sensors F32 adc5VPSGateDriver; ///< Internal ADC channel for 5V P/S gate driver F32 adc24V; ///< Internal ADC channel for 24V - F32 adc24VPrimaryHtr; ///< Internal ADC channel for 24V to primary heater + F32 adc24VPrimaryHtr; ///< FPGA ADC channel for 24V to primary heater + F32 adc24VPrimaryHtrGnd; ///< FPGA ADC channel for 24V to primary heater + F32 adc24VSecondaryHtr; ///< Internal ADC channel for 24V to secondary heater F32 adc24VTrimmerHtr; ///< Internal ADC channel for 24V to trimmer heater } VOLTAGES_DATA_PAYLOAD_T; Index: firmware/App/Drivers/InternalADC.c =================================================================== diff -u -r3dd12fb9d032f85126db82ca48812a4652a5b75f -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 3dd12fb9d032f85126db82ca48812a4652a5b75f) +++ firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -51,7 +51,7 @@ INT_ADC_PROCESSOR_1_2_VOLTS, // 15 INT_ADC_REFERENCE_VOLTAGE, // 16 INT_ADC_TRIMMER_HEATER_24_VOLTS, // 17 - INT_ADC_PRIMARY_HEATER_24_VOLTS, // 18 + INT_ADC_SECONDARY_HEATER_24_VOLTS, // 18 INT_ADC_REF_IN1, // 19 INT_ADC_REF_IN2, // 20 INT_ADC_BOARD_THERMISTOR, // 21 @@ -69,7 +69,7 @@ 0.00073242, // V - INT_ADC_RO_PUMP_FEEDBACK_DUTY_CYCLE 1.0, // ? - INT_ADC_AVAILABLE_CHANNEL 0.00763285, // V - INT_ADC_TRIMMER_HEATER_24_VOLTS (varies inversely with PWM) - 0.00700441, // V - INT_ADC_PRIMARY_HEATER_24_VOLTS (varies inversely with PWM for secondary element) + 0.00700441, // V - INT_ADC_SECONDARY_HEATER_24_VOLTS (varies inversely with PWM for secondary element) 0.001221, // V - INT_ADC_BOARD_THERMISTOR 0.0007326, // V - INT_ADC_FPGA_1_8_VOLTS 0.0007326, // V - INT_ADC_FPGA_1_VOLT Index: firmware/App/Drivers/InternalADC.h =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Drivers/InternalADC.h (.../InternalADC.h) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Drivers/InternalADC.h (.../InternalADC.h) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -44,7 +44,7 @@ INT_ADC_DRAIN_PUMP_INLET_PRESSURE, ///< DG internal ADC drain pump inlet pressure channel INT_ADC_RO_PUMP_FEEDBACK_DUTY_CYCLE, ///< DG internal ADC RO pump feedback duty cycle channel INT_ADC_AVAILABLE_CHANNEL, ///< DG internal ADC available channel - INT_ADC_PRIMARY_HEATER_24_VOLTS, ///< DG internal ADC primary heater 24 volt supply channel + INT_ADC_SECONDARY_HEATER_24_VOLTS, ///< DG internal ADC secondary heater 24 volt supply channel INT_ADC_TRIMMER_HEATER_24_VOLTS, ///< DG internal ADC trimmer heater 24 volt supply channel INT_ADC_BOARD_THERMISTOR, ///< DG internal ADC DG board thermistor channel INT_ADC_FPGA_1_8_VOLTS, ///< DG internal ADC DG FPGA 1.8 volt supply channel Index: firmware/App/Drivers/SafetyShutdown.c =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -127,7 +127,7 @@ case SAFETY_SHUTDOWN_SELF_TEST_STATE_IN_PROGRESS: if ( TRUE == didTimeout( safetyShutdownSelfTestTimerCount, SAFETY_SHUTDOWN_POST_TIMEOUT_MS ) ) { - F32 v24 = getIntADCVoltageConverted( INT_ADC_PRIMARY_HEATER_24_VOLTS ); + F32 v24 = getIntADCVoltageConverted( INT_ADC_SECONDARY_HEATER_24_VOLTS ); // Verify 24V is down when w.d. expired if ( v24 > MAX_24V_LEVEL_ON_SAFETY_SHUTDOWN ) @@ -145,7 +145,7 @@ case SAFETY_SHUTDOWN_SELF_TEST_STATE_RECOVER: if ( TRUE == didTimeout( safetyShutdownSelfTestTimerCount, SAFETY_SHUTDOWN_RECOVERY_TIME_MS ) ) { - F32 v24 = getIntADCVoltageConverted( INT_ADC_PRIMARY_HEATER_24_VOLTS ); + F32 v24 = getIntADCVoltageConverted( INT_ADC_SECONDARY_HEATER_24_VOLTS ); // Verify 24V is down when w.d. recovered // if ( v24 < MIN_24V_LEVEL_ON_SAFETY_RECOVER ) // TODO - talk with systems why 24V does not recover fully. Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r9826fc85bd1497ec617ae0e825f78b91972de2b3 -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 9826fc85bd1497ec617ae0e825f78b91972de2b3) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -2328,4 +2328,28 @@ return fpgaSensorReadings.fpgaDialysateFlowSensorEdgeCount; } +/*********************************************************************//** + * @brief + * The getFPGAHeaterGateADC function gets Heater Gate ADC value. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return heater gate adc value + *************************************************************************/ +U16 getFPGAHeaterGateADC( void ) +{ + return fpgaSensorReadings.fpgaHeaterGateADC; +} + +/*********************************************************************//** + * @brief + * The getFPGAHeaterGndADC function gets Heater Ground ADC value. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return heater ground adc value + *************************************************************************/ +U16 getFPGAHeaterGndADC( void ) +{ + return fpgaSensorReadings.fpgaHeaterGNDADC; +} + /**@}*/ Index: firmware/App/Services/FPGA.h =================================================================== diff -u -ra4669c80291e85fa5ce17d77ebcfd0c882831202 -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision a4669c80291e85fa5ce17d77ebcfd0c882831202) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -167,6 +167,9 @@ U16 getFPGAROFlowSensorEdgeCount( void ); U16 getFPGADialysateFlowSensorEdgeCount( void ); +U16 getFPGAHeaterGateADC( void ); +U16 getFPGAHeaterGndADC( void ); + /**@}*/ #endif Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -rb49fcf5c295e49f7133ea07398c54b083bf65d49 --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision b49fcf5c295e49f7133ea07398c54b083bf65d49) @@ -170,7 +170,7 @@ } if ( PIN_SIGNAL_LOW == getCPLDWatchdogExpired() ) { - F32 v24 = getIntADCVoltageConverted( INT_ADC_PRIMARY_HEATER_24_VOLTS ); + F32 v24 = getIntADCVoltageConverted( INT_ADC_SECONDARY_HEATER_24_VOLTS ); // Verify 24V is down when w.d. expired if ( v24 > MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED ) @@ -193,7 +193,7 @@ { if ( PIN_SIGNAL_HIGH == getCPLDWatchdogExpired() ) { - F32 v24 = getIntADCVoltageConverted( INT_ADC_PRIMARY_HEATER_24_VOLTS ); + F32 v24 = getIntADCVoltageConverted( INT_ADC_SECONDARY_HEATER_24_VOLTS ); // Verify 24V is down when w.d. recovered TODO - ask EE team why 24V does not quite recover all the way to 22.6V even after 750 ms. How long should it take? // if ( v24 < MIN_24V_LEVEL_ON_WATCHDOG_RECOVER )