Commit 69c0de58 authored by minime's avatar minime
Browse files

Minor

parent 5224afb0
......@@ -1164,7 +1164,12 @@ void RD53FWInterface::ConfigureFastCommands(const FastCommandsConfig* cfg)
RD53FWInterface::SendBoardCommand("user.ctrl_regs.fast_cmd_reg_1.load_config");
}
void RD53FWInterface::SetAndConfigureFastCommands(const BeBoard* pBoard, const uint32_t nTRIGxEvent, const size_t injType, const uint32_t injLatency, const uint32_t nClkDelays, const bool enableAutozero)
void RD53FWInterface::SetAndConfigureFastCommands(const BeBoard* pBoard,
const uint32_t nTRIGxEvent,
const size_t injType,
const uint32_t injLatency,
const uint32_t nClkDelays,
const bool enableAutozero)
// ############################
// # injType == 0 --> None #
// # injType == 1 --> Analog #
......@@ -1709,7 +1714,8 @@ float RD53FWInterface::ReadHybridVoltage(int hybridId)
usleep(DEEPSLEEP);
auto value = calcVoltage(senseVDD, senseGND);
LOG(INFO) << BOLDBLUE << "\t--> Hybrid voltage: " << BOLDYELLOW << std::setprecision(3) << value << BOLDBLUE << " V (corresponds to half VOUT_dig_ShuLDO of the chip)" << std::setprecision(-1) << RESET;
LOG(INFO) << BOLDBLUE << "\t--> Hybrid voltage: " << BOLDYELLOW << std::setprecision(3) << value << BOLDBLUE << " V (corresponds to half VOUT_dig_ShuLDO of the chip)" << std::setprecision(-1)
<< RESET;
return value;
}
......
......@@ -211,7 +211,12 @@ class RD53FWInterface : public BeBoardFWInterface
};
void ConfigureFromXML(const Ph2_HwDescription::BeBoard* pBoard);
void SetAndConfigureFastCommands(const Ph2_HwDescription::BeBoard* pBoard, const uint32_t nTRIGxEvent, const size_t injType, const uint32_t injLatency = 0, const uint32_t nClkDelays = 0, const bool enableAutozero = false);
void SetAndConfigureFastCommands(const Ph2_HwDescription::BeBoard* pBoard,
const uint32_t nTRIGxEvent,
const size_t injType,
const uint32_t injLatency = 0,
const uint32_t nClkDelays = 0,
const bool enableAutozero = false);
struct DIO5Config
{
......
......@@ -181,53 +181,53 @@ void RD53Interface::InitRD53Aurora(ReadoutChip* pChip, int nActiveLanes)
usleep(DEEPSLEEP);
}
bool RD53Interface::WriteChipReg(Chip* pChip, const std::string& pRegNode, const uint16_t data, bool pVerifLoop)
bool RD53Interface::WriteChipReg(Chip* pChip, const std::string& regName, const uint16_t data, bool pVerifLoop)
{
this->setBoard(pChip->getBeBoardId());
RD53Interface::sendCommand(static_cast<RD53*>(pChip), RD53Cmd::WrReg(pChip->getId(), pChip->getRegItem(pRegNode).fAddress, data));
if((pRegNode == "VCAL_HIGH") || (pRegNode == "VCAL_MED")) usleep(VCALSLEEP); // @TMP@
RD53Interface::sendCommand(static_cast<RD53*>(pChip), RD53Cmd::WrReg(pChip->getId(), pChip->getRegItem(regName).fAddress, data));
if((regName == "VCAL_HIGH") || (regName == "VCAL_MED")) usleep(VCALSLEEP); // @TMP@
if(pVerifLoop == true)
{
if(pRegNode == "PIX_PORTAL")
if(regName == "PIX_PORTAL")
{
auto pixMode = RD53Interface::ReadChipReg(pChip, "PIX_MODE");
if(pixMode == 0)
{
auto regReadback = RD53Interface::ReadRD53Reg(static_cast<RD53*>(pChip), pRegNode);
auto regReadback = RD53Interface::ReadRD53Reg(static_cast<RD53*>(pChip), regName);
auto row = RD53Interface::ReadChipReg(pChip, "REGION_ROW");
if(regReadback.size() == 0 /* @TMP@ */ || regReadback[0].first != row || regReadback[0].second != data)
{
LOG(ERROR) << BOLDRED << "Error while writing into RD53 reg. " << BOLDYELLOW << pRegNode << RESET;
LOG(ERROR) << BOLDRED << "Error while writing into RD53 reg. " << BOLDYELLOW << regName << RESET;
return false;
}
}
}
else if(data != RD53Interface::ReadChipReg(pChip, pRegNode))
else if(data != RD53Interface::ReadChipReg(pChip, regName))
return false;
}
pChip->setReg(pRegNode, data);
pChip->setReg(regName, data);
return true;
}
void RD53Interface::WriteBoardBroadcastChipReg(const BeBoard* pBoard, const std::string& pRegNode, const uint16_t data)
void RD53Interface::WriteBoardBroadcastChipReg(const BeBoard* pBoard, const std::string& regName, const uint16_t data)
{
this->setBoard(pBoard->getId());
const uint16_t address = static_cast<RD53*>(pBoard->at(0)->at(0)->at(0))->getRegItem(pRegNode).fAddress;
const uint16_t address = static_cast<RD53*>(pBoard->at(0)->at(0)->at(0))->getRegItem(regName).fAddress;
static_cast<RD53FWInterface*>(fBoardFW)->WriteChipCommand(RD53Cmd::WrReg(RD53Constants::BROADCAST_CHIPID, address, data).getFrames(), -1);
}
uint16_t RD53Interface::ReadChipReg(Chip* pChip, const std::string& pRegNode)
uint16_t RD53Interface::ReadChipReg(Chip* pChip, const std::string& regName)
{
this->setBoard(pChip->getBeBoardId());
const int nAttempts = 2;
for(auto attempt = 0; attempt < nAttempts; attempt++)
{
auto regReadback = RD53Interface::ReadRD53Reg(static_cast<RD53*>(pChip), pRegNode);
auto regReadback = RD53Interface::ReadRD53Reg(static_cast<RD53*>(pChip), regName);
if(regReadback.size() == 0)
{
LOG(WARNING) << BLUE << "Empty register readback, attempt n. " << YELLOW << attempt << RESET;
......@@ -242,11 +242,11 @@ uint16_t RD53Interface::ReadChipReg(Chip* pChip, const std::string& pRegNode)
return 0;
}
std::vector<std::pair<uint16_t, uint16_t>> RD53Interface::ReadRD53Reg(ReadoutChip* pChip, const std::string& pRegNode)
std::vector<std::pair<uint16_t, uint16_t>> RD53Interface::ReadRD53Reg(ReadoutChip* pChip, const std::string& regName)
{
this->setBoard(pChip->getBeBoardId());
RD53Interface::sendCommand(pChip, RD53Cmd::RdReg(pChip->getId(), pChip->getRegItem(pRegNode).fAddress));
RD53Interface::sendCommand(pChip, RD53Cmd::RdReg(pChip->getId(), pChip->getRegItem(regName).fAddress));
auto regReadback = static_cast<RD53FWInterface*>(fBoardFW)->ReadChipRegisters(pChip);
for(auto i = 0u; i < regReadback.size(); i++)
......@@ -437,10 +437,10 @@ void RD53Interface::ReadChipAllLocalReg(ReadoutChip* pChip, const std::string& r
for(auto col = 0u; col < RD53::nCols; col++) pValue.getChannel<uint16_t>(row, col) = pRD53->getTDAC(row, col);
}
void RD53Interface::PackChipCommands(Chip* pChip, const std::string& pRegNode, uint16_t data, std::vector<uint16_t>& chipCommandList, bool updateReg)
void RD53Interface::PackChipCommands(ReadoutChip* pChip, const std::string& regName, uint16_t data, std::vector<uint16_t>& chipCommandList, bool updateReg)
{
RD53Cmd::WrReg(pChip->getId(), pChip->getRegItem(pRegNode).fAddress, data).appendTo(chipCommandList);
if(updateReg == true) pChip->setReg(pRegNode, data);
RD53Cmd::WrReg(pChip->getId(), pChip->getRegItem(regName).fAddress, data).appendTo(chipCommandList);
if(updateReg == true) pChip->setReg(regName, data);
}
void RD53Interface::SendChipCommandsPack(const std::vector<uint16_t>& chipCommandList, int hybridId) { static_cast<RD53FWInterface*>(fBoardFW)->WriteChipCommand(chipCommandList, hybridId); }
......
......@@ -30,23 +30,23 @@ class RD53Interface : public ReadoutChipInterface
int CheckChipID(Ph2_HwDescription::Chip* pChip, int chipIDfromDB);
bool ConfigureChip(Ph2_HwDescription::Chip* pChip, bool pVerifLoop = true, uint32_t pBlockSize = 310) override;
bool WriteChipReg(Ph2_HwDescription::Chip* pChip, const std::string& pRegNode, uint16_t data, bool pVerifLoop = true) override;
void WriteBoardBroadcastChipReg(const Ph2_HwDescription::BeBoard* pBoard, const std::string& pRegNode, uint16_t data) override;
bool WriteChipReg(Ph2_HwDescription::Chip* pChip, const std::string& regName, uint16_t data, bool pVerifLoop = true) override;
void WriteBoardBroadcastChipReg(const Ph2_HwDescription::BeBoard* pBoard, const std::string& regName, uint16_t data) override;
bool WriteChipAllLocalReg(Ph2_HwDescription::ReadoutChip* pChip, const std::string& regName, ChipContainer& pValue, bool pVerifLoop = true) override;
void ReadChipAllLocalReg(Ph2_HwDescription::ReadoutChip* pChip, const std::string& regName, ChipContainer& pValue) override;
uint16_t ReadChipReg(Ph2_HwDescription::Chip* pChip, const std::string& pRegNode) override;
uint16_t ReadChipReg(Ph2_HwDescription::Chip* pChip, const std::string& regName) override;
bool ConfigureChipOriginalMask(Ph2_HwDescription::ReadoutChip* pChip, bool pVerifLoop = true, uint32_t pBlockSize = 310) override;
bool MaskAllChannels(Ph2_HwDescription::ReadoutChip* pChip, bool mask, bool pVerifLoop = true) override;
bool maskChannelsAndSetInjectionSchema(Ph2_HwDescription::ReadoutChip* pChip, const ChannelGroupBase* group, bool mask, bool inject, bool pVerifLoop = false) override;
void PackChipCommands(Ph2_HwDescription::Chip* pChip, const std::string& pRegNode, uint16_t data, std::vector<uint16_t>& chipCommandList, bool updateReg = false);
void PackChipCommands(Ph2_HwDescription::ReadoutChip* pChip, const std::string& regName, uint16_t data, std::vector<uint16_t>& chipCommandList, bool updateReg = false);
void SendChipCommandsPack(const std::vector<uint16_t>& chipCommandList, int hybridId);
void PackHybridCommands(const std::vector<uint16_t>& chipCommandList, int hybridId, std::vector<uint32_t>& hybridCommandList);
void SendHybridCommandsPack(const std::vector<uint32_t>& hybridCommandList);
private:
std::vector<std::pair<uint16_t, uint16_t>> ReadRD53Reg(Ph2_HwDescription::ReadoutChip* pChip, const std::string& pRegNode);
std::vector<std::pair<uint16_t, uint16_t>> ReadRD53Reg(Ph2_HwDescription::ReadoutChip* pChip, const std::string& regName);
void WriteRD53Mask(Ph2_HwDescription::RD53* pRD53, bool doSparse, bool doDefault, bool pVerifLoop = false);
void InitRD53Aurora(Ph2_HwDescription::ReadoutChip* pChip, int nActiveLanes = 1);
......
......@@ -147,19 +147,18 @@
</BeBoard>
<Settings>
<!--
=== Calibration parameters ===
INJtype = 0: no injection; INJtype = 1: analog; INJtype = 2: digital
ResetMask = 0: do not reenable masked pixels; ResetMask = 1: enable all pixels
ResetTDAC = 0: do not reset TDAC; ResetTDAC = 1: reset TDAC to range midpoint
DoFast = 0: run on all pixels in the selected region; DoFast = 1: run on a subset
DisplayHisto = 0: don't display; DisplayHisto = 1: display
UpdateChipCfg = 0: don't update; UpdateChipCfg = 1: update
TargetCharge (thradj): average charge (electrons) corresponding to ToT point = max value - 1
TargetOcc (thrmin): average pixel occupancy
TargetOcc (pixelalive/noise): per pixel occupancy threhold below/above which pixels are masked
UnstuckPixels (pixelalive) = 0: do not try to unstuck pixels; UnstuckPixels = 1: set TDAC to 0 to unstuck pixels
<!-- === Calibration parameters ===
INJtype = 0: no injection; INJtype = 1: analog; INJtype = 2: digital
ResetMask = 0: do not enable masked pixels; ResetMask = 1: enable all pixels
ResetTDAC = 0: do not reset TDAC; ResetTDAC = 1: reset TDAC to range midpoint
DoFast = 0: run on all pixels in the selected region; DoFast = 1: run on a subset
DisplayHisto = 0: don't display; DisplayHisto = 1: display
UpdateChipCfg = 0: don't update; UpdateChipCfg = 1: update
TargetCharge (thradj): average charge (electrons) corresponding to ToT point = max value - 1
TargetOcc (thrmin): average pixel occupancy
TargetOcc (pixelalive/noise): per pixel occupancy threhold below/above which pixels are masked
UnstuckPixels (pixelalive) = 0: do not try to unstuck pixels; UnstuckPixels = 1: set TDAC to 0 to unstuck pixels
-->
<Setting name="nEvents"> 100 </Setting>
<Setting name="nEvtsBurst"> 100 </Setting>
......
......@@ -249,10 +249,11 @@ void GainOptimization::bitWiseScanGlobal(const std::string& regName, uint32_t nE
2;
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
midDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << RESET << BOLDMAGENTA << "] = " << RESET << BOLDYELLOW
......@@ -344,10 +345,11 @@ void GainOptimization::bitWiseScanGlobal(const std::string& regName, uint32_t nE
if(bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>() != 0)
{
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> Best " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << BOLDMAGENTA << "] = " << BOLDYELLOW
......
......@@ -251,10 +251,11 @@ void ThrAdjustment::bitWiseScanGlobal(const std::string& regName, uint32_t nEven
2;
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
midDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << RESET << BOLDMAGENTA << "] = " << RESET << BOLDYELLOW
......@@ -334,16 +335,18 @@ void ThrAdjustment::bitWiseScanGlobal(const std::string& regName, uint32_t nEven
if(bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>() != 0)
{
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
"VCAL_HIGH",
bestDACDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> Best " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << BOLDMAGENTA << "] = " << BOLDYELLOW
......@@ -426,10 +429,11 @@ std::shared_ptr<DetectorDataContainer> ThrAdjustment::bitWiseScanGlobal_MeasureT
2;
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
midDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << RESET << BOLDMAGENTA << "] = " << RESET << BOLDYELLOW
......
......@@ -330,10 +330,11 @@ void ThrEqualization::bitWiseScanGlobal(const std::string& regName, uint32_t nEv
2;
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
midDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << RESET << BOLDMAGENTA << "] = " << RESET << BOLDYELLOW
......@@ -415,10 +416,11 @@ void ThrEqualization::bitWiseScanGlobal(const std::string& regName, uint32_t nEv
if(bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>() != 0)
{
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> Best " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << BOLDMAGENTA << "] = " << BOLDYELLOW
......
......@@ -246,10 +246,11 @@ void ThrMinimization::bitWiseScanGlobal(const std::string& regName, uint32_t nEv
2;
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
midDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << RESET << BOLDMAGENTA << "] = " << RESET << BOLDYELLOW
......@@ -331,10 +332,11 @@ void ThrMinimization::bitWiseScanGlobal(const std::string& regName, uint32_t nEv
if(bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>() != 0)
{
static_cast<RD53Interface*>(this->fReadoutChipInterface)
->PackChipCommands(static_cast<RD53*>(cChip),
->PackChipCommands(cChip,
regName,
bestDACcontainer.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<uint16_t>(),
chipCommandList, true);
chipCommandList,
true);
LOG(INFO) << BOLDMAGENTA << ">>> Best " << BOLDYELLOW << regName << BOLDMAGENTA << " value for [board/opticalGroup/hybrid/chip = " << BOLDYELLOW << cBoard->getId() << "/"
<< cOpticalGroup->getId() << "/" << cHybrid->getId() << "/" << +cChip->getId() << BOLDMAGENTA << "] = " << BOLDYELLOW
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment