Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new FPGA, commands to control CH3 for ILC power supply #36

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130,113 changes: 64,920 additions & 65,193 deletions Bitfiles/NiFpga_ts_M1M3ThermalFPGA.lvbitx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ v0.2.0

* Report thermal status strings
* Reports meaning of ILC status bites
* CH3 control (ILC power on L5)
* Improved makefile

v0.1.0
Expand Down
4 changes: 4 additions & 0 deletions src/LSST/M1M3/TS/Commands/Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void Update::_sendFCU() {
}

void Update::_sendFlowMeter() {
#if 0
try {
bool finished = IFPGA::get().flowMeter->runLoop(IFPGA::get());
if (finished) {
Expand All @@ -145,9 +146,11 @@ void Update::_sendFlowMeter() {
SPDLOG_WARN("Cannot poll Flow Meter: {}", e.what());
IFPGA::get().setNextFlowMeter();
}
#endif
}

void Update::_sendVFD() {
#if 0
try {
bool finished = IFPGA::get().vfd->runLoop(IFPGA::get());
if (finished) {
Expand All @@ -157,4 +160,5 @@ void Update::_sendVFD() {
SPDLOG_WARN("Cannot poll VFD: {}", e.what());
IFPGA::get().setNextVFD();
}
#endif
}
1 change: 1 addition & 0 deletions src/LSST/M1M3/TS/IFPGA.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ constexpr uint16_t SLOT4_DIS = 29;
constexpr uint16_t FCU_ON = 61;
constexpr uint16_t HEARTBEAT = 62;
constexpr uint16_t COOLANT_PUMP_ON = 63;
constexpr uint16_t ILC_POWER = 64;
constexpr uint16_t GLYCOLTEMP_LAST_LINE = 77;
constexpr uint16_t GLYCOLTEMP_DEBUG = 78;
constexpr uint16_t GLYCOLTEMP_TEMPERATURES = 79;
Expand Down
2 changes: 1 addition & 1 deletion src/NiFpga/NiFpga_ts_M1M3ThermalFPGA.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* The signature of the FPGA bitfile.
*/
static const char* const NiFpga_ts_M1M3ThermalFPGA_Signature = "3CBD1821559D2404BA9CBF2A52EBA851";
static const char* const NiFpga_ts_M1M3ThermalFPGA_Signature = "06A3F137DC08CF6474991379A7ACAE3C";

#if NiFpga_Cpp
extern "C" {
Expand Down
19 changes: 12 additions & 7 deletions src/m1m3tscli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class M1M3TScli : public FPGACliApp {
int glycolTemperature(command_vec cmds);
int glycolDebug(command_vec cmds);
int slot4(command_vec);
int ilcPower(command_vec);

protected:
virtual FPGA* newFPGA(const char* dir) override;
Expand Down Expand Up @@ -158,6 +159,8 @@ M1M3TScli::M1M3TScli(const char* name, const char* description) : FPGACliApp(nam
"<heater PWM> <fan RPM> " ILC_ARG, "Sets FCU heater and fan");
addCommand("slot4", std::bind(&M1M3TScli::slot4, this, std::placeholders::_1), "", NEED_FPGA, NULL,
"Reads slot 4 inputs");
addCommand("ilc-power", std::bind(&M1M3TScli::ilcPower, this, std::placeholders::_1), "B", NEED_FPGA,
"<on/off>", "Sets ILC power at L5 (CH3 of Mod 5)");

addILCCommand(
"fcu-status",
Expand Down Expand Up @@ -271,9 +274,7 @@ int M1M3TScli::mpuWrite(command_vec cmds) {
int M1M3TScli::printFlowMeter(command_vec cmds) {
flowMeter->clearCommanded();

while (flowMeter->getLoopState() != loop_state_t::IDLE) {
flowMeter->runLoop(*getFPGA());
}
getFPGA()->mpuCommands(*flowMeter);

return 0;
}
Expand Down Expand Up @@ -304,9 +305,7 @@ int M1M3TScli::printPump(command_vec cmds) {
}
}

while (vfd->getLoopState() != loop_state_t::IDLE) {
vfd->runLoop(*fpga);
}
fpga->mpuCommands(*vfd);

return 0;
}
Expand Down Expand Up @@ -480,6 +479,12 @@ int M1M3TScli::slot4(command_vec) {
return 0;
}

int M1M3TScli::ilcPower(command_vec cmds) {
uint16_t buf[2] = {FPGAAddress::ILC_POWER, onOff(cmds[0])};
dynamic_cast<IFPGA*>(getFPGA())->writeCommandFIFO(buf, 2, 10);
return 0;
}

ILCUnits M1M3TScli::getILCs(command_vec cmds) {
ILCUnits units;
int ret = -2;
Expand All @@ -495,7 +500,7 @@ ILCUnits M1M3TScli::getILCs(command_vec cmds) {
} else {
try {
int address = std::stoi(c);
if (address <= 0 || address > NUM_TS_ILC) {
if ((address <= 0 || address > NUM_TS_ILC) && (address != 255)) {
std::cerr << "Invalid address " << c << std::endl;
ret = -1;
continue;
Expand Down
Loading