Index: firmware/App/Services/FpgaRO.c =================================================================== diff -u -r69e32c52c41cfc8073a7eb59408fb30e6ac40f86 -r17a448770daa138ebeb6ce79974966e650828f25 --- firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision 69e32c52c41cfc8073a7eb59408fb30e6ac40f86) +++ firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision 17a448770daa138ebeb6ce79974966e650828f25) @@ -69,44 +69,44 @@ S16 pressureM1; ///< Reg 264. M1 pressure data. U16 temperatureM1; ///< Reg 266. M1 temperature data. U08 readCountM1; ///< Reg 268. M1 read counter. - U08 errorCountM1; ///< Reg 269. M1 error counter. + U08 reserved1a; ///< Reg 269. M1 error counter. S16 pressureM3; ///< Reg 270. M3 pressure data. U16 temperatureM3; ///< Reg 272. M3 temperature data. U08 readCountM3; ///< Reg 274. M3 read counter. - U08 errorCountM3; ///< Reg 275. M3 error counter. + U08 reserved1b; ///< Reg 275. M3 error counter. S16 pressureP8; ///< Reg 276. P8 pressure data. U16 temperatureP8; ///< Reg 278. P8 temperature data. U08 readCountP8; ///< Reg 280. P8 read counter. - U08 errorCountP8; ///< Reg 281. P8 error counter. + U08 reserved1c; ///< Reg 281. P8 error counter. S16 pressureP13; ///< Reg 282. P13 pressure data. U16 temperatureP13; ///< Reg 284. P13 temperature data. U08 readCountP13; ///< Reg 286. P13 read counter. - U08 errorCountP13; ///< Reg 287. P13 error counter. + U08 reserved1d; ///< Reg 287. P13 error counter. S16 pressureP17; ///< Reg 288. P17 pressure data. U16 temperatureP17; ///< Reg 290. P17 temperature data. U08 readCountP17; ///< Reg 292. P17 read counter. - U08 errorCountP17; ///< Reg 293. P17 error counter. + U08 reserved1e; ///< Reg 293. P17 error counter. S16 pressureX1; ///< Reg 294. X1 pressure data. U16 temperatureX1; ///< Reg 296. X1 temperature data. U08 readCountX1; ///< Reg 298. X1 read counter. - U08 errorCountX1; ///< Reg 299. X1 error counter. + U08 reserved1f; ///< Reg 299. X1 error counter. S16 pressureX2; ///< Reg 300. X2 pressure data. U16 temperatureX2; ///< Reg 302. X2 temperature data. U08 readCountX2; ///< Reg 304. X2 read counter. - U08 errorCountX2; ///< Reg 305. X2 error counter. + U08 reserved1g; ///< Reg 305. X2 error counter. S16 pressureX3; ///< Reg 306. X3 pressure data. U16 temperatureX3; ///< Reg 308. X3 temperature data. U08 readCountX3; ///< Reg 310. X3 read counter. - U08 errorCountX3; ///< Reg 311. X3 error counter. + U08 reserved1h; ///< Reg 311. X3 error counter. S16 pressureX4; ///< Reg 312. X4 pressure data. U16 temperatureX4; ///< Reg 314. X4 temperature data. U08 readCountX4; ///< Reg 316. X4 read counter. - U08 errorCountX4; ///< Reg 317. X4 error counter. + U08 reserved1i; ///< Reg 317. X4 error counter. S16 pressureX5; ///< Reg 318. X5 pressure data. U16 temperatureX5; ///< Reg 320. X5 temperature data. U08 readCountX5; ///< Reg 322. X5 read counter. - U08 errorCountX5; ///< Reg 323. X5 error counter. - U16 reserved1; ///< Reg 324. Reserved. + U08 reserved1j; ///< Reg 323. X5 error counter. + U16 p40PumpTachCount; ///< Reg 324. P40 pump tachometer counter. U16 reserved2; ///< Reg 326. Reserved. U08 p25LevelSwitch; ///< Reg 328. P25 level switch. U08 reserved3; ///< Reg 329. Reserved. @@ -124,19 +124,29 @@ U16 conductivityP18Temp; ///< Reg 352. P18 conductivity sensor temperature. U08 conductivityP18ReadCount; ///< Reg 354. P18 conductivity sensor read counter. U08 conductivityP18ErrorCount; ///< Reg 355. P18 conductivity sensor error counter. - U16 flowRateP16; ///< Reg 356. P16 flow sensor rate. - U16 flowTempP16; ///< Reg 358. P16 flow sensor temperature. + U16 flowRateP7; ///< Reg 356. P7 flow sensor rate. + U16 flowTempP7; ///< Reg 358. P7 flow sensor temperature. U16 p12PumpTachCount; ///< Reg 360. P12 pump tachometer counter. U16 dsPumpTachCount; ///< Reg 362. DSP tachometer counter. - U16 flowIntTempP16; ///< Reg 364. P16 flow sensor internal temperature. + U16 flowIntTempP7; ///< Reg 364. P7 flow sensor internal temperature. U16 valveControlReadback; ///< Reg 366. Valve control bits read back. U16 p12PumpPWMReadback; ///< Reg 368. P12 pump PWM read back. - U16 heaterPWMReadback; ///< Reg 370. Heater PWM read back. - U08 flowReadCount; ///< Reg 372. Flow sensor read counter. - U08 flowErrorCount; ///< Reg 373. Flow sensor error counter. + U16 p40PumpPWMReadback; ///< Reg 370. P40 pump PWM read back. + U08 p7flowReadCount; ///< Reg 372. P7 Flow sensor read counter. + U08 p7flowErrorCount; ///< Reg 373. P7 Flow sensor error counter. U16 valvePWMEnableReadback; ///< Reg 374. Valve PWM enable read back. U32 tempP23; ///< Reg 376. P23 temperature sensor reading. - U32 tempP22; ///< Reg 380. P22 temperature sensor reading. + U32 tempP22; ///< Reg 380. P22 ( TRO2 ) temperature sensor reading. + U32 tempTax1; ///< Reg 384. ( Tax1 ) temperature sensor reading. + U32 tempRTD; ///< Reg 388. spare temperature sensor reading. + U08 ad7124errcnt; ///< Reg 392. Counter which increments when an invalid transaction happen between FPGA and AD7124. + U08 ad7124readcnt; ///< Reg 393. Counter which increments when a valid transaction happens between FPGA and AD7124. + U16 flowRateP16; ///< Reg 394. P16 flow sensor rate. + U16 flowTempP16; ///< Reg 396. P16 flow sensor temperature. + U16 flowIntTempP16; ///< Reg 398. P16 flow sensor internal temperature. + U08 p16flowReadCount; ///< Reg 400. P16 Flow sensor read counter. + U08 p16flowErrorCount; ///< Reg 401. P16 Flow sensor error counter. + } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -152,17 +162,19 @@ U16 fpgaGenWrRd; ///< Reg 20. FPGA general write/read-back register (mirrored to a general read register in read page at addr 256). U16 descalePumpSpeed; ///< Reg 22. Descaler pump speed register. U08 descalePumpControl; ///< Reg 24. Descaler pump control register. - U08 p12PumpControl; ///< Reg 25. P12 pump control register.. + U08 p12PumpControl; ///< Reg 25. P12 pump control register. U16 valveVwiPWMLow; ///< Reg 26. Valve VWi PWM low pulse period in 0.1 uSec. U16 valveVwiPWMPeriod; ///< Reg 28. Valve VWi PWM full period in 0.1 uSec. U16 valvePWMPullIn; ///< Reg 30. Valve PWM high pulse period when valve is on in 0.1 uSec. U16 p12PumpPWMDutyCyclePct; ///< Reg 32. P12 pump PWM duty cycle in percentage. - U16 p24PWMDutyCyclePct; ///< Reg 34. P24 heater PWM duty cycle in percentage. - U08 reserved1; ///< Reg 36. Not used. - U08 p24Control; ///< Reg 37. P24 heater (HRO) control register. - U08 flowControl; ///< Reg 38. AVS Romer flow sensor control register. - U08 flowAddress; ///< Reg 39. AVS Romer flow sensor I2C slave address register. + U16 p40PumpPWMDutyCyclePct; ///< Reg 34. P40 pump PWM duty cycle in percentage. + U08 p40PumpControl; ///< Reg 36. P40 pump control register. + U08 reserved1; ///< Reg 37. Reserved. + U08 flowControlp7; ///< Reg 38. P7 AVS Romer flow sensor control register. + U08 flowAddressp7; ///< Reg 39. P7 AVS Romer flow sensor I2C slave address register. U16 valvePWMEnable; ///< Reg 40. Valve PWM enable register. + U08 flowControlp16; ///< Reg 42. P16 AVS Romer flow sensor control register. + U08 flowAddressp16; ///< Reg 43. P16 AVS Romer flow sensor I2C slave address register. } FPGA_ACTUATORS_T; #pragma pack(pop) @@ -456,14 +468,7 @@ *************************************************************************/ void setFPGAP24Enabled( BOOL enable ) { - if ( TRUE == enable ) - { - fpgaActuatorSetPoints.p24Control = HEATER_ENABLED; - } - else - { - fpgaActuatorSetPoints.p24Control = HEATER_DISABLED; - } + return; } /*********************************************************************//** @@ -479,7 +484,7 @@ *************************************************************************/ void setFPGAP24PWM( U16 pwm ) { - fpgaActuatorSetPoints.p24PWMDutyCyclePct = pwm; + return; } /*********************************************************************//** @@ -520,18 +525,6 @@ /*********************************************************************//** * @brief - * The getFPGAM1ErrorCount function gets the M1 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountM1 - * @details \b Outputs: none - * @return M1 sensor error count - *************************************************************************/ -U08 getFPGAM1ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountM1; -} - -/*********************************************************************//** - * @brief * The getFPGAM3RawPressure function gets the M3 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureM3 * @details \b Outputs: none @@ -568,18 +561,6 @@ /*********************************************************************//** * @brief - * The getFPGAM3ErrorCount function gets the M3 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountM3 - * @details \b Outputs: none - * @return M3 sensor error count - *************************************************************************/ -U08 getFPGAM3ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountM3; -} - -/*********************************************************************//** - * @brief * The getFPGAP8RawPressure function gets the P8 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP8 * @details \b Outputs: none @@ -616,18 +597,6 @@ /*********************************************************************//** * @brief - * The getFPGAP8ErrorCount function gets the P8 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountP8 - * @details \b Outputs: none - * @return P8 sensor error count - *************************************************************************/ -U08 getFPGAP8ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountP8; -} - -/*********************************************************************//** - * @brief * The getFPGAP13RawPressure function gets the P13 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP13 * @details \b Outputs: none @@ -664,18 +633,6 @@ /*********************************************************************//** * @brief - * The getFPGAP13ErrorCount function gets the P13 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountP13 - * @details \b Outputs: none - * @return P13 sensor error count - *************************************************************************/ -U08 getFPGAP13ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountP13; -} - -/*********************************************************************//** - * @brief * The getFPGAP17RawPressure function gets the P17 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureP17 * @details \b Outputs: none @@ -712,18 +669,6 @@ /*********************************************************************//** * @brief - * The getFPGAP17ErrorCount function gets the P17 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountP17 - * @details \b Outputs: none - * @return P17 sensor error count - *************************************************************************/ -U08 getFPGAP17ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountP17; -} - -/*********************************************************************//** - * @brief * The getFPGAX1RawPressure function gets the X1 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureX1 * @details \b Outputs: none @@ -760,18 +705,6 @@ /*********************************************************************//** * @brief - * The getFPGAX1ErrorCount function gets the X1 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountX1 - * @details \b Outputs: none - * @return X1 sensor error count - *************************************************************************/ -U08 getFPGAX1ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountX1; -} - -/*********************************************************************//** - * @brief * The getFPGAX2RawPressure function gets the X2 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureX2 * @details \b Outputs: none @@ -808,18 +741,6 @@ /*********************************************************************//** * @brief - * The getFPGAX2ErrorCount function gets the X2 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountX2 - * @details \b Outputs: none - * @return X2 sensor error count - *************************************************************************/ -U08 getFPGAX2ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountX2; -} - -/*********************************************************************//** - * @brief * The getFPGAX3RawPressure function gets the X3 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureX3 * @details \b Outputs: none @@ -856,18 +777,6 @@ /*********************************************************************//** * @brief - * The getFPGAX3ErrorCount function gets the X3 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountX3 - * @details \b Outputs: none - * @return X3 sensor error count - *************************************************************************/ -U08 getFPGAX3ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountX3; -} - -/*********************************************************************//** - * @brief * The getFPGAX4RawPressure function gets the X4 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureX4 * @details \b Outputs: none @@ -904,18 +813,6 @@ /*********************************************************************//** * @brief - * The getFPGAX4ErrorCount function gets the X4 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountX4 - * @details \b Outputs: none - * @return X4 sensor error count - *************************************************************************/ -U08 getFPGAX4ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountX4; -} - -/*********************************************************************//** - * @brief * The getFPGAX5RawPressure function gets the X5 pressure reading. * @details \b Inputs: fpgaSensorReadings.pressureX5 * @details \b Outputs: none @@ -952,18 +849,6 @@ /*********************************************************************//** * @brief - * The getFPGAX5ErrorCount function gets the X5 sensor error count. - * @details \b Inputs: fpgaSensorReadings.errorCountX5 - * @details \b Outputs: none - * @return X5 sensor error count - *************************************************************************/ -U08 getFPGAX5ErrorCount( void ) -{ - return fpgaSensorReadings.errorCountX5; -} - -/*********************************************************************//** - * @brief * The getFPGAP23Temperature function gets the TRO1 temperature sensor reading. * @details \b Inputs: fpgaSensorReadings.tempP23 * @details \b Outputs: none @@ -1032,8 +917,7 @@ *************************************************************************/ U16 getFPGAFlowP7( void ) { - //return fpgaSensorReadings.flowRateP7; - return 0; + return fpgaSensorReadings.flowRateP7; } /*********************************************************************//** @@ -1046,8 +930,7 @@ *************************************************************************/ U16 getFPGAFlowP7Temp( void ) { - //return fpgaSensorReadings.flowTempP7; - return 0; + return fpgaSensorReadings.flowTempP7; } /*********************************************************************//** @@ -1472,4 +1355,59 @@ return fpgaSensorReadings.conductivityP18Data; } +/*********************************************************************//** + * @brief + * The setFPGAP40PumpEnable function enables or disables the P40 pump. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p40PumpControl + * @param enable flag indicating whether to enable or disable the P40 pump. + * @return none + *************************************************************************/ +void setFPGAP40PumpEnable( BOOL enable ) +{ + fpgaActuatorSetPoints.p40PumpControl = ( TRUE == enable ? 0x1 : 0x0 ); +} + +/*********************************************************************//** + * @brief + * The setFPGAP40PumpPWM function sets the P40 pump PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @note PWM values < 5% or > 95% will cause pump to stop so effective + * range is actually 25..475. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setFPGAP40PumpPWM( U16 pwm ) +{ + fpgaActuatorSetPoints.p40PumpPWMDutyCyclePct = pwm; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM + * duty cycle. + * @details \b Inputs: fpgaSensorReadings.p40PumpPWMReadback + * @details \b Outputs: none + * @return measured speed (RPM) of the P40 pump + *************************************************************************/ +U16 getFPGAP40PumpPWM( void ) +{ + return fpgaSensorReadings.p40PumpPWMReadback; +} + +/*********************************************************************//** + * @brief + * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count + * from the P40 pump hall sensor. + * @details \b Inputs: fpgaSensorReadings.p40PumpTachCount + * @details \b Outputs: none + * @return P40 pump tachometer count + *************************************************************************/ +U16 getFPGAP40PumpTachCount( void ) +{ + return fpgaSensorReadings.p40PumpTachCount; +} + /**@}*/