Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

[bugfix] SCA readout update #157

Merged

Conversation

jsturdy
Copy link
Contributor

@jsturdy jsturdy commented Oct 23, 2019

Description

Several issues were present with the SCA readout:

  • The changes to the .ADC_MONITORING.MONITORING_OFF register had not been forward propagated
    • Added a new function in utils bool regExists(localArgs * la, const std::string & regName, lmdb::val * db_res) that is called in all the read/write functions in place of the register name lookup, as this allows other code to check whether the register exists in the LMDB, even if they don't need to create a valid lmdb::val object
  • The output data format was not tested for 12 OptoHybrids, and was truncating

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Motivation and Context

Needed to reliably monitor the sensors from the SCA

How Has This Been Tested?

Problem discovered and tested at P5

Copy link
Contributor

@lpetre-ulb lpetre-ulb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bugs seem to be addressed. The comments only concern future PR's and/or the migration to the templated RPC modules.

@@ -212,7 +212,7 @@ class SCASettings {
enum EADCChannel { //ADCChannel settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not technically part of this PR, but is there a specific reason why you preferred enum's in struct's instead of scope enumerations in this file? Using strongly-typed aliases would help preventing bugs and would allow using functions overloads (e.g. replace all sca*Command with a single overloaded scaCommand).

Also not part of this PR, the GE1/1 aliases should be updated to reflect the latest OptoHybrid changes .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had used the struct { enum} because there is code in cmsgemos using the same, and it was foreseen that these headers are part of the files that can be included there.
I fully expect that very shortly these will be replaced with the strongly typed enum class syntax, as we're moving to a (more) modern compiler :-)

@@ -148,14 +148,23 @@ uint32_t getNumNonzeroBits(uint32_t value)
return numNonzeroBits;
}

uint32_t getMask(localArgs * la, const std::string & regName)
bool regExists(localArgs * la, const std::string & regName, lmdb::val * db_res)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good to have this elementary functionality shared. As as note, the DAC scans will also have to be adapted at some point in order to avoid using low-level LMDB access throughout the code.

* bits [26:24]: link ID
* bits [31:29]: constant 0's
* bit [28] : data present
* bits [27:24]: link ID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering how many OHs will be supported by the foreseen ATCA board? I imagine that it will be more than 16. As a bugfix for the legacy modules, the change it certainly more than enough, but the format should probably be improved when moving to the templated RPC modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, this format should be adapted for an expected future system before it gets into the production stream (templated RPCs)

Comment on lines +21 to +24
// FIXME: DECIDE WHETHER TO HAVE HERE // if (regExists(la, "GEM_AMC.SLOW_CONTROL.SCA.ADC_MONITORING.MONITORING_OFF")) {
// FIXME: DECIDE WHETHER TO HAVE HERE // writeReg(la,"GEM_AMC.SLOW_CONTROL.SCA.ADC_MONITORING.MONITORING_OFF", 0xffffffff);
// FIXME: DECIDE WHETHER TO HAVE HERE // }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all calls to sendSCACommand need to be protected against the ADC monitoring code, wouldn't it better to directly move the protection here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this was my initial proposal as well, but don't remember the reason for not implementing it.
In principle, it can also be removed at some point... but yeah... another time, another PR :-)

@mexanick mexanick merged commit c80e012 into cms-gem-daq-project:release/v1.1.X Oct 31, 2019
@jsturdy jsturdy deleted the hotfix/sca-readout-update branch November 4, 2019 15:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants