Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf91baac9704a90ab0fea1dd05e11833ffc5a5a4e -r38c28a43b71d21d72906b07e9d60107b84bffb37 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f91baac9704a90ab0fea1dd05e11833ffc5a5a4e) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 38c28a43b71d21d72906b07e9d60107b84bffb37) @@ -120,13 +120,8 @@ U32 fpgaTDi; ///< Reg 308. ADC TDi channel 0 - temperature U32 fpgaTDiTemp; ///< Reg 312. ADC TDi channel 1 - internal temperature -#ifndef ENABLE_DVT_BOARD U32 fpgaCPo; ///< Reg 316. CPo conductivity sensor value U32 fpgaCPi; ///< Reg 320. CPi conductivity sensor value -#else - U32 fpgaTHDi; ///< Reg 316. ADC THD channel 0 - temperature - U32 fpgaTHDiTemp; ///< Reg 320. ADC THD channel 1 - internal temperature -#endif U16 fpgaPrimaryHeaterIntTemp; ///< Reg 324. Primary heater temperature U16 fpgaPrimaryHeaterIntJunctionTemp; ///< Reg 326. Primary heater internal temperature @@ -162,7 +157,6 @@ U08 fpgaTrimmerHeaterFlags; ///< Reg 366. Trimmer heater flags U08 fpgaTrimmerHeaterReadCnt; ///< Reg 367. Trimmer heater read count -#ifndef ENABLE_DVT_BOARD U08 fpgaCPoFault; ///< Reg 368. CPo conductivity sensor fault U08 fpgaCPoReadCnt; ///< Reg 369. CPo conductivity sensor read count U08 fpgaCPoErrorCnt; ///< Reg 370. CPo conductivity sensor error count @@ -171,25 +165,17 @@ U08 fpgaCPiErrorCnt; ///< Reg 373. CPi conductivity sensor error count U08 fpgaCP1CP2Fault; ///< Reg 374. Concentrate pump fault register for CP1 and CP2 U08 fpgaReserved1; ///< Reg 375. Reserved -#else - U08 fpgaCPiCPoEmstatOutByte; ///< Reg 368. CPi/CPo Emstat output FIFO - U08 fpgaCPiCPoEmstatRxErrCount; ///< Reg 369. CPi/CPo Emstat receive error count - U16 fpgaCPiCPoEmstatTxFIFOCount; ///< Reg 370. CPi/CPo Emstat transmit FIFO count - U16 fpgaCPiCPoEmstatRxFIFOCount; ///< Reg 372. CPi/CPo Emstat receive FIFO count - U08 fpgaCP1CP2Fault; ///< Reg 374. Concentrate pump fault register for CP1 and CP2 - U08 fpgaDRPHallStatus; ///< Reg 375. Drain pump hall sensor status -#endif U16 fpgaValveStates; ///< Reg 376. Valves states U16 fpgaFanIn1Pulse; ///< Reg 378. Fan inlet 1 pulse time in 2.5 us resolution U16 fpgaFanOut1Pulse; ///< Reg 380. Fan outlet 1 pulse time in 2.5 us resolution - U08 fpgaEmstatOutByte; ///< Reg 382. Emstat output FIFO - data from the Emstat device - U08 fpgaEmstatRxErrorCount; ///< Reg 383. Number of receive errors since power-up - U16 fpgaEmstatTxFifoCount; ///< Reg 384. Number of bytes in the Emstat Tx FIFO buffer - U16 fpgaEmstatRxFifoCount; ///< Reg 386. Number of bytes in the Emstat Rx FIFO buffer - U16 fpgaCP1HallSense; ///< Reg 388. Concentrate pump CP1 hall sensor pulse width. - U16 fpgaCP2HallSense; ///< Reg 390. Concentrate pump CP2 hall sensor pulse width. + U08 fpgaCD1CD2EmstatOutByte; ///< Reg 382. Emstat output FIFO - data from the Emstat device + U08 fpgaCD1CD2EmstatRxErrorCount; ///< Reg 383. Number of receive errors since power-up + U16 fpgaCD1CD2EmstatTxFifoCount; ///< Reg 384. Number of bytes in the Emstat Tx FIFO buffer + U16 fpgaCD1CD2EmstatRxFifoCount; ///< Reg 386. Number of bytes in the Emstat Rx FIFO buffer + U16 fpgaCP1HallSense; ///< Reg 388. Concentrate pump CP1 hall sensor pulse width + U16 fpgaCP2HallSense; ///< Reg 390. Concentrate pump CP2 hall sensor pulse width U08 fpgaGPIO; ///< Reg 392. FGPA GPIO register U08 fpgaDummyByte2Addr; ///< Reg 393. Dummy byte address to maintain an even addressing scheme @@ -199,21 +185,17 @@ U16 fpgaFanOut2Pulse; ///< Reg 398. Fan outlet 2 pulse time in 2.5 resolution U16 fpgaFanIn3Pulse; ///< Reg 400. Fan inlet 3 pulse time in 2.5 resolution U16 fpgaFanOut3Pulse; ///< Reg 402. Fan outlet 3 pulse time in 2.5 resolution - U16 fpgaTimerCount_ms; ///< Reg 404. Internal FPGA timer count in ms. + U16 fpgaTimerCountMS; ///< Reg 404. Internal FPGA timer count in milliseconds U16 fpgaADCVccInt; ///< Reg 406. Internal FPGA Vcc Voltage. - U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage. - U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage. + U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage + U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage - // DVT only + // DVT changes U08 fpgaBaroReadCount; ///< Reg 412. Barometric sensor read count U08 fpgaBaroErroCount; ///< Reg 413. Barometric sensor error count - // DVT only - - U16 fpgaDrainPumpSpeedFeedback; ///< Reg 414. Drain pump speed feedback. - U16 fpgaDrainPumpCurrentFeedback; ///< Reg 416. Drain pump current feedback. + U16 fpgaDrainPumpSpeedFeedback; ///< Reg 414. Drain pump speed feedback + U16 fpgaDrainPumpCurrentFeedback; ///< Reg 416. Drain pump current feedback U16 fpgaDialysateFlowRate; ///< Req 418. Dialysate flow rate measurement - - // DVT only U16 fpgaHeaterGateADC; ///< Reg 420. Heater gate ADC U16 fpgaHeaterGNDADC; ///< Reg 422. Heater ground ADC U08 fpgaHeater1ADCReadCount; ///< Reg 424. Heater 1 ADC read count @@ -230,7 +212,14 @@ U32 fpgaBaroTemperature; ///< Reg 446. Barometric sensor temperature sensor U08 fpgaTHDRTDReadCount; ///< Reg 450. THD RTD read count U08 fpgaTHDRTDErrorCount; ///< Reg 451. THD RTD error count - // DVT only + U32 fpgaTHDReadData0; ///< Reg 452. THD channel 0 read data + U32 fpgaTHDReadData1; ///< Reg 456. THD channel 1 read data + U08 fpgaCPiCPoEmstatOutByte; ///< Reg 460. CPi/CPo Emstat out byte + U08 fpgaCPiCPoEmstatRxErrCount; ///< Reg 461. CPi/CPo Emstat Rx error count + U16 fpgaCPiCPoEmstatTxFIFOCount; ///< Reg 462. CPi/CPo Emstat Tx FIFO count + U16 fpgaCPiCPoEmstatRxFIFOCount; ///< Reg 464. CPi/CPo Emstat Rx FIFO count + U08 fpgaDrainPumpFrequency; ///< Reg 466. drain pump frequency + U16 fpgaDrainPumpHallSnsrStatus; ///< Reg 468. drain pump hall sensor status } DG_FPGA_SENSORS_T; typedef struct @@ -247,13 +236,70 @@ U16 fpgaCP2StepSpeed; ///< Reg 26. Concentrate pump CP2 step speed register U08 fpgaCP2Control; ///< Reg 28. Concentrate pump CP2 control register U08 fpgaEmstatControl; ///< Reg 29. Emstat conductivity sensor control register + U16 fpgaVRfPWMLow; ///< Reg 30. VRf PWM low + U16 fpgaVRfPWMPeriod; ///< Reg 32. VRf PWM period + U16 fpgaVRiPWMLow; ///< Reg 34. VRi PWM low + U16 fpgaVRiPWMPeriod; ///< Reg 36. VRi PWM period + U16 fpgaVRdPWMLow; ///< Reg 38. VRd PWM low + U16 fpgaVRdPWMPeriod; ///< Reg 40. VRD PWM period + U16 fpgaVRoPWMLow; ///< Reg 42. VRo PWM low + U16 fpgaVRoPWMPeriod; ///< Reg 44. VRo PWM period + U16 fpgaVPoPWMLow; ///< Reg 46. VPo PWM low + U16 fpgaVPoPWMPeriod; ///< Reg 48. VPo PWM period + U16 fpgaVBfPWMLow; ///< Reg 50. VBf PWM low + U16 fpgaVBFPWMPeriod; ///< Reg 52. VBf PWM period + U16 fpgaVRcPWMLow; ///< Reg 54. VRc PWM low + U16 fpgaVRcPWMPeriod; ///< Reg 56. VRc PWM period + U16 fpgaVDrPWMLow; ///< Reg 58. VDr PWM Low + U16 fpgaVDrPWMPeriod; ///< Reg 60. VDr PWM period + U16 fpgaVPiPWMLow; ///< Reg 62. VPi PWM low + U16 fpgaVPiPWMPeriod; ///< Reg 64. VPi PWM period + U16 fpgaVSPPWMLow; ///< Reg 66. VSP PWM low + U16 fpgaVSPPWMPeriod; ///< Reg 68. VSP PWM period + U16 fpgaVRd1PWMLow; ///< Reg 70. VRd1 PWM low + U16 fpgaVRd1PWMPeriod; ///< Reg 72. VRd1 PWM period + U16 fpgaVRd2PWMLow; ///< Reg 74. VRd2 PWM low + U16 fpgaVRd2PWMPeriod; ///< Reg 76. VRd2 PWM period + U16 fpgaVPdPWMLow; ///< Reg 78. VPd PWM low + U16 fpgaVPdPWMPeriod; ///< Reg 80. VPd PWM period + U16 fpgaVSOLPWMLow; ///< Reg 82. VSOL PWM low + U16 fpgaVSOLPWMPeriod; ///< Reg 84. VSOL PWM period + U16 fpgaVRfPWMPullin; ///< Reg 86. VRf PWM pull in + U16 fpgaVRiPWMPullin; ///< Reg 88. VRi PWM pull in + U16 fpgaVRdPWMPullin; ///< Reg 90. VRd PWM pull in + U16 fpgaVRoPWMPullin; ///< Reg 92. VRo PWM pull in + U16 fpgaVPoPWMPullin; ///< Reg 94. VPo PWM pull in + U16 fpgaVBfPWMPullin; ///< Reg 96. VBf PWM pull in + U16 fpgaVRcPWMPullin; ///< Reg 98. VRc PWM pull in + U16 fpgaVDrPWMPullin; ///< Reg 100. VDr PWM pull in + U16 fpgaVPiPWMPullin; ///< Reg 102. VPi PWM pull in + U16 fpgaVSPPWMPullin; ///< Reg 104. VSP PWM pull in + U16 fpgaVRd1PWMPullin; ///< Reg 106. VRd1 PWM pull in + U16 fpgaVRd2PWMPullin; ///< Reg 108. VRd2 PWM pull in + U16 fpgaVPdPWMPullin; ///< Reg 110. VPd PWM pull in + U16 fpgaVSPR2PWMPullin; ///< Reg 112. VSPR2 PWM pull in + U16 fpgaValvePWMEnable; ///< Reg 114. valve PWM enable + + // DVT Registers + U08 fpgaTHdControlReg; ///< Reg 116. THd control register + U08 fpgaCPiCPoEmstatControl; ///< Reg 117. CPi/CPo Emstat control + U16 fpgaDACRegBIn; ///< Reg 118. Debug DAC channel B output + U16 fpgaDACRegCIn; ///< Reg 120. Debug DAC channel C output + U16 fpgaDACRegDIn; ///< Reg 122. Debug DAC channel D output + U16 fpgaDACRegEIn; ///< Reg 124. Debug DAC channel E output + U16 fpgaDACRegFIn; ///< Reg 126. Debug DAC channel F output + U16 fpgaDACRegGIn; ///< Reg 128. Debug DAC channel G output + U16 fpgaDACRegHIn; ///< Reg 130. Debug DAC channel H output + U32 fpgaCP1StepCount; ///< Reg 132. Concentrate pump 1 step count + U32 fpgaCP2StepCount; ///< Reg 136. Concentrate pump 2 step count + U08 fgpaNewCP2Control; ///< Reg 140. Concentrate pump 2 control + U08 fpgaNewCP1Control; ///< Reg 141. Concentrate pump 1 control } FPGA_ACTUATORS_T; #pragma pack(pop) // ********** private data ********** static FPGA_STATE_T fpgaState = FPGA_STATE_START; ///< FPGA current state. - static U32 fpgaCommRetryCount = 0; ///< FPGA communication retry count. static U32 fpgaReceiptCounter = 0; ///< FPGA receipt completed counter. static U32 fpgaTransmitCounter = 0; ///< FPGA transmit completed counter. @@ -1698,7 +1744,7 @@ *************************************************************************/ U08 getFPGAEmstatOutByte( void ) { - return fpgaSensorReadings.fpgaEmstatOutByte; + return fpgaSensorReadings.fpgaCD1CD2EmstatOutByte; } /*********************************************************************//** @@ -1710,7 +1756,7 @@ *************************************************************************/ U08 getFPGAEmstatRxErrCount( void ) { - return fpgaSensorReadings.fpgaEmstatRxErrorCount; + return fpgaSensorReadings.fpgaCD1CD2EmstatRxErrorCount; } /*********************************************************************//** @@ -1723,7 +1769,7 @@ *************************************************************************/ U16 getFPGAEmstatRxFifoCount( void ) { - return fpgaSensorReadings.fpgaEmstatRxFifoCount; + return fpgaSensorReadings.fpgaCD1CD2EmstatRxFifoCount; } /*********************************************************************//** @@ -1954,7 +2000,7 @@ *************************************************************************/ U16 getFPGATimerCount( void ) { - return fpgaSensorReadings.fpgaTimerCount_ms; + return fpgaSensorReadings.fpgaTimerCountMS; } /*********************************************************************//** @@ -2126,4 +2172,6 @@ return ( fpgaSensorReadings.fpgaBaroTemperature & MASK_OFF_U32_MSB ); } +/****************************DVT Functions*******************************************/ + /**@}*/