'''[wiki:GraspSwControllerCmd clvset]''' [[TracNav(GraspContents)]] ||Command:||'''clvset'''|| ||Contexts:||Network socket, serial console, stage2 only|| ||Function:||Set up clocking parameters and ADC configuration for next readout|| ||Required Parameters:||none.|| ||Optional Parameters:|| || ||'''dev='''||[current] Select dev '''0''' '''1''' or '''all'''|| ||'''id='''||[0] (>=r5775) set up to 6 clocking patterns in controller memory at once|| ||'''pg3='''||8 sets of four hex digits to configure serial (row/horizontal) clocking|| ||'''pg4='''||8 sets of four hex digits to configure serial RESET, SUMMING WELL, (CCDs), VCLAMP, and ADCTRIG|| ||'''ppg4='''||8 sets of four hex digits to configure parallel (vertical) clocking|| ||'''adc='''||1 set of four hex digits plus an optional nibble to configure ADC operation|| ||'''math='''||Sequence of math processing operation codes to match adc=|| ||'''mathcal='''||Sequence resulting in separate 16 bit "pedestal" and "video" for "[wiki:GraspSwControllerCmdReadcal readcal]"|| ||'''trig='''||Number of NOPs (10 nsec delay steps) to insert after each crosstrigger sync|| ||'''pipeline='''||Number of pipeline pixels resulting from clocking pattern (usually 1)|| ||'''prescan='''||Number of device serial prescan pixels to skip (clocked, but not sampled)|| ||'''prebias='''||Extra overscan pixels to be read '''after''' xtrig (usually 0)|| === Example === The following is a complete command to configure a typical "4+1" CCD clocking pattern on both clocking engines. It takes 4 samples of the pedestal level, plus 1 skipped for pipeline purposes, and then 4 samples of the video level, plus 1 skipped for pipeline purposes. {{{ clvset dev=all ppg4=ecbb:cbb2:bb2e:65d8:5d97:38ba:6622:3154 \ pg3=340e:40e0:1c03:c070:06c1:0417:649b:0136 \ pg4=1038:8010:0104:00b0:07c2:0000:3732:08a2 \ adc=1500:1 math=333301111A mathcal=1111A1111A }}} The command must be sent all on one line (or as multiple "clvset dev=all ..." commands - see section below.) === Parameter id= === This is a numeric parameter with a valid range of [0-5] inclusive. Only builds >= r5774 support this. This can be used to set up different speed clocking (parallel and serial) for different purposes. Eventually, other commands will support the id= parameter as well. This way one can quickly call up a previous clocking pattern without having to send all the other parameters each time. For now (as of r5775) the following IDs are hardcoded for the following uses: ||'''id=0'''||Science readout|| ||'''id=1'''||Video (e.g. guide cell) readout|| ||'''id=2'''||[wiki:GraspSwControllerCmdOt OT or charge shuffling] parallel shift operations|| Note that build r5774 also supported the id feature, but builds < r5775 had a command line length limit of 256 bytes (increased to 2048 in r5775, with overflow detection.) The clvset commands, in particular, can become quite long because of the number of parameters. However, as long as the proper dev= and id= are always given, one can split the other parameters into as many lines/commands as desired. === Parameter adc= === The first, four-digit hex part of the adc= parameter is formed by or-ing several values together: {{{ I | (C << 8) | (N << 10) }}} Where I (the lower 8 bits) specifies extra inter-sample delay time (usually left at 00), C is the number of channels (1 2 or 3) and N is the number of multiple samples to read each time ADCTRIG changes (goes high or low.) The default behavior of the adc= parameter in single-sampled mode is to read only the "Red" ADC channel. All digits in the adc= parameter are in hex. The option last nibble after the colon allows one to select other ADC channels. It is a bit mask. ||adc=1500||4+1 RED|| ||adc=1500:1||4+1 RED|| ||adc=1500:2||4+1 GREEN|| ||adc=1500:4||4+1 BLUE|| For two-channel mode, the following combinations are valid: ||adc=1600||4+1 RED,GREEN|| ||adc=1600:3||4+1 RED,GREEN|| ||adc=1600:5||4+1 RED,BLUE|| ||adc=1600:6||4+1 GREEN,BLUE|| For three-channel mode, the mask is ignored and all three (RED, GREEN, BLUE) channels are active. ||adc=1700||4+1 RED,GREEN,BLUE|| === Parameter math= === This is a string parameter, where each character of the string corresponds to one of the following operation codes: ||'''0'''||(zero)Skip sample|| ||'''1'''||Add sample to accumulator 1|| ||'''2'''||Add sample to accumulator 2|| ||'''3'''||Subtract sample from accumulator 1|| ||'''4'''||Subtract sample from accumulator 2|| ||'''A'''||Move accumulator 1 '''result''' to OCM and clear|| ||'''B'''||Move accumulator 2 '''result''' to OCM and clear|| ||'''C'''||Move sample directly to OCM (same memory as ACC1, typ. red channels)|| ||'''D'''||Move sample directly to OCM (same memory as ACC2, typ. green channels)|| The '''result''' of the accumulator that is moved into OCM is a 16 bit value obtained from the sum in the accumulator, plus an '''offset''' and divided by a '''divisor'''. The offset and divisor are automatically determined by the controller and cannot currently be set by the user. The '''divisor''' will be the number of '''Add''' operations in the specified math= pattern (i.e., a count of the '''1''' characters in the string). The length of the string must match the number of samples requested in ADC= (per ADCTRIG), times TWO because there are two ADCTRIG events per pixel, times 1,2,or 3 depending on whether a single channel (e.g. "Red") or a set of channels (e.g. "Red+Green") is selected. The start of the pattern should match the "cestlavie" tool display. The controller rotates the pattern to the left by 3 positions to compensate for ADC pipeline delays that are intrinsic in the A/D part. Do not rotate the pattern string supplied to the controller. Example for typical red-channel only, "4+1" sampling: {{{ clvset adc=1500:1 math=333301111A mathcal=1111A1111A }}} === Parameter mathcal= === If '''math=''' produces a result in OCM that includes both a 16-bit pedestal and a 16-bit video sample, then '''mathcal=''' is not needed. In cases where it only produces a single 16-bit value in OCM (i.e., the math sequence performs pedestal subtraction) then the pattern is not suitable for '''readcal'''. A separate pattern that is suitable can be provided with mathcal= which will only be used for the [wiki:GraspSwControllerCmdReadcal readcal] command.