...
This commit is contained in:
parent
2dad248350
commit
e834f2c5d6
@ -537,6 +537,112 @@ void RaptorEagleCCD::writeRegisters(const byte_seq_t& addrs, const byte_seq_t& v
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* RESET HARDWARE */
|
||||||
|
|
||||||
|
bool RaptorEagleCCD::resetMicro(const std::chrono::milliseconds& timeout)
|
||||||
|
{
|
||||||
|
std::lock_guard lock_guard(_camlinkMutex);
|
||||||
|
|
||||||
|
byte_seq_t ack;
|
||||||
|
std::chrono::milliseconds sleep_dur = timeout.count() < 10 ? timeout : std::chrono::milliseconds(10);
|
||||||
|
|
||||||
|
uint8_t cksum_old = _clChecksumBit;
|
||||||
|
_clChecksumBit = 1; // to compute mandatory checksum in clWrite below!
|
||||||
|
|
||||||
|
clWrite({0x55, 0x99, 0x66, 0x11}); // no response here
|
||||||
|
|
||||||
|
_clChecksumBit = cksum_old; // restore
|
||||||
|
|
||||||
|
// according to instruction manual rev 1.1 microcontroller will take near 100msecs to reset
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
|
||||||
|
// poll controller
|
||||||
|
auto start = std::chrono::steady_clock::now();
|
||||||
|
do {
|
||||||
|
clWrite({0x4F, 0x51});
|
||||||
|
std::this_thread::sleep_for(sleep_dur);
|
||||||
|
clRead(ack);
|
||||||
|
|
||||||
|
if (ack[0] == CL_ETX)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} while ((std::chrono::steady_clock::now() - start) < timeout);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* HARDWARE INFO */
|
||||||
|
|
||||||
|
void RaptorEagleCCD::getHardwareInfo()
|
||||||
|
{
|
||||||
|
std::lock_guard lock_guard(_camlinkMutex);
|
||||||
|
|
||||||
|
static byte_seq_t bytes(20);
|
||||||
|
|
||||||
|
// first, according to instruction manual, set FPGA comms bit
|
||||||
|
setSystemStateBit(CL_SYSTEM_STATUS_FPGA_EEPROM_COMMS_BIT);
|
||||||
|
|
||||||
|
// get manufacturer data
|
||||||
|
clWrite({0x53, 0xAE, 0x05, 0x01, 0x00, 0x00, 0x02, 0x00});
|
||||||
|
clWrite({0x53, 0xAF, 0x12});
|
||||||
|
clReadAndCheckAck(bytes);
|
||||||
|
|
||||||
|
// NOTE: works only for little-endian platforms!!!
|
||||||
|
_cameraSerialNumber = *reinterpret_cast<uint16_t*>(bytes.data());
|
||||||
|
|
||||||
|
_buildDate = std::chrono::year_month_day(std::chrono::year(2000 + bytes[4]) / std::chrono::month(bytes[3]) /
|
||||||
|
std::chrono::day(bytes[2]));
|
||||||
|
|
||||||
|
_buildCode = std::string_view(reinterpret_cast<char*>(bytes.data() + 5), 5);
|
||||||
|
|
||||||
|
logDebug("------- Manufacturer data -------");
|
||||||
|
logDebug("Camerial serial number: {}", _cameraSerialNumber);
|
||||||
|
logDebug("Build date: {}", _buildDate);
|
||||||
|
logDebug("Build code: {}", _buildCode);
|
||||||
|
|
||||||
|
// ADC calibration data
|
||||||
|
double cnt1 = *reinterpret_cast<uint16_t*>(bytes.data() + 10); // at 0C
|
||||||
|
double cnt2 = *reinterpret_cast<uint16_t*>(bytes.data() + 12); // at +40C
|
||||||
|
|
||||||
|
logDebug("");
|
||||||
|
logDebug("ADC calib data {} counts at 0C", cnt1);
|
||||||
|
logDebug("ADC calib data {} counts at +40C", cnt2);
|
||||||
|
|
||||||
|
// compute linear relation: Temp = k*ADC + b
|
||||||
|
_adcCCDTempCalibCoeffs[0] = (cnt2 - cnt1) / (ADC_CALIBRATION_POINT_2 - ADC_CALIBRATION_POINT_1); // k
|
||||||
|
_adcCCDTempCalibCoeffs[1] = ADC_CALIBRATION_POINT_2 - _adcCCDTempCalibCoeffs[0] * cnt2;
|
||||||
|
|
||||||
|
// DAC calibration data
|
||||||
|
_dacTECSetPointCalibData[0] = *reinterpret_cast<uint16_t*>(bytes.data() + 14); // at 0C
|
||||||
|
_dacTECSetPointCalibData[1] = *reinterpret_cast<uint16_t*>(bytes.data() + 16); // at +40C
|
||||||
|
|
||||||
|
logDebug("");
|
||||||
|
logDebug("DAC calib data {} counts at 0C", _dacTECSetPointCalibData[0]);
|
||||||
|
logDebug("DAC calib data {} counts at +40C", _dacTECSetPointCalibData[1]);
|
||||||
|
logDebug("---------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void RaptorEagleCCD::getMicroVersion()
|
||||||
|
{
|
||||||
|
std::lock_guard lock_guard(_camlinkMutex);
|
||||||
|
|
||||||
|
clWrite({0x56});
|
||||||
|
clReadAndCheckAck(_microVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RaptorEagleCCD::getFPGAVersion()
|
||||||
|
{
|
||||||
|
std::lock_guard lock_guard(_camlinkMutex);
|
||||||
|
|
||||||
|
_FPGAVersion = readRegisters({0x7E, 0x7F});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* CREATE COMMANDS AND ATTRIBUTES */
|
/* CREATE COMMANDS AND ATTRIBUTES */
|
||||||
|
|
||||||
void RaptorEagleCCD::initAttrComm()
|
void RaptorEagleCCD::initAttrComm()
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public:
|
|||||||
static constexpr std::string_view CAMERA_ATTR_ROI_WIDTH{"ROI_WIDTH"};
|
static constexpr std::string_view CAMERA_ATTR_ROI_WIDTH{"ROI_WIDTH"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_ROI_HEIGHT{"ROI_HEIGHT"};
|
static constexpr std::string_view CAMERA_ATTR_ROI_HEIGHT{"ROI_HEIGHT"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_GAIN{"GAIN"};
|
static constexpr std::string_view CAMERA_ATTR_GAIN{"GAIN"};
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE{"TRIGGER_MODE"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_READ_RATE{"READ_RATE"};
|
static constexpr std::string_view CAMERA_ATTR_READ_RATE{"READ_RATE"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_READ_MODE{"READ_MODE"};
|
static constexpr std::string_view CAMERA_ATTR_READ_MODE{"READ_MODE"};
|
||||||
static constexpr std::string_view CAMERA_ATTR_TECPOINT{"TECPOINT"};
|
static constexpr std::string_view CAMERA_ATTR_TECPOINT{"TECPOINT"};
|
||||||
@ -76,6 +77,17 @@ public:
|
|||||||
static constexpr std::string_view CAMERA_ATTR_SHUTTER_STATE_EXP{"EXP"}; // open during acquisition
|
static constexpr std::string_view CAMERA_ATTR_SHUTTER_STATE_EXP{"EXP"}; // open during acquisition
|
||||||
static constexpr std::string_view CAMERA_ATTR_SHUTTER_STATE_INVALID{"INVALID"};
|
static constexpr std::string_view CAMERA_ATTR_SHUTTER_STATE_INVALID{"INVALID"};
|
||||||
|
|
||||||
|
// external trigger, rising edge enabled
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE_EXT_RISING{"EXTERNAL_RISING"};
|
||||||
|
// external trigger, falling edge enabled
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE_EXT_FALLING{"EXTERNAL_FALLING"};
|
||||||
|
// internal trigger for continuos acquisition
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE_ITR{"ITR"};
|
||||||
|
// fixed frame rate acquisition
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE_FFR{"FFR"};
|
||||||
|
// snapshot
|
||||||
|
static constexpr std::string_view CAMERA_ATTR_TRIGGER_MODE_SNAPSHOT{"SNAPSHOT"};
|
||||||
|
|
||||||
RaptorEagleCCD(const adc::traits::adc_input_char_range auto& epix_video_fmt_filename,
|
RaptorEagleCCD(const adc::traits::adc_input_char_range auto& epix_video_fmt_filename,
|
||||||
std::shared_ptr<spdlog::logger> logger = spdlog::null_logger_mt("EAGLE_CCD_NULLLOGGER"));
|
std::shared_ptr<spdlog::logger> logger = spdlog::null_logger_mt("EAGLE_CCD_NULLLOGGER"));
|
||||||
|
|
||||||
@ -93,11 +105,10 @@ private:
|
|||||||
uint16_t _dimCCD[2] = {2048, 2048}; // init to E2V 4240 CCD dimension
|
uint16_t _dimCCD[2] = {2048, 2048}; // init to E2V 4240 CCD dimension
|
||||||
|
|
||||||
// CCD temperature and TEC set point calibration data
|
// CCD temperature and TEC set point calibration data
|
||||||
uint16_t _adcCCDTempCalibData[2] = {0, 0}; // [at 0C, at +40C]
|
// uint16_t _adcCCDTempCalibData[2] = {0, 0}; // [at 0C, at +40C]
|
||||||
double _adcCCDTempCalibCoeffs[2] = {0, 0}; // [k, b], Temp(degs C) = k*ADC + b
|
double _adcCCDTempCalibCoeffs[2] = {0, 0}; // [k, b], Temp(degs C) = k*ADC + b
|
||||||
|
|
||||||
uint16_t _dacTECSetPointCalibData[2] = {0, 0}; // [at 0C, at +40C]
|
double _dacTECSetPointCalibData[2] = {0, 0}; // [at 0C, at +40C]
|
||||||
double _dacTECSetPointCalibCoeffs[2] = {0, 0}; // [k, b], Temp(degs C) = k*DAC + b
|
|
||||||
|
|
||||||
// CameraLink read/write setup flags
|
// CameraLink read/write setup flags
|
||||||
uint8_t _clCommandAckBit;
|
uint8_t _clCommandAckBit;
|
||||||
@ -108,6 +119,15 @@ private:
|
|||||||
// attributes inner variables
|
// attributes inner variables
|
||||||
size_t _frameNumbers;
|
size_t _frameNumbers;
|
||||||
|
|
||||||
|
|
||||||
|
// hardware version info
|
||||||
|
byte_seq_t _microVersion; // microcontroller version: _microVersion[0] - major, _microVersion[1] - minor
|
||||||
|
byte_seq_t _FPGAVersion; // same for FPGA version
|
||||||
|
|
||||||
|
uint16_t _cameraSerialNumber = 0; // camera serial number
|
||||||
|
std::chrono::year_month_day _buildDate;
|
||||||
|
std::string_view _buildCode;
|
||||||
|
|
||||||
void initAttrComm();
|
void initAttrComm();
|
||||||
|
|
||||||
void initCamera(int unitmap = 1);
|
void initCamera(int unitmap = 1);
|
||||||
@ -151,6 +171,18 @@ private:
|
|||||||
void flipFPGAStateBit(const size_t bit_pos);
|
void flipFPGAStateBit(const size_t bit_pos);
|
||||||
|
|
||||||
|
|
||||||
|
// reset hardware methods
|
||||||
|
|
||||||
|
// returns true if OK, false - timeout
|
||||||
|
bool resetMicro(const std::chrono::milliseconds& timeout = std::chrono::milliseconds(5000));
|
||||||
|
|
||||||
|
|
||||||
|
// hardware info methods
|
||||||
|
|
||||||
|
void getHardwareInfo();
|
||||||
|
void getMicroVersion();
|
||||||
|
void getFPGAVersion();
|
||||||
|
|
||||||
// logging helper methods
|
// logging helper methods
|
||||||
|
|
||||||
template <bool NOEXCEPT = false>
|
template <bool NOEXCEPT = false>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user