Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 -rf37b3de5fa91983790a36f271ccd4a1eb2b87315 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision f37b3de5fa91983790a36f271ccd4a1eb2b87315) @@ -44,7 +44,7 @@ #define FPGA_HEADER_START_ADDR 0x0000 #define FPGA_BULK_READ_START_ADDR 0x0100 -#define FPGA_BULK_WRITE_START_ADDR 0x000E +#define FPGA_BULK_WRITE_START_ADDR 0x000C #define FPGA_WRITE_CMD_BUFFER_LEN (FPGA_PAGE_SIZE+8) #define FPGA_READ_CMD_BUFFER_LEN 8 @@ -75,71 +75,84 @@ #pragma pack(push,1) typedef struct { - U08 fpgaId; - U08 fpgaRev; + U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation. + U08 fpgaRev; ///< Reg 1. FPGA revision being reported. } FPGA_HEADER_T; // read only on FPGA typedef struct // TODO - add all sensor readings to this structure per FPGA register map { - U32 fpgaLCA1; - U32 fpgaLCA2; - U32 fpgaADC1Temp; + U32 fpgaLCA1; ///< Reg 256. ADC1 channel 0 - load cell A1. + U32 fpgaLCB1; ///< Reg 260. ADC1 channel 1 - load cell B1. + U32 fpgaADC1Temp; ///< Reg 264. ADC1 channel 2 - internal temperature. - U32 fpgaLCB1; - U32 fpgaLCB2; - U32 fpgaADC2Temp; + U32 fpgaLCA2; ///< Reg 268. ADC2 channel 0 - load cell A2. + U32 fpgaLCB2; ///< Reg 272. ADC2 channel 1 - load cell B2. + U32 fpgaADC2Temp; ///< Reg 276. ADC2 channel 2 - internal temperature. - U32 fpgaCD1Temp; // Conductivity sensor 1 in the mixing area - U32 fpgaCD2Temp; - U32 fpgaTPoTemp; - U32 fpgaTPiTemp; - U32 fpgaRTDTemp; + U32 fpgaCD1; ///< Reg 280. ADC RTD channel 0 - conductivity sensor 1. + U32 fpgaCD2; ///< Reg 284. ADC RTD channel 1 - conductivity sensor 2. + U32 fpgaTPoTemp; ///< Reg 288. ADC RTD channel 2 - conductivity sensor CPi temperature. + U32 fpgaTPiTemp; ///< Reg 292. ADC RTD channel 3 - conductivity sensor CPo temperature. + U32 fpgaRTDTemp; ///< Reg 296. ADC RTD channel 4 - internal temperature. - U32 fpgaTHDo; // TRo - U32 fpgaTHDoTemp; + U32 fpgaTHDo; ///< Reg 300. ADC THDo channel 0 - temperature. + U32 fpgaTHDoTemp; ///< Reg 304. ADC THDo channel 1 - internal temperature. - U32 fpgaTDi; - U32 fpgaTDiTemp; // Dialysate inlet sensor + U32 fpgaTDi; ///< Reg 308. ADC TDi channel 0 - temperature. + U32 fpgaTDiTemp; ///< Reg 312. ADC TDi channel 1 - internal temperature. - U32 fpgaCPoEc; - U32 fpgaCPoTds; + U32 fpgaCPo; ///< Reg 316. Conductivity CPo. + U32 fpgaCPi; ///< Reg 320. Conductivity CPi. - U16 fpgaStatus; + U16 fpgaPrimaryHeaterIntTemp; ///< Reg 324. Primary heater temperature. + U16 fpgaPrimaryHeaterIntJunctionTemp; ///< Reg 326. Primary heater internal temperature. + U16 fpgaTrimmerHeaterIntTemp; ///< Reg 328. Trimmer heater temperature. + U16 fpgaTrimmerHeaterIntJunctionTemp; ///< Reg 330. Trimmer heater internal temperature. - U16 fpgaPrimaryHeaterIntTemp; - U16 fpgaPrimaryHeaterIntJunctionTemp; - U16 fpgaTrimmerHeaterIntTemp; - U16 fpgaTrimmerHeaterIntJunctionTemp; + U16 fpgaDrainPumpSpeed; ///< Reg 332. Drain pump speed feedback. + U16 fpgaROFlowRate; ///< Reg 334. RO flow. - U16 fpgaDrainPumpSpeed; - U16 fpgaROFlowRate; - U16 fpgaValveStates; + U16 accelX; ///< Reg 336. Accelerometer X axis data. + U16 accelY; ///< Reg 338. Accelerometer Y axis data. + U16 accelZ; ///< Reg 340. Accelerometer Z axis data. + U16 accelXMax; ///< Reg 342. Accelerometer X axis max data (since last read). + U16 accelYMax; ///< Reg 344. Accelerometer Y axis max data (since last read). + U16 accelZMax; ///< Reg 346. Accelerometer Z axis max data (since last read). + U16 accelFaultRegister; ///< Reg 348. Accelerometer fault register. + U16 accelSampleCounter; ///< Reg 350. Accelerometer sample count. - U08 fpgaIOErrorCntProcessor; - U08 fpgaIOErrorCntPC; - U08 fpgaADC1ReadCnt; - U08 fpgaADC1ErrorCnt; - U08 fpgaADC2ReadCnt; - U08 fpgaADC2ErrorCnt; - U08 fpgaRTDReadCnt; - U08 fpgaRTDErrorCnt; - U08 fpgaTHDoReadCnt; - U08 fpgaTHDoErrorCnt; - U08 fpgaTDiReadCnt; - U08 fpgaTDiErrorCnt; - U08 fpgaPrimaryHeaterFlags; - U08 fpgaPrimaryHeaterReadCnt; - U08 fpgaTrimmerHeaterFlags; - U08 fpgaTrimmerHeaterReadCnt; - U08 fpgaCPoTempConf; - U08 fpgaCPoSanityData; - U08 fpgaCPoReadCnt; - U08 fpgaCPoErrorCnt; + U08 fpgaIOErrorCntProcessor; ///< Reg 352. + U08 fpgaIOErrorCntPC; ///< Reg 353. + U08 fpgaADC1ReadCnt; ///< Reg 354. + U08 fpgaADC1ErrorCnt; ///< Reg 355. + U08 fpgaADC2ReadCnt; ///< Reg 356. + U08 fpgaADC2ErrorCnt; ///< Reg 357. + U08 fpgaRTDReadCnt; ///< Reg 358. + U08 fpgaRTDErrorCnt; ///< Reg 359. + U08 fpgaTHDoReadCnt; ///< Reg 360. + U08 fpgaTHDoErrorCnt; ///< Reg 361. + U08 fpgaTDiReadCnt; ///< Reg 362. + U08 fpgaTDiErrorCnt; ///< Reg 363. + U08 fpgaPrimaryHeaterFlags; ///< Reg 364. + U08 fpgaPrimaryHeaterReadCnt; ///< Reg 365. + U08 fpgaTrimmerHeaterFlags; ///< Reg 366. + U08 fpgaTrimmerHeaterReadCnt; ///< Reg 367. + U08 fpgaCPoFault; ///< Reg 368. + U08 fpgaCPoReadCnt; ///< Reg 369. + U08 fpgaCPoErrorCnt; ///< Reg 370. + U08 fpgaCPiFault; ///< Reg 371. + U08 fpgaCPiReadCnt; ///< Reg 372. + U08 fpgaCPiErrorCnt; ///< Reg 373. + U08 fpgaCP1CP2Fault; ///< Reg 374. + U08 fpgaReserved1; ///< Reg 375. + + U16 fpgaValveStates; ///< Reg 376. } DG_FPGA_SENSORS_T; typedef struct { U16 fpgaCPoProbeType; + U16 fpgaCPiProbeType; U16 fpgaDrainPumpSetSpeed; U16 fpgaValveStates; } FPGA_ACTUATORS_T;