<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:14pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Dear friends,</p>
<p><br>
</p>
<p>we just noticed that the value that is read from the event counter register (<span>Base + %004C</span>) of V767 is not stable during times when the module does internal operations. To demonstrate this we used the following code:</p>
<div><br>
</div>
<div>
<div><span style="font-size: 8pt;">last_event_counter = MAP_READ(caen_v767a->sicy_map, event_counter);</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, 0x1000); /* set mode of operation */</span><br>
<span style="font-size: 8pt;">t = time_getd();</span><br>
<span style="font-size: 8pt;">while ( last_event_counter != MAP_READ(caen_v767a->sicy_map, event_counter) )
</span><br>
<span style="font-size: 8pt;">{</span><br>
<span style="font-size: 8pt;">    usleep(1);</span><br>
<span style="font-size: 8pt;">}</span><br>
<span style="font-size: 8pt;">t = time_getd() - t;</span><br>
<span style="font-size: 8pt;">LOGF(info)(LOGL, NAME" TIME is %f", t);</span><br>
<br>
<span style="font-size: 8pt;">last_event_counter = MAP_READ(caen_v767a->sicy_map, event_counter);</span><br>
<span style="font-size: 8pt;">window_setting = config_get_int32(caen_v767a->module.config, KW_WIDTH, CONFIG_UNIT_NONE, 0x0001, 0x84D0);</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, 0x3000); /* set time window length */</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, window_setting);</span><br>
<span style="font-size: 8pt;">t = time_getd();</span><br>
<span style="font-size: 8pt;">while ( last_event_counter != MAP_READ(caen_v767a->sicy_map, event_counter) )
</span><br>
<span style="font-size: 8pt;">{</span><br>
<span style="font-size: 8pt;">    usleep(1);</span><br>
<span style="font-size: 8pt;">}</span><br>
<span style="font-size: 8pt;">t = time_getd() - t;</span><br>
<span style="font-size: 8pt;">LOGF(info)(LOGL, NAME" TIME is %f", t);</span><br>
<br>
<span style="font-size: 8pt;">last_event_counter = MAP_READ(caen_v767a->sicy_map, event_counter);</span><br>
<span style="font-size: 8pt;">window_setting = config_get_int32(caen_v767a->module.config, KW_OFFSET, CONFIG_UNIT_NONE, 1 - 320000, window_setting + 2000 - 1);</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, 0x3200); /* set time window offset */</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, window_setting);</span><br>
<span style="font-size: 8pt;">t = time_getd();</span><br>
<span style="font-size: 8pt;">while ( last_event_counter != MAP_READ(caen_v767a->sicy_map, event_counter) )
</span><br>
<span style="font-size: 8pt;">{</span><br>
<span style="font-size: 8pt;">    usleep(1);</span><br>
<span style="font-size: 8pt;">}</span><br>
<span style="font-size: 8pt;">t = time_getd() - t;</span><br>
<span style="font-size: 8pt;">LOGF(info)(LOGL, NAME" TIME is %f", t);</span><br>
<br>
<span style="font-size: 8pt;">last_event_counter = MAP_READ(caen_v767a->sicy_map, event_counter);</span><br>
<span style="font-size: 8pt;">write_op(caen_v767a->sicy_map, 0x7000); /* set data ready status to event ready */</span><br>
<span style="font-size: 8pt;">t = time_getd();</span><br>
<span style="font-size: 8pt;">while ( last_event_counter != MAP_READ(caen_v767a->sicy_map, event_counter) )
</span><br>
<span style="font-size: 8pt;">{</span><br>
<span style="font-size: 8pt;">    usleep(1);</span><br>
<span style="font-size: 8pt;">}</span><br>
<span style="font-size: 8pt;">t = time_getd() - t;</span><br>
<span style="font-size: 8pt;">LOGF(info)(LOGL, NAME" TIME is %f", t);    </span><br>
</div>
<br>
</div>
<p>And the output in two trials was the following:</p>
<p><br>
</p>
<p></p>
<div><span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:143: ..CEAN_V767A TIME is 0.000002</span><br>
<span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:155: ..CEAN_V767A TIME is 0.000002</span><br>
<span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:167: ..CEAN_V767A TIME is 0.055224</span><br>
<span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:177: ..CEAN_V767A TIME is 0.000354</span></div>
<br>
<p></p>
<p></p>
<div><span style="font-size: 8pt;"><span>10: module/caen_v767a/caen_v767a.c:143: ....CEAN_V767A TIME is 0.000002</span><br>
</span></div>
<div><span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:155: ....CEAN_V767A TIME is 0.000002</span><br>
<span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:167: ....CEAN_V767A TIME is 0.055223</span><br>
<span style="font-size: 8pt;">10: module/caen_v767a/caen_v767a.c:177: ....CEAN_V767A TIME is 0.000387</span></div>
<br>
<p></p>
<p>Thus, we can conclude that the event counter register is set to some fake value for up to almost 60 ms as a result of an internal operation of the module. Only after this time, the register goes back to the real value.</p>
<p><br>
</p>
<p>We will now take care of this effect and after each WRITE_OP call wait for the event counter to to gack to the original value. However, who knows what happens in the other registers of the module (and for how long).</p>
<p><br>
</p>
<p>As the event counter value is used as a sanity check in CRATE.C it might make sense to check if some of the other CAEN modules also exhibit this 'fascinating feature'.</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>Best greetings</p>
<p>Günter<br>
</p>
<p><br>
</p>
<br>
</div>
</body>
</html>