Commit 0924336f authored by Module Testing's avatar Module Testing
Browse files

Merge branch 'cmsinnertracker/Ph2_ACF-master' into chipContainer

parents b09dff07 75a5fab3
......@@ -16,7 +16,7 @@ void GainOptimizationHistograms::book(TFile* theOutputFile, const DetectorContai
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
uint16_t rangeKrumCurr = RD53Shared::setBits(static_cast<RD53*>(theDetectorStructure.at(0)->at(0)->at(0)->at(0))->getNumberOfBits("KRUM_CURR_LIN")) + 1;
const uint16_t rangeKrumCurr = RD53Shared::setBits(static_cast<RD53*>(theDetectorStructure.at(0)->at(0)->at(0)->at(0))->getNumberOfBits("KRUM_CURR_LIN")) + 1;
auto hKrumCurr = CanvasContainer<TH1F>("KrumCurr", "KrumCurr", rangeKrumCurr, 0, rangeKrumCurr);
bookImplementer(theOutputFile, theDetectorStructure, KrumCurr, hKrumCurr, "Krummenacher Current", "Entries");
......
......@@ -15,9 +15,9 @@ void PhysicsHistograms::book(TFile* theOutputFile, const DetectorContainer& theD
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
size_t ToTsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TOT / RD53Constants::NPIX_REGION) + 1;
size_t BCIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_BCID) + 1;
size_t TrgIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TRIGID) + 1;
const size_t ToTsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TOT / RD53Constants::NPIX_REGION) + 1;
const size_t BCIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_BCID) + 1;
const size_t TrgIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TRIGID) + 1;
auto hToT1D = CanvasContainer<TH1F>("ToT1D", "ToT Distribution", ToTsize, 0, ToTsize);
bookImplementer(theOutputFile, theDetectorStructure, ToT1D, hToT1D, "ToT", "Entries");
......
......@@ -16,12 +16,16 @@ void PixelAliveHistograms::book(TFile* theOutputFile, const DetectorContainer& t
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
size_t ToTsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TOT / RD53Constants::NPIX_REGION) + 1;
size_t BCIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_BCID) + 1;
size_t TrgIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TRIGID) + 1;
// #######################
// # Retrieve parameters #
// #######################
nEvents = this->findValueInSettings(settingsMap, "nEvents");
const size_t ToTsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TOT / RD53Constants::NPIX_REGION) + 1;
const size_t BCIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_BCID) + 1;
const size_t TrgIDsize = RD53Shared::setBits(RD53EvtEncoder::NBIT_TRIGID) + 1;
auto hOcc1D = CanvasContainer<TH1F>("Occ1D", "Occ1D", 200 + 1, 0, 1 + 1. / 200);
bookImplementer(theOutputFile, theDetectorStructure, Occupancy1D, hOcc1D, "Number of hits", "Entries");
auto hOcc1D = CanvasContainer<TH1F>("Occ1D", "Occ1D", nEvents + 1, 0, 1 + 1. / nEvents);
bookImplementer(theOutputFile, theDetectorStructure, Occupancy1D, hOcc1D, "Efficiency", "Entries");
auto hOcc2D = CanvasContainer<TH2F>("PixelAlive", "Pixel Alive", RD53::nCols, 0, RD53::nCols, RD53::nRows, 0, RD53::nRows);
bookImplementer(theOutputFile, theDetectorStructure, Occupancy2D, hOcc2D, "Columns", "Rows");
......@@ -93,9 +97,9 @@ void PixelAliveHistograms::fill(const DetectorDataContainer& DataContainer)
for(auto row = 0u; row < RD53::nRows; row++)
for(auto col = 0u; col < RD53::nCols; col++)
{
if(cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy != 0)
if(cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy != RD53Shared::ISDISABLED)
{
Occupancy1DHist->Fill(cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy);
Occupancy1DHist->Fill(cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy + Occupancy1DHist->GetBinWidth(0) / 2);
Occupancy2DHist->SetBinContent(col + 1, row + 1, cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy);
ToTHist->Fill(cChip->getChannel<OccupancyAndPh>(row, col).fPh);
}
......
......@@ -40,6 +40,8 @@ class PixelAliveHistograms : public DQMHistogramBase
DetectorDataContainer ToT;
DetectorDataContainer BCID;
DetectorDataContainer TriggerID;
size_t nEvents;
};
#endif
......@@ -25,7 +25,7 @@ void SCurveHistograms::book(TFile* theOutputFile, const DetectorContainer& theDe
stopValue = this->findValueInSettings(settingsMap, "VCalHstop");
offset = this->findValueInSettings(settingsMap, "VCalMED");
auto hOcc2D = CanvasContainer<TH2F>("SCurves", "SCurves", nSteps, startValue - offset, stopValue - offset, nEvents + 1, 0, 1 + 1. / nEvents);
auto hOcc2D = CanvasContainer<TH2F>("SCurves", "SCurves", nSteps, startValue - offset, stopValue - offset, 2 * nEvents + 1, 0, 2 + 1. / nEvents);
bookImplementer(theOutputFile, theDetectorStructure, Occupancy2D, hOcc2D, "#DeltaVCal", "Efficiency");
auto hErrorReadOut2D = CanvasContainer<TH2F>("ReadoutErrors", "Readout Errors", RD53::nCols, 0, RD53::nCols, RD53::nRows, 0, RD53::nRows);
......@@ -90,6 +90,8 @@ void SCurveHistograms::fillOccupancy(const DetectorDataContainer& OccupancyConta
hOcc2D->Fill(DELTA_VCAL, cChip->getChannel<OccupancyAndPh>(row, col).fOccupancy + hOcc2D->GetYaxis()->GetBinWidth(0) / 2.);
if(cChip->getChannel<OccupancyAndPh>(row, col).readoutError == true) ErrorReadOut2DHist->Fill(col + 1, row + 1);
}
hOcc2D->GetYaxis()->SetRangeUser(0, 1 + 1. / nEvents);
}
}
......
......@@ -19,10 +19,14 @@ void ThrEqualizationHistograms::book(TFile* theOutputFile, const DetectorContain
// #######################
// # Retrieve parameters #
// #######################
nEvents = this->findValueInSettings(settingsMap, "nEvents");
nEvents = this->findValueInSettings(settingsMap, "nEvents");
size_t TDACsize = RD53Shared::setBits(RD53Constants::NBIT_TDAC) + 1;
const size_t colStart = this->findValueInSettings(settingsMap, "COLstart");
const size_t colStop = this->findValueInSettings(settingsMap, "COLstop");
frontEnd = RD53::getMajorityFE(colStart, colStop);
if(frontEnd == &RD53::DIFF) TDACsize *= 2;
auto hThrEqualization = CanvasContainer<TH1F>("ThrEqualization", "ThrEqualization", nEvents + 1, 0, 1 + 1. / nEvents);
bookImplementer(theOutputFile, theDetectorStructure, ThrEqualization, hThrEqualization, "Efficiency", "Entries");
......@@ -75,6 +79,7 @@ void ThrEqualizationHistograms::fillOccupancy(const DetectorDataContainer& Occup
void ThrEqualizationHistograms::fillTDAC(const DetectorDataContainer& TDACContainer)
{
size_t TDACsize = RD53Shared::setBits(RD53Constants::NBIT_TDAC) + 1;
if(frontEnd == &RD53::DIFF) TDACsize *= 2;
for(const auto cBoard: TDACContainer)
for(const auto cOpticalGroup: *cBoard)
......
......@@ -39,6 +39,8 @@ class ThrEqualizationHistograms : public DQMHistogramBase
size_t nEvents;
size_t VCalHnsteps;
const Ph2_HwDescription::RD53::FrontEnd* frontEnd;
};
#endif
......@@ -16,7 +16,7 @@ void ThresholdHistograms::book(TFile* theOutputFile, const DetectorContainer& th
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
uint16_t rangeThreshold = RD53Shared::setBits(static_cast<RD53*>(theDetectorStructure.at(0)->at(0)->at(0)->at(0))->getNumberOfBits("Vthreshold_LIN")) + 1;
const uint16_t rangeThreshold = RD53Shared::setBits(static_cast<RD53*>(theDetectorStructure.at(0)->at(0)->at(0)->at(0))->getNumberOfBits("Vthreshold_LIN")) + 1;
auto hThrehsold = CanvasContainer<TH1F>("Threhsold", "Threhsold", rangeThreshold, 0, rangeThreshold);
bookImplementer(theOutputFile, theDetectorStructure, Threhsold, hThrehsold, "Threhsold", "Entries");
......
......@@ -22,18 +22,20 @@ namespace Ph2_HwDescription
{
// C'tors which take BeId, FMCId, FeID, MPAId
MPA::MPA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pMPAId, const std::string& filename) : ReadoutChip(pBeId, pFMCId, pFeId, pMPAId)
MPA::MPA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pMPAId, uint8_t pPartnerId, const std::string& filename) : ReadoutChip(pBeId, pFMCId, pFeId, pMPAId)
{
fMaxRegValue = 255;
fChipOriginalMask = new ChannelGroup<1920>;
fPartnerId = pPartnerId;
loadfRegMap(filename);
setFrontEndType(FrontEndType::MPA);
}
MPA::MPA(const FrontEndDescription& pFeDesc, uint8_t pMPAId, const std::string& filename) : ReadoutChip(pFeDesc, pMPAId)
MPA::MPA(const FrontEndDescription& pFeDesc, uint8_t pMPAId, uint8_t pPartnerId, const std::string& filename) : ReadoutChip(pFeDesc, pMPAId)
{
fMaxRegValue = 255; // 8 bit registers in MPA
fChipOriginalMask = new ChannelGroup<1920>;
fPartnerId = pPartnerId;
loadfRegMap(filename);
setFrontEndType(FrontEndType::MPA);
}
......
......@@ -36,14 +36,15 @@ using CommentMap = std::map<int, std::string>;
class MPA : public ReadoutChip
{
public:
MPA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pMPAId, const std::string& filename);
MPA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pMPAId, uint8_t pPartnerId, const std::string& filename);
// C'tors with object FE Description
MPA(const FrontEndDescription& pFeDesc, uint8_t pMPAId, const std::string& filename);
MPA(const FrontEndDescription& pFeDesc, uint8_t pMPAId, uint8_t pPartnerId, const std::string& filename);
using MPARegPair = std::pair<std::string, ChipRegItem>;
void loadfRegMap(const std::string& filename) override;
void saveRegMap(const std::string& filename) override;
uint8_t fPartnerId;
uint8_t getPartid() { return fPartnerId; }
void loadfRegMap(const std::string& filename) override;
void saveRegMap(const std::string& filename) override;
bool isDACLocal(const std::string& dacName) override
{
......@@ -60,11 +61,13 @@ class MPA : public ReadoutChip
return 8;
}
std::pair<uint32_t, uint32_t> PNlocal(const uint32_t PN) { return std::pair<uint32_t, uint32_t>(PN / 120, PN % 120); }
// row, col starts at index 0, global pix number starts at number 1
std::pair<uint32_t, uint32_t> PNlocal(const uint32_t PN) { return std::pair<uint32_t, uint32_t>((PN + 1) / 120, ((PN + 1) % 120) - 2); }
uint32_t getNumberOfChannels() const override { return NMPACHANNELS; }
uint32_t PNglobal(std::pair<uint32_t, uint32_t> PC) { return PC.first * 120 + PC.second; }
uint32_t PNglobal(std::pair<uint32_t, uint32_t> PC) { return (PC.first) * 120 + (PC.second) + 1; }
};
struct MPARegItemComparer
......
......@@ -242,7 +242,7 @@ void RD53::saveRegMap(const std::string& fName2Add)
{
const int Nspaces = 26;
std::string output = RD53Shared::composeFileName(configFileName, fName2Add);
std::string output = RD53::getFileName(fName2Add);
std::ofstream file(output.c_str(), std::ios::out | std::ios::trunc);
if(file)
......@@ -380,6 +380,11 @@ void RD53::injectPixel(unsigned int row, unsigned int col, bool inject) { fPixel
void RD53::setTDAC(unsigned int row, unsigned int col, uint8_t TDAC) { fPixelsMask[col].TDAC[row] = TDAC; }
void RD53::resetTDAC()
{
for(auto col = 0u; col < fPixelsMask.size(); col++) fPixelsMask[col].TDAC.fill(RD53Shared::setBits(RD53Constants::NBIT_TDAC) / 2);
}
uint8_t RD53::getTDAC(unsigned int row, unsigned int col) { return fPixelsMask[col].TDAC[row]; }
uint32_t RD53::getNumberOfChannels() const { return nRows * nCols; }
......
......@@ -29,16 +29,19 @@
// #########################
namespace RD53Constants
{
const uint8_t BROADCAST_CHIPID = 0x8; // Broadcast chip ID used to send the command to multiple chips
const uint8_t NREGIONS_LONGCMD = 6; // Number of regions to program with long write commands
const uint8_t FIELDS_SHORTCMD = 8; // Number of fields for the short write command
const uint8_t FIELDS_LONGCMD = 24; // Number of fields for the long write command
const uint8_t NBIT_TDAC = 4; // Number of TDAC bits
const uint8_t NBIT_MAXREG = 16; // Maximum number of bits for a chip register
const uint8_t NPIX_REGION = 4; // Number of pixels in a region (1x4)
const uint8_t NROW_CORE = 8; // Number of rows in a core
const uint8_t NBIT_ADDR = 9; // Number of address bits
const uint8_t NSYNC_WORS = 32; // Number of Sync words for synchronization
const uint8_t BROADCAST_CHIPID = 0x8; // Broadcast chip ID used to send the command to multiple chips
const uint8_t NREGIONS_LONGCMD = 6; // Number of regions to program with long write commands
const uint8_t FIELDS_SHORTCMD = 8; // Number of fields for the short write command
const uint8_t FIELDS_LONGCMD = 24; // Number of fields for the long write command
const uint8_t NBIT_TDAC = 4; // Number of TDAC bits
const uint8_t NBIT_MAXREG = 16; // Maximum number of bits for a chip register
const uint8_t NPIX_REGION = 4; // Number of pixels in a region (1x4)
const uint8_t NROW_CORE = 8; // Number of rows in a core
const uint8_t NBIT_ADDR = 9; // Number of address bits
const uint8_t NSYNC_WORS = 32; // Number of Sync words for synchronization
const uint8_t CDRCONFIG_ADDR = 0x40; // Address of CDR_CONFIG register
const uint16_t CDRCONFIG_1Gbit = 1048; // Value for 1.28 Gbit/s
const uint16_t CDRCONFIG_640Mbit = 1049; // Value for 640 Mbit/s
} // namespace RD53Constants
// ############
......@@ -153,6 +156,7 @@ class RD53 : public ReadoutChip
void enablePixel(unsigned int row, unsigned int col, bool enable);
void injectPixel(unsigned int row, unsigned int col, bool inject);
void setTDAC(unsigned int row, unsigned int col, uint8_t TDAC);
void resetTDAC();
uint8_t getTDAC(unsigned int row, unsigned int col);
uint8_t getChipLane() const { return myChipLane; }
......
......@@ -22,18 +22,20 @@
namespace Ph2_HwDescription
{ // open namespace
SSA::SSA(const FrontEndDescription& pFeDesc, uint8_t pSSAId, uint8_t pSSASide, const std::string& filename) : ReadoutChip(pFeDesc, pSSAId)
SSA::SSA(const FrontEndDescription& pFeDesc, uint8_t pSSAId, uint8_t pPartnerId, uint8_t pSSASide, const std::string& filename) : ReadoutChip(pFeDesc, pSSAId)
{
fMaxRegValue = 255; // 8 bit registers in CBC
fChipOriginalMask = new ChannelGroup<120>;
fPartnerId = pPartnerId;
loadfRegMap(filename);
setFrontEndType(FrontEndType::SSA);
}
SSA::SSA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pSSAId, uint8_t pSSASide, const std::string& filename) : ReadoutChip(pBeId, pFMCId, pFeId, pSSAId)
SSA::SSA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pSSAId, uint8_t pPartnerId, uint8_t pSSASide, const std::string& filename) : ReadoutChip(pBeId, pFMCId, pFeId, pSSAId)
{
fMaxRegValue = 255; // 8 bit registers in CBC
fChipOriginalMask = new ChannelGroup<120>;
fPartnerId = pPartnerId;
loadfRegMap(filename);
setFrontEndType(FrontEndType::SSA);
}
......
......@@ -35,10 +35,11 @@ class SSA : public ReadoutChip
{ // open class def
public:
// C'tors which take BeId, FMCId, FeID, SSAId
SSA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pSSAId, uint8_t pSSASide, const std::string& filename);
SSA(uint8_t pBeId, uint8_t pFMCId, uint8_t pFeId, uint8_t pSSAId, uint8_t pPartnerId, uint8_t pSSASide, const std::string& filename);
// C'tors with object FE Description
SSA(const FrontEndDescription& pFeDesc, uint8_t pSSAId, uint8_t pSSASide, const std::string& filename);
SSA(const FrontEndDescription& pFeDesc, uint8_t pSSAId, uint8_t pPartnerId, uint8_t pSSASide, const std::string& filename);
uint8_t fPartnerId;
uint8_t getPartid() { return fPartnerId; }
virtual void accept(HwDescriptionVisitor& pVisitor) { pVisitor.visitChip(*this); }
void loadfRegMap(const std::string& filename) override;
void saveRegMap(const std::string& filename) override;
......
......@@ -3700,6 +3700,141 @@ void D19cFWInterface::PSInterfaceBoard_PowerOn_MPA(float VDDPST, float DVDD, flo
PSInterfaceBoard_ConfigureI2CMaster(0, SLOW);
}
void D19cFWInterface::PSInterfaceBoard_PowerOn_MPASSA(float VDDPST, float DVDD, float AVDD, float VBG, float VBF, uint8_t mpaid, uint8_t ssaid)
{
this->getBoardInfo();
this->PSInterfaceBoard_PowerOn(0, 0);
uint32_t write = 0;
uint32_t SLOW = 2;
uint32_t i2cmux = 0;
uint32_t pcf8574 = 1;
uint32_t dac7678 = 4;
std::this_thread::sleep_for(std::chrono::milliseconds(750));
PSInterfaceBoard_SetSlaveMap();
PSInterfaceBoard_ConfigureI2CMaster(1, SLOW);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
float Vc = 0.0003632813;
LOG(INFO) << "mpa vdd on";
float Vlimit = 1.32;
if(VDDPST > Vlimit) VDDPST = Vlimit;
float diffvoltage = 1.5 - VDDPST;
uint32_t setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x34, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "ssa vdd on";
Vlimit = 1.32;
if(VDDPST > Vlimit) VDDPST = Vlimit;
diffvoltage = 1.5 - VDDPST;
setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x33, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "mpa vddD on";
Vlimit = 1.2;
if(DVDD > Vlimit) DVDD = Vlimit;
diffvoltage = 1.5 - DVDD;
setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x30, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "ssa vddD on";
Vlimit = 1.32;
if(DVDD > Vlimit) DVDD = Vlimit;
diffvoltage = 1.5 - DVDD;
setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x31, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "mpa vddA on";
Vlimit = 1.32;
if(AVDD > Vlimit) AVDD = Vlimit;
diffvoltage = 1.5 - AVDD;
setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x32, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "ssa vddA on";
Vlimit = 1.32;
if(AVDD > Vlimit) AVDD = Vlimit;
diffvoltage = 1.5 - AVDD;
setvoltage = int(round(diffvoltage / Vc));
if(setvoltage > 4095) setvoltage = 4095;
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x35, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG(INFO) << "mpa VBG on";
Vlimit = 0.5;
if(VBG > Vlimit) VBG = Vlimit;
float Vc2 = 4095 / 1.5;
setvoltage = int(round(VBG * Vc2));
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x36, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
/*LOG(INFO) << "ssa VBG on";
Vlimit = 1.32;
if(VBG > Vlimit) VBG = Vlimit;
Vc2 = 4095 / 1.5;
setvoltage = int(round(VBG * Vc2));
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x36, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(1000));*/
LOG(INFO) << "ssa VBF on";
Vlimit = 0.5;
if(VBF > Vlimit) VBF = Vlimit;
setvoltage = int(round(VBF * Vc2));
setvoltage = setvoltage << 4;
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x01); // to SCO on PCA9646
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
PSInterfaceBoard_SendI2CCommand(dac7678, 0, write, 0x37, setvoltage); // tx to DAC C
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x02);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
PSInterfaceBoard_SendI2CCommand(pcf8574, 0, write, 0, 145); // set reset bit
/*LOG(INFO) << "mpa enable";
//uint32_t val2 = (mpaid << 5) + 16;
uint32_t val2 = (mpaid << 5) + (ssaid << 1) + 1; // reset bit for MPA
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x02); // route to 2nd PCF8574
std::this_thread::sleep_for(std::chrono::milliseconds(500));
PSInterfaceBoard_SendI2CCommand(pcf8574, 0, write, 0, val2); // set reset bit
std::this_thread::sleep_for(std::chrono::milliseconds(1000));*/
// disable the i2c master at the end (first set the mux to the chip
PSInterfaceBoard_SendI2CCommand(i2cmux, 0, write, 0, 0x04);
PSInterfaceBoard_ConfigureI2CMaster(0, SLOW);
}
void D19cFWInterface::PSInterfaceBoard_PowerOff_SSA(uint8_t mpaid, uint8_t ssaid)
{
uint32_t write = 0;
......
......@@ -655,6 +655,7 @@ class D19cFWInterface : public BeBoardFWInterface
void PSInterfaceBoard_PowerOn(uint8_t mpaid = 0, uint8_t ssaid = 0);
void PSInterfaceBoard_PowerOff();
void PSInterfaceBoard_PowerOn_MPASSA(float VDDPST = 1.25, float DVDD = 1.2, float AVDD = 1.25, float VBG = 0.3, float VBF = 0.3, uint8_t mpaid = 0, uint8_t ssaid = 0);
// MPA power on
void PSInterfaceBoard_PowerOn_MPA(float VDDPST = 1.25, float DVDD = 1.2, float AVDD = 1.25, float VBG = 0.3, uint8_t mpaid = 0, uint8_t ssaid = 0);
void PSInterfaceBoard_PowerOff_MPA(uint8_t mpaid = 0, uint8_t ssaid = 0);
......
......@@ -22,7 +22,7 @@ bool D19clpGBTInterface::ConfigureChip(Ph2_HwDescription::Chip* pChip, bool pVer
{
LOG(INFO) << BOLDBLUE << "Configuring lpGBT" << RESET;
setBoard(pChip->getBeBoardId());
//Load register map from configuration file
// Load register map from configuration file
ChipRegMap clpGBTRegMap = pChip->getRegMap();
for(const auto& cRegItem: clpGBTRegMap)
{
......
......@@ -127,8 +127,9 @@ bool MPAInterface::WriteChipAllLocalReg(ReadoutChip* pMPA, const std::string& da
assert(localRegValues.size() == pMPA->getNumberOfChannels());
std::string dacTemplate;
if(dacName == "TrimDAC_P") dacTemplate = "TrimDAC_P%d";
if(dacName == "ThresholdTrim")
if(dacName == "TrimDAC_P")
dacTemplate = "TrimDAC_P%d";
else if(dacName == "ThresholdTrim")
dacTemplate = "TrimDAC_P%d";
else
LOG(ERROR) << "Error, DAC " << dacName << " is not a Local DAC";
......@@ -164,10 +165,12 @@ bool MPAInterface::ConfigureChip(Chip* pMPA, bool pVerifLoop, uint32_t pBlockSiz
#endif
// LOG (INFO) << BOLDRED << "Write "<<cRegItem.first<< RESET;
fBoardFW->EncodeReg(cRegItem.second, pMPA->getHybridId(), pMPA->getId(), cVec, pVerifLoop, true);
bool cSuccess = fBoardFW->WriteChipBlockReg(cVec, cWriteAttempts, pVerifLoop);
if(cSuccess)
{
auto cReadBack = ReadChipReg(pMPA, cRegItem.first);
// LOG(INFO) << BOLDRED << cRegItem.first<<" "<<cReadBack<<","<<cRegItem.second.fValue << RESET;
if(cReadBack != cRegItem.second.fValue)
{
std::size_t found = (cRegItem.first).find("ReadCounter");
......@@ -367,7 +370,7 @@ void MPAInterface::Activate_pp(Chip* pMPA) { this->WriteChipReg(pMPA, "ECM", 0x8
void MPAInterface::Activate_ss(Chip* pMPA) { this->WriteChipReg(pMPA, "ECM", 0x41); }
void MPAInterface::Activate_ps(Chip* pMPA) { this->WriteChipReg(pMPA, "ECM", 0x8); }
void MPAInterface::Activate_ps(Chip* pMPA, uint8_t win) { this->WriteChipReg(pMPA, "ECM", win); }
void MPAInterface::Pix_Smode(ReadoutChip* pMPA, uint32_t p, std::string smode = "edge")
{
......
......@@ -78,7 +78,7 @@ class MPAInterface : public ReadoutChipInterface
void Activate_sync(Ph2_HwDescription::Chip* pMPA);
void Activate_pp(Ph2_HwDescription::Chip* pMPA);
void Activate_ss(Ph2_HwDescription::Chip* pMPA);
void Activate_ps(Ph2_HwDescription::Chip* pMPA);
void Activate_ps(Ph2_HwDescription::Chip* pMPA, uint8_t win = 8);
void Enable_pix_counter(Ph2_HwDescription::ReadoutChip* pMPA, uint32_t p);
void Enable_pix_sync(Ph2_HwDescription::ReadoutChip* pMPA, uint32_t p);
......
This diff is collapsed.
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