Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf43eb0d0f168ea14b846d0c24f0ad0cb30784d3f -r0f4fbb2a56cdbe35dcedd9cad23867fd7248f86e --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f43eb0d0f168ea14b846d0c24f0ad0cb30784d3f) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 0f4fbb2a56cdbe35dcedd9cad23867fd7248f86e) @@ -82,14 +82,14 @@ #define DRAIN_PUMP_DAC_SHIFT_BITS 4 ///< Drain pump DAC shift bits. #define FPGA_FLUIDLEAK_STATE_MASK 0x0004 ///< Bit mask for fluid leak detector. - +#define FPGA_ENABLE_VALVES_CONTROL 0x015F ///< FPGA enable valves control #define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask. #define DIALYSATE_CAP_SWITCH_MASK 0x20 ///< Dialysate cap switch bit mask. #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. #define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin. #define FPGA_READ_V3_START_BYTE_NUM 256 ///< FPGA V3 read sensors start byte number. -#define FPGA_READ_V3_END_BYTE_NUM 418 ///< FPGA V3 read sensors end byte number. +#define FPGA_READ_V3_END_BYTE_NUM 430 ///< FPGA V3 read sensors end byte number. /// 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 ) @@ -199,37 +199,42 @@ U16 fpgaDialysateFlowRate; ///< Reg 412. Dialysate flow rate measurement U16 fpgaROFlowSensorEdgeCount; ///< Reg 414. RO flow sensor edge count U16 fpgaDialysateFlowSensorEdgeCount; ///< Reg 416. Dialysate flow sensor edge count + U16 fpgaCompatibilityRev; ///< Reg 418. Compatibility revision + U16 fpgaFMPNoisePulse; ///< Reg 420. FMP noise pulse count + U16 fpgaFMDNoisePulse; ///< Reg 422. FMD noise pulse count + U16 fpgaPlaceHolder1; ///< Reg 424. V3 place holder 1 + U16 fpgaPlaceHolder2; ///< Reg 426. V3 place holder 2 + U16 fpgaPlaceHolder3; ///< Reg 428. V3 place holder 3 // DVT changes - U16 fpgaDrainPumpSpeedFeedback; ///< Reg 418. Drain pump speed feedback - U16 fpgaDrainPumpCurrentFeedback; ///< Reg 420. Drain pump current feedback - U08 fpgaBaroReadCount; ///< Reg 422. Barometric sensor read count - U08 fpgaBaroErrorCount; ///< Reg 423. Barometric sensor error count - U16 fpgaBaroManufacInfo; ///< Reg 424. Barometric sensor manufacturing information - U16 fpgaBaroPROMCoeff1; ///< Reg 426. Barometric sensor PROM coefficient 1 - U16 fpgaBaroPROMCoeff2; ///< Reg 428. Barometric sensor PROM coefficient 2 - U16 fpgaBaroPROMCoeff3; ///< Reg 430. Barometric sensor PROM coefficient 3 - U16 fpgaBaroPROMCoeff4; ///< Reg 432. Barometric sensor PROM coefficient 4 - U16 fpgaBaroPROMCoeff5; ///< Reg 434. Barometric sensor PROM coefficient 5 - U16 fpgaBaroPROMCoeff6; ///< Reg 436. Barometric sensor PROM coefficient 6 - U16 fpgaBaroPROMCRC; ///< Reg 438. Barometric sensor PROM CRC - U32 fpgaBaroPressure; ///< Reg 440. Barometric sensor pressure value - U32 fpgaBaroTemperature; ///< Reg 444. Barometric sensor temperature sensor - U08 fpgaTHdRTDReadCount; ///< Reg 448. THD RTD read count - U08 fpgaTHdRTDErrorCount; ///< Reg 449. THD RTD error count - U32 fpgaTHdTemp; ///< Reg 450. THD channel 0 read data - temperature sensor - U32 fpgaTHdInternalTemp; ///< Reg 454. THD channel 1 read data - ADC internal temperature sensor - U08 fpgaCPiCPoEmstatOutByte; ///< Reg 458. CPi/CPo Emstat out byte - U08 fpgaCPiCPoEmstatRxErrCount; ///< Reg 459. CPi/CPo Emstat Rx error count - U16 fpgaCPiCPoEmstatTxFIFOCount; ///< Reg 460. CPi/CPo Emstat Tx FIFO count - U16 fpgaCPiCPoEmstatRxFIFOCount; ///< Reg 462. CPi/CPo Emstat Rx FIFO count - U16 fpgaHeaterGateADC; ///< Reg 464. Heater gate ADC - U16 fpgaHeaterGNDADC; ///< Reg 466. Heater ground ADC - U08 fpgaHeater1ADCReadCount; ///< Reg 468. Heater 1 ADC read count - U08 fpgaHeater1ADCErrorCount; ///< Reg 469. Heater 1 ADC error count - U16 fpgaPowerSupply2; ///< Reg 470. Power supply 2 count - U16 fpgaOnBoardThermistor; ///< Reg 472. Onboard thermistor - U16 fpgaCompatibilityRev; ///< Reg 474. Compatibility revision + U16 fpgaDrainPumpSpeedFeedback; ///< Reg 430. Drain pump speed feedback + U16 fpgaDrainPumpCurrentFeedback; ///< Reg 432. Drain pump current feedback + U08 fpgaBaroReadCount; ///< Reg 434. Barometric sensor read count + U08 fpgaBaroErrorCount; ///< Reg 435. Barometric sensor error count + U16 fpgaBaroManufacInfo; ///< Reg 436. Barometric sensor manufacturing information + U16 fpgaBaroPROMCoeff1; ///< Reg 438. Barometric sensor PROM coefficient 1 + U16 fpgaBaroPROMCoeff2; ///< Reg 440. Barometric sensor PROM coefficient 2 + U16 fpgaBaroPROMCoeff3; ///< Reg 442. Barometric sensor PROM coefficient 3 + U16 fpgaBaroPROMCoeff4; ///< Reg 444. Barometric sensor PROM coefficient 4 + U16 fpgaBaroPROMCoeff5; ///< Reg 446. Barometric sensor PROM coefficient 5 + U16 fpgaBaroPROMCoeff6; ///< Reg 448. Barometric sensor PROM coefficient 6 + U16 fpgaBaroPROMCRC; ///< Reg 450. Barometric sensor PROM CRC + U32 fpgaBaroPressure; ///< Reg 452. Barometric sensor pressure value + U32 fpgaBaroTemperature; ///< Reg 456. Barometric sensor temperature sensor + U08 fpgaTHdRTDReadCount; ///< Reg 460. THD RTD read count + U08 fpgaTHdRTDErrorCount; ///< Reg 461. THD RTD error count + U32 fpgaTHdTemp; ///< Reg 462. THD channel 0 read data - temperature sensor + U32 fpgaTHdInternalTemp; ///< Reg 466. THD channel 1 read data - ADC internal temperature sensor + U08 fpgaCPiCPoEmstatOutByte; ///< Reg 470. CPi/CPo Emstat out byte + U08 fpgaCPiCPoEmstatRxErrCount; ///< Reg 471. CPi/CPo Emstat Rx error count + U16 fpgaCPiCPoEmstatTxFIFOCount; ///< Reg 472. CPi/CPo Emstat Tx FIFO count + U16 fpgaCPiCPoEmstatRxFIFOCount; ///< Reg 474. CPi/CPo Emstat Rx FIFO count + U16 fpgaHeaterGateADC; ///< Reg 476. Heater gate ADC + U16 fpgaHeaterGNDADC; ///< Reg 478. Heater ground ADC + U08 fpgaHeater1ADCReadCount; ///< Reg 480. Heater 1 ADC read count + U08 fpgaHeater1ADCErrorCount; ///< Reg 481. Heater 1 ADC error count + U16 fpgaPowerSupply2; ///< Reg 482. Power supply 2 count + U16 fpgaOnBoardThermistor; ///< Reg 484. Onboard thermistor } DG_FPGA_SENSORS_T; typedef struct @@ -365,18 +370,14 @@ void initFPGA( void ) { // initialize fpga data structures - memset( &fpgaHeader, 0, sizeof(FPGA_HEADER_T) ); - memset( &fpgaSensorReadings, 0, sizeof(DG_FPGA_SENSORS_T) ); - memset( &fpgaActuatorSetPoints, 0, sizeof(FPGA_ACTUATORS_T) ); + memset( &fpgaHeader, 0, sizeof( FPGA_HEADER_T ) ); + memset( &fpgaSensorReadings, 0, sizeof( DG_FPGA_SENSORS_T ) ); + memset( &fpgaActuatorSetPoints, 0, sizeof( FPGA_ACTUATORS_T ) ); // Set the THd control register to 0x1 to make sure its ADC is running fpgaActuatorSetPoints.fpgaTHdControlReg = FPGA_THD_CONTROL_COMMAND; + fpgaActuatorSetPoints.fpgaValveStates = FPGA_ENABLE_VALVES_CONTROL; - // TODO Remove the below line - // Initialize the valves - fpgaActuatorSetPoints.fpgaValveStates = 0x015F; - // TODO Remove the above line - // initialize fpga comm buffers memset( &fpgaWriteCmdBuffer, 0, FPGA_WRITE_CMD_BUFFER_LEN ); memset( &fpgaReadCmdBuffer, 0, FPGA_READ_CMD_BUFFER_LEN ); @@ -865,23 +866,23 @@ if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) { // Check FPGA compatibility w/ firmware - /*if ( DG_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) + if ( DG_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) { result = SELF_TEST_STATUS_PASSED; } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_FPGA_POST_TEST_FAILED, (U32)DG_FPGA_COMPATIBILITY_REV, (U32)fpgaSensorReadings.fpgaCompatibilityRev ) - }*/ + } } else { result = SELF_TEST_STATUS_FAILED; SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaId ) } - return SELF_TEST_STATUS_PASSED; //result; + return result; } /*********************************************************************//**