ID |
Date |
Author |
Topic |
Subject |
1192
|
23 Aug 2016 |
Stefan Ritt | Forum | Alarm/Warning | > Midas has a nice alarm system. I am wondering whether it is easily possible to
> get the Alarm/Warning banner also on top of custom pages?!
K.O. made nice JavaScript routines to access the alarm status. The new alarm page is completely
made dynamically from JavaScript code (mhttpd does not supply any HTML code any more, only
functions to obtain ODB values etc). Part of this new dynamic page must be some code to display
the alarm status. You just need to copy this to your custom page. K.O. can tell you details.
Stefan |
1191
|
23 Aug 2016 |
Andreas Suter | Forum | Alarm/Warning | Midas has a nice alarm system. I am wondering whether it is easily possible to
get the Alarm/Warning banner also on top of custom pages?! |
1189
|
08 Aug 2016 |
Konstantin Olchanski | Release | Merged - new pure html web pages: programs and alarms. | The code for the new pure html and javascript web pages was merged into main midas.
In this release, the "programs" and "alarms" pages are implemented as html files, see
resources/programs.html and alarms.html.
Eventually we hope to implement all midas web pages in html, so this is just a start.
If you see problems with the new html code, you can revert to the old mhttpd-generated web
pages by removing the files programs.html and alarms.html.
The new code for starting and stopping runs (start.html and transition.html) is also merged, but not
yet enabled, pending a few more tests.
K.O. |
1188
|
13 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate |
More suggestions from John and my reply.
> we also don't use the VME back plane - it's just too slow - mixing VME commands to plain modules and digitizer modules is unreliable....
> We use CAEN fiberoptic version 2 to talk to the digitizers directly, we have upto 12 digitizers, and can use all channels for several hours, and can fill to about 75%
of the A3818 bandwidth...
So far we are limitted to 30 MB/s, if tested with CAEN examples, for example, the wavedump program by CAEN.
I think is kind of the limit by IDE hard drive.
Unfortunately we are still far from that limit, only ~ 1 MB/s now. :( |
1187
|
13 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate | Suggestion from John and my reply.
> We have achieved very high rates, but only with some care.
> The biggest issue was to make sure when you compile the CAEN driver for the A3818 board that you turn on the MIDAS switch. Without that problems occur with some
> probability given by the number of bytes processed - which translates into very soon if you have a high rate. (The underlying cause is that both MIDAS and the A3818
> use unix Alarm signals, but the CAEN folks have a compile option to turn this off.)
> We use as little as possible of the CAENDigitizerLibrary - instead we program the registers directly on the board.
> There is still some kind of memory leak which we have not yet tracked down, so every few hours we shut down the frontend then restart it.
We use A2818 (PCI) - fiber - V2718 (Bridge) - VME - V1751.
I actually didn't find a MIDAS switch in the Makefile. |
1186
|
13 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate | Somehow I don't understand why people's reply is only in my mail box.
So I pasted them here. I hope they don't mind and these information may be useful for others.
The following is some discussion.
==========================================================================================
> In read_trigger_event(), you creating a secondary bank with time in
> second. For your information, this time in second is already written in
> the event header. You can retrieve the time using macros from the
> midas.h time = TIME_STAMP(pevent)
Removed.
>
> In frontend_init() you loop over NFADC (1) and call for each loop
> frontend_config() after opening the device on that card. In
> frontend_config() you redo a loop over NFADC, meaning that in case of
> more than one card you will find the second one not open on the first
> frontend_config (ok for one card though).
>
Corrected.
> In frontend_config() what is the return sCAEN from MallocReadoutBuffer()?
> What is the size of the requested allocated buffer?
The return size of allocated buffer is 134936.
>
> What is the value of the sCAEN from the ReadData() function in
> read_trigger_event()?
It is always 0 for success until it crashes.
However, even for the event it crashes, it also appears as 0.
>
> I didn't check all the config parameters!
>
> What is the value of count in the poll_event(). It is true if the test
> in poll_event() is too short, it cause timing corruption during
> calibration.
Do you mean Midas timing calibration for poll_event() before all finally start up?
We havn't observed corruption at this stage.
> This never happen during CAMAC time... to be fixed!
> The alternative is to include a ss_sleep(1) instead of the prescale.
> a 1ms delay between every poll is short enough to ensure your 1KHz trigger.
We tried ss_sleep(1) in poll_event(), and it doesn't help.
We also tried add a ss_sleep(10) in the read_trigger_event().
This may work. But we can only reach 100 Hz and 1 MB/s rate. Still low.
>
> How long do you spend in the read_trigger_event()? To be measured.
We add some timers in this part of the program.
The time spent on CAEN_DGTZ_ReadData is about 100 us.
To sleep 1 ms in read_trigger_event may delay the crush, but just one minute.
To sleep 10 ms works.
>
> I still don't understand your setup as you mention using optic fiber to
> access the VME controller? do you have a A3818 or similar to the
> controller? If so why don't you connect directly the optic to the VX1751
> and prevent the use of the VME backplane?
Our connect is:
A2818 (PCI) - fiber - V2718 (Bridge) - VME - V1751
We probably need to configure other vme boards through VME at the same time,
however, these boards don't have a fiber connection.
We also tested direct fiber connect for V1751 today.
But it crashes with the same symptom.
========================================================================================== |
Attachment 1: frontend.c
|
/*****************************************************************\
Name: frontend.c
Created by: Zhe Wang
Date: 03/16/2015
Modified by: Mohan Li
Date: 07/04/2016
Contents: Experiment specific readout code (user part) of Midas frontend.
Supported VME modules:
CAEN V2718 VME-CONET Bridge
CAEN V1751 10-Bits 1-GHz Flash ADC
Experiment: Dark noise
Currently: Use CAEN_Digitizer lib. Use Ramdom number to avoid disconnection.
$Id: $
\********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "midas.h"
#include "mcstd.h"
#include "mvmestd.h"
#include "experim.h"
#include "v1751.h"
#include "CAENDigitizer.h"
/* make frontend functions callable from the C framework */
#ifdef __cplusplus
extern "C" {
#endif
/*-- Globals -------------------------------------------------------*/
/* The frontend name (client name) as seen by other MIDAS clients */
char *frontend_name = "Frontend";
/* The frontend file name, don't change it */
char *frontend_file_name = __FILE__;
/* frontend_loop is called periodically if this variable is TRUE */
BOOL frontend_call_loop = FALSE;
/* a frontend status page is displayed with this frequency in ms */
INT display_period = 500;
/* maximum event size produced by this frontend */
//INT max_event_size = 10000;
INT max_event_size = 100000; //modified according to feov1721.cxx
/* maximum event size for fragmented events (EQ_FRAGMENTED) */
INT max_event_size_frag = 5 * 1024 * 1024;
/* buffer size to hold events */
INT event_buffer_size = 200 * 100000;
#define NFADC 1
#define NMax 4
int hFADC[NFADC];
/* VMEBaseAddress */
uint32_t FADCBA[NMax] = {0x000C0000,0,0,0}; // FADC base address 0x80000000
uint32_t EvtCounterFadc[NMax];
/* Time in second*/
uint32_t TimeInSec;
/* initiate variables */
FILE* logfile;
//CAENComm_ErrorCode sCAENc;
int l=0, d=0, h=0, Nh;
uint32_t i, lcount, temp, lam, reg, data[50000];
int Nmodulo=10; //print transmission information every Nmodulo events
int tcount=0, eloop=0;
DWORD eStored, eSize;
DWORD eventReady;
DWORD BLTNB;
DWORD recordlength;
uint32_t recordsize = 0x1000;
int loop, Nloop=10;
int bshowData=0; // 1 to enable data print
int debug = 0;
uint32_t pct=0, ct;
struct timeval t1;
int dt1, savelcount=0;
float trg_rate =0;
int data_test = 0; // 1 for stored data check
int simulation = 0;// 1 for simulation mode
/*-------------CAEN Digitier vairables----------*/
int card=0;
CAEN_DGTZ_ErrorCode sCAEN;
CAEN_DGTZ_BoardInfo_t BoardInfo;
char *buffer = NULL; //pointer to the read out buffer
int c = 0;
uint32_t size; //buffer allocated for reading data
uint32_t bsize;
#define INTERRUPT_TIMEOUT 20000 //20000ms = 20s
#define VME_INTERRUPT_LEVEL 1
#define VME_INTERRUPT_STATUS_ID 0xAAAA
#define IRQ_EVENT_NUMBER 1
/*-- Function declarations -----------------------------------------*/
INT frontend_init();
INT frontend_exit();
INT begin_of_run(INT run_number, char *error);
INT end_of_run(INT run_number, char *error);
INT pause_run(INT run_number, char *error);
INT resume_run(INT run_number, char *error);
INT frontend_loop();
INT read_trigger_event(char *pevent, INT off);
INT frontend_config();
/*-- Equipment list ------------------------------------------------*/
#undef USE_INT
//#define USE_INT
EQUIPMENT equipment[] = {
{"Trigger", /* equipment name */
{1, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
#ifdef USE_INT
EQ_INTERRUPT, /* equipment type */
#else
EQ_POLLED, /* equipment type */
#endif
// LAM_SOURCE(CRATE, LAM_STATION(SLOT_ADC)), /* event source */
LAM_SOURCE(0, 0xFFFFFF), /* event source crate 0, all stations, by Li*/
"MIDAS", /* format */
TRUE, /* enabled */
RO_RUNNING | /* read only when running */
RO_ODB, /* and update ODB */
500, /* poll for 500ms */
0, /* stop run after this event limit */
0, /* number of sub events */
0, /* don't log history */
"", "", "",},
read_trigger_event, /* readout routine */
},
{""}
};
#ifdef __cplusplus
}
#endif
/********************************************************************\
Callback routines for system transitions
These routines are called whenever a system transition like start/
stop of a run occurs. The routines are called on the following
occations:
frontend_init: When the frontend program is started. This routine
should initialize the hardware.
frontend_exit: When the frontend program is shut down. Can be used
to releas any locked resources like memory, commu-
nications ports etc.
begin_of_run: When a new run is started. Clear scalers, open
rungates, etc.
end_of_run: Called on a request to stop a run. Can send
end-of-run event and close run gates.
pause_run: When a run is paused. Should disable trigger events.
resume_run: When a run is resumed. Should enable trigger events.
\********************************************************************/
/*-- Frontend Init -------------------------------------------------*/
INT frontend_init()
{
// Open FADC digitizer
for( card=0; card<NFADC; card++ ) {
// through V2718
//sCAEN = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_PCI_OpticalLink, 0, 0, FADCBA[card], &hFADC[card]);
// through fiber
sCAEN = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_OpticalLink, 0, 0, 0, &hFADC[card]);
if(sCAEN != CAEN_DGTZ_Success) {
printf("Can't open digitizer\n");
//sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}
}
frontend_config();
return SUCCESS;
}
INT frontend_config()
{
/* ------FADC configuration------ */
for( card=0; card<NFADC; card++ ) {
//Print Board Info
sCAEN = CAEN_DGTZ_GetInfo(hFADC[card], &BoardInfo);
printf("\nConnected to CAEN Digitizer Model %s, recognized as board %d\n", BoardInfo.ModelName, card);
printf("\tROC FPGA Release is %s\n", BoardInfo.ROC_FirmwareRel);
printf("\tAMC FPGA Release is %s\n", BoardInfo.AMC_FirmwareRel);
//Reset Digitizer
sCAEN = CAEN_DGTZ_Reset(hFADC[card]);
//Calibrate temperatire
sCAEN = CAEN_DGTZ_Calibrate(hFADC[card]);
//Set the lenght of each waveform (in samples)
sCAEN = CAEN_DGTZ_SetRecordLength(hFADC[card], 1792);
//Generate a global trigger by AND opend channels. Set trigger on channel 0 to be ACQ_ONLY
sCAEN = CAEN_DGTZ_SetChannelSelfTrigger(hFADC[card], CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT, 0x01);
//Enable channel 0
sCAEN = CAEN_DGTZ_SetChannelEnableMask(hFADC[card], 0x01);
//Set selfTrigger threshold 0x3a7=-4mV
sCAEN = CAEN_DGTZ_SetChannelTriggerThreshold(hFADC[card], 0, 0x3a9);
//Trigger under threshold
sCAEN = CAEN_DGTZ_SetTriggerPolarity(hFADC[card], 0, CAEN_DGTZ_TriggerOnFallingEdge);
//Post trigger
sCAEN = CAEN_DGTZ_SetPostTriggerSize(hFADC[card], 20);
//DC offset
sCAEN = CAEN_DGTZ_SetChannelDCOffset(hFADC[card], 0, 0x3333);
//Set the acquisition mode
sCAEN = CAEN_DGTZ_SetAcquisitionMode(hFADC[card], CAEN_DGTZ_SW_CONTROLLED);
//IO Level
sCAEN = CAEN_DGTZ_SetIOLevel(hFADC[card], CAEN_DGTZ_IOLevel_NIM);
//Set the max number of events to transfer in a sigle readout
sCAEN = CAEN_DGTZ_SetMaxNumEventsBLT(hFADC[card], 1);
//Set the behaviour when a Software tirgger arrives
//sCAEN = CAEN_DGTZ_SetSWTriggerMode(hFADC[card], CAEN_DGTZ_TRGMODE_ACQ_ONLY);
//---------------------------------------------------------//
//----- Last step: Allociate memory for readout buffer-----//
//---------------------------------------------------------//
sCAEN = CAEN_DGTZ_MallocReadoutBuffer(hFADC[card], &buffer, &size);
printf("MallocReadoutBuffer returned with status %d and size %d.\n", sCAEN, size);
if(sCAEN != CAEN_DGTZ_Success) {
printf("Errors during Digitizer Configuration.\n");
sCAEN = CAEN_DGTZ_FreeReadoutBuffer(&buffer);
sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}else{
printf("Digitizer Configuration Successfully.\n");
}
}//end of FADC Configuration
return SUCCESS;
}
/*-- Frontend Exit -------------------------------------------------*/
INT frontend_exit()
{
//Stop DAQ
for (card=0;card<NFADC;card++) {
sCAEN = CAEN_DGTZ_SWStopAcquisition(hFADC[card]);
}
//Free memory
sCAEN = CAEN_DGTZ_FreeReadoutBuffer(&buffer);
//Close digitizer
for (card=0;card<NFADC;card++) {
sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}
if(sCAEN == CAEN_DGTZ_Success){
printf("FADC Modules stopped.\n");
}else{
printf("FADC Modules can not be stopped.\n");
}
return SUCCESS;
}
/*-- Begin of Run --------------------------------------------------*/
INT begin_of_run(INT run_number, char *error)
{
//Create log file
logfile = fopen("log.txt","w");
//Start FADC
for (card=0;card<NFADC;card++) {
sCAEN = CAEN_DGTZ_ClearData(hFADC[card]);
sCAEN = CAEN_DGTZ_SWStartAcquisition(hFADC[card]);
}
printf("begin of run.\n");
return SUCCESS;
}
/*-- End of Run ----------------------------------------------------*/
... 194 more lines ...
|
1185
|
10 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate | Dear friends,
In case anyone need the source code, it is attached.
We use optic fiber to connect to a VME controler, which talks to V1751 via VME bus.
--
Zhe Wang
> Dear friends,
>
> I may add a little more information.
> For polling event, we check the data-ready register for the status of the digitizer.
> In the readout routine, we create a bank, readout the data and write it out.
>
> We commented out or made some replacement for each part of the subroutines to figure our where exactly goes wrong.
> for example, replace the readout from the digitizer with a random generation of some fake events.
> By replacing the readout by a random generation, the program runs fine and reach a very high event rates.
>
> Any suggestions or ideas from experts?
>
> Thank you very much.
>
> --
> Best regards,
> Zhe Wang
>
>
> > Dear friends,
> >
> > We have some questions on using midas.
> > We use a Caen digitizer V1751 to take waveforms.
> > When testing with caen provided programs, we roughly know it can work fine at 1000 Hz event rate, and 30 M/s data can be written to disk.
> > The test with Midas, however, is a little confusing. We use CAENDigitizer library with Midas. First, it works, data were taken, and there seems no error.
> > The only problem is we cannot go to a higher event rate, for example we can only work on a rate of 40 Hz, and only 3 M/s data recording. Otherwise it will crush.
> >
> > We may miss something really simple. Would you please give some suggestions? for example, other people's discussions or documents?
> >
> > Thank you very much. |
Attachment 1: frontend.c
|
/*****************************************************************\
Name: frontend.c
Created by: Zhe Wang
Date: 03/16/2015
Modified by: Mohan Li
Date: 07/04/2016
Contents: Experiment specific readout code (user part) of Midas frontend.
Supported VME modules:
CAEN V2718 VME-CONET Bridge
CAEN V1751 10-Bits 1-GHz Flash ADC
Experiment: Dark noise
Currently: Use CAEN_Digitizer lib. Use Ramdom number to avoid disconnection.
$Id: $
\********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "midas.h"
#include "mcstd.h"
#include "mvmestd.h"
#include "experim.h"
#include "v1751.h"
#include "v775n.h"
#include "v785n.h"
#include "v1751Infc.h"
#include "v775nInfc.h"
#include "CAENDigitizer.h"
/* make frontend functions callable from the C framework */
#ifdef __cplusplus
extern "C" {
#endif
/*-- Globals -------------------------------------------------------*/
/* The frontend name (client name) as seen by other MIDAS clients */
char *frontend_name = "Frontend";
/* The frontend file name, don't change it */
char *frontend_file_name = __FILE__;
/* frontend_loop is called periodically if this variable is TRUE */
BOOL frontend_call_loop = FALSE;
/* a frontend status page is displayed with this frequency in ms */
INT display_period = 500;
/* maximum event size produced by this frontend */
//INT max_event_size = 10000;
INT max_event_size = 100000; //modified according to feov1721.cxx
/* maximum event size for fragmented events (EQ_FRAGMENTED) */
INT max_event_size_frag = 5 * 1024 * 1024;
/* buffer size to hold events */
INT event_buffer_size = 200 * 100000;
#define NFADC 1
#define NMax 4
int hFADC[NFADC];
/* VMEBaseAddress */
uint32_t FADCBA[NMax] = {0x000C0000,0,0,0}; // FADC base address 0x80000000
uint32_t EvtCounterFadc[NMax];
/* Time in second*/
uint32_t TimeInSec;
/* initiate variables */
FILE* logfile;
//CAENComm_ErrorCode sCAENc;
int l=0, d=0, h=0, Nh;
uint32_t i, lcount, temp, lam, reg, data[50000];
int Nmodulo=10; //print transmission information every Nmodulo events
int tcount=0, eloop=0;
DWORD eStored, eSize;
DWORD eventReady;
DWORD BLTNB;
DWORD recordlength;
uint32_t recordsize = 0x1000;
int loop, Nloop=10;
int bshowData=0; // 1 to enable data print
int debug = 0;
uint32_t pct=0, ct;
struct timeval t1;
int dt1, savelcount=0;
float trg_rate =0;
int data_test = 0; // 1 for stored data check
int simulation = 0;// 1 for simulation mode
/*-------------CAEN Digitier vairables----------*/
int card=0;
CAEN_DGTZ_ErrorCode sCAEN;
CAEN_DGTZ_BoardInfo_t BoardInfo;
char *buffer = NULL; //pointer to the read out buffer
int c = 0;
uint32_t size; //buffer allocated for reading data
uint32_t bsize;
#define INTERRUPT_TIMEOUT 20000 //20000ms = 20s
#define VME_INTERRUPT_LEVEL 1
#define VME_INTERRUPT_STATUS_ID 0xAAAA
#define IRQ_EVENT_NUMBER 1
unsigned int counter = 0;
unsigned int preScaler = 100;
/*-- Function declarations -----------------------------------------*/
INT frontend_init();
INT frontend_exit();
INT begin_of_run(INT run_number, char *error);
INT end_of_run(INT run_number, char *error);
INT pause_run(INT run_number, char *error);
INT resume_run(INT run_number, char *error);
INT frontend_loop();
INT read_trigger_event(char *pevent, INT off);
INT frontend_config();
/*-- Equipment list ------------------------------------------------*/
#undef USE_INT
//#define USE_INT
EQUIPMENT equipment[] = {
{"Trigger", /* equipment name */
{1, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
#ifdef USE_INT
EQ_INTERRUPT, /* equipment type */
#else
EQ_POLLED, /* equipment type */
#endif
// LAM_SOURCE(CRATE, LAM_STATION(SLOT_ADC)), /* event source */
LAM_SOURCE(0, 0xFFFFFF), /* event source crate 0, all stations, by Li*/
"MIDAS", /* format */
TRUE, /* enabled */
RO_RUNNING | /* read only when running */
RO_ODB, /* and update ODB */
500, /* poll for 500ms */
0, /* stop run after this event limit */
0, /* number of sub events */
0, /* don't log history */
"", "", "",},
read_trigger_event, /* readout routine */
},
{""}
};
#ifdef __cplusplus
}
#endif
/********************************************************************\
Callback routines for system transitions
These routines are called whenever a system transition like start/
stop of a run occurs. The routines are called on the following
occations:
frontend_init: When the frontend program is started. This routine
should initialize the hardware.
frontend_exit: When the frontend program is shut down. Can be used
to releas any locked resources like memory, commu-
nications ports etc.
begin_of_run: When a new run is started. Clear scalers, open
rungates, etc.
end_of_run: Called on a request to stop a run. Can send
end-of-run event and close run gates.
pause_run: When a run is paused. Should disable trigger events.
resume_run: When a run is resumed. Should enable trigger events.
\********************************************************************/
/*-- Frontend Init -------------------------------------------------*/
INT frontend_init()
{
// Open FADC digitizer
for( card=0; card<NFADC; card++ ) {
sCAEN = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_PCI_OpticalLink, 0, card, FADCBA[card], &hFADC[card]);
if(sCAEN != CAEN_DGTZ_Success) {
printf("Can't open digitizer\n");
sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}else{
printf("Open Device successfully.\n");
frontend_config();
}
}
return SUCCESS;
}
INT frontend_config()
{
/* ------FADC configuration------ */
for( card=0; card<NFADC; card++ ) {
//Print Board Info
sCAEN = CAEN_DGTZ_GetInfo(hFADC[card], &BoardInfo);
printf("\nConnected to CAEN Digitizer Model %s, recognized as board %d\n", BoardInfo.ModelName, card);
printf("\tROC FPGA Release is %s\n", BoardInfo.ROC_FirmwareRel);
printf("\tAMC FPGA Release is %s\n", BoardInfo.AMC_FirmwareRel);
//Reset Digitizer
sCAEN = CAEN_DGTZ_Reset(hFADC[card]);
//Calibrate temperatire
sCAEN = CAEN_DGTZ_Calibrate(hFADC[card]);
//Set the lenght of each waveform (in samples)
sCAEN = CAEN_DGTZ_SetRecordLength(hFADC[card], 1792);
//Generate a global trigger by AND opend channels. Set trigger on channel 0 to be ACQ_ONLY
sCAEN = CAEN_DGTZ_SetChannelSelfTrigger(hFADC[card], CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT, 0x01);
//Enable channel 0
sCAEN = CAEN_DGTZ_SetChannelEnableMask(hFADC[card], 0x01);
//Set selfTrigger threshold 0x3a7=-4mV
sCAEN = CAEN_DGTZ_SetChannelTriggerThreshold(hFADC[card], 0, 0x3a9);
//Trigger under threshold
sCAEN = CAEN_DGTZ_SetTriggerPolarity(hFADC[card], 0, CAEN_DGTZ_TriggerOnFallingEdge);
//Post trigger
sCAEN = CAEN_DGTZ_SetPostTriggerSize(hFADC[card], 20);
//DC offset
sCAEN = CAEN_DGTZ_SetChannelDCOffset(hFADC[card], 0, 0x3333);
//Set the acquisition mode
sCAEN = CAEN_DGTZ_SetAcquisitionMode(hFADC[card], CAEN_DGTZ_SW_CONTROLLED);
//IO Level
sCAEN = CAEN_DGTZ_SetIOLevel(hFADC[card], CAEN_DGTZ_IOLevel_NIM);
//Analog Monitor
//sCAEN = CAEN_DGTZ_SetAnalogMonOutput(hFADC[card], CAEN_DGTZ_AM_BUFFER_OCCUPANCY);
//sCAEN = CAEN_DGTZ_ReadRegister(hFADC[card], V1751_FRONT_PANEL_IO_CONTROL, &temp);
//printf("V1751_FRONT_PANEL_IO_CONTROL = %d\n", temp);
sCAEN = CAEN_DGTZ_WriteRegister(hFADC[card], V1751_FRONT_PANEL_IO_CONTROL, 0x3C);
sCAEN = CAEN_DGTZ_WriteRegister(hFADC[card], V1751_FRONT_PANEL_TRIGGER_OUT_ENABLE_MASK, 0xFF);
sCAEN = CAEN_DGTZ_ReadRegister(hFADC[card], V1751_FRONT_PANEL_IO_CONTROL, &temp);
printf("V1751_FRONT_PANEL_IO_CONTROL = %d\n", temp);
//Interrupt configuration
sCAEN = CAEN_DGTZ_SetInterruptConfig(hFADC[card], CAEN_DGTZ_ENABLE, VME_INTERRUPT_LEVEL, VME_INTERRUPT_STATUS_ID, IRQ_EVENT_NUMBER, CAEN_DGTZ_IRQ_MODE_RORA);
//Set the max number of events to transfer in a sigle readout
sCAEN = CAEN_DGTZ_SetMaxNumEventsBLT(hFADC[card], 3);
//Set the behaviour when a Software tirgger arrives
//sCAEN = CAEN_DGTZ_SetSWTriggerMode(hFADC[card], CAEN_DGTZ_TRGMODE_ACQ_ONLY);
//---------------------------------------------------------//
//----- Last step: Allociate memory for readout buffer-----//
//---------------------------------------------------------//
sCAEN = CAEN_DGTZ_MallocReadoutBuffer(hFADC[card], &buffer, &size);
if(sCAEN != CAEN_DGTZ_Success) {
printf("Errors during Digitizer Configuration.\n");
sCAEN = CAEN_DGTZ_FreeReadoutBuffer(&buffer);
sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}else{
printf("Digitizer Configuration Successfully.\n");
}
}//end of FADC Configuration
return SUCCESS;
}
/*-- Frontend Exit -------------------------------------------------*/
INT frontend_exit()
{
//Stop DAQ
for (card=0;card<NFADC;card++) {
sCAEN = CAEN_DGTZ_SWStopAcquisition(hFADC[card]);
}
//Free memory
sCAEN = CAEN_DGTZ_FreeReadoutBuffer(&buffer);
//Close digitizer
for (card=0;card<NFADC;card++) {
sCAEN = CAEN_DGTZ_CloseDigitizer(hFADC[card]);
}
if(sCAEN == CAEN_DGTZ_Success){
printf("FADC Modules stopped.\n");
}else{
printf("FADC Modules can not be stopped.\n");
}
return SUCCESS;
}
/*-- Begin of Run --------------------------------------------------*/
... 200 more lines ...
|
1184
|
09 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate | Dear friends,
I may add a little more information.
For polling event, we check the data-ready register for the status of the digitizer.
In the readout routine, we create a bank, readout the data and write it out.
We commented out or made some replacement for each part of the subroutines to figure our where exactly goes wrong.
for example, replace the readout from the digitizer with a random generation of some fake events.
By replacing the readout by a random generation, the program runs fine and reach a very high event rates.
Any suggestions or ideas from experts?
Thank you very much.
--
Best regards,
Zhe Wang
> Dear friends,
>
> We have some questions on using midas.
> We use a Caen digitizer V1751 to take waveforms.
> When testing with caen provided programs, we roughly know it can work fine at 1000 Hz event rate, and 30 M/s data can be written to disk.
> The test with Midas, however, is a little confusing. We use CAENDigitizer library with Midas. First, it works, data were taken, and there seems no error.
> The only problem is we cannot go to a higher event rate, for example we can only work on a rate of 40 Hz, and only 3 M/s data recording. Otherwise it will crush.
>
> We may miss something really simple. Would you please give some suggestions? for example, other people's discussions or documents?
>
> Thank you very much. |
1183
|
06 Jul 2016 |
Zhe Wang | Suggestion | Frontend crush on high event rate | Dear friends,
We have some questions on using midas.
We use a Caen digitizer V1751 to take waveforms.
When testing with caen provided programs, we roughly know it can work fine at 1000 Hz event rate, and 30 M/s data can be written to disk.
The test with Midas, however, is a little confusing. We use CAENDigitizer library with Midas. First, it works, data were taken, and there seems no error.
The only problem is we cannot go to a higher event rate, for example we can only work on a rate of 40 Hz, and only 3 M/s data recording. Otherwise it will crush.
We may miss something really simple. Would you please give some suggestions? for example, other people's discussions or documents?
Thank you very much. |
1182
|
13 Jun 2016 |
Konstantin Olchanski | Info | mongoose v6.4 is ready for use | latest version of mongoose web server library (v6.4) is now implemented in midas. To try it out, edit
the Makefile, comment-out USE_MONGOOSE4, uncomment USE_MONGOOSE6, make clean,
make.
After some more testing mongoose v6 will be made the default. (if you see problems, please report
them here).
Main user-visible change is implementation of pipelined http requests, where the same socket
connection is reused for many requests (instead of opening a new connection for each request).
This is supposed to significantly speed up things like ajax requests over https (ssl handshake is
done only once). (As a buglet, some midas web pages do not generated the "ContentLength"
header, and force connection reset).
Special features: (implemented in mhttpd.cxx)
- https support (same as mongoose v4)
- https score A- at SSLlabs (if ignore whining about self-signed certificate)
- CORS support (same as v4) (cross-origin AJAX requests - web pages loaded from some other
web server can make requests into midas)
- password protection (same as v4, uses http digest authentication)
- http-to-https redirect (same as v4)
- setuid-root mode for binding to port 80 (special request from PSI).
K.O. |
1181
|
13 Jun 2016 |
Konstantin Olchanski | Bug Fix | example ssl certificate removed | I removed the example ssl certificate from the midas git repository (ssl_cert.pem). Now every midas
installation must generate their own certificate - because to have any security at all each encryption
private key has to be unique (and it has to be secret).
The command for generating a self-signed certificate is printed by mhttpd on startup:
openssl req -new -nodes -newkey rsa:2048 -sha256 -out ssl_cert.csr -keyout ssl_cert.key; openssl
x509 -req -days 365 -sha256 -in ssl_cert.csr -signkey ssl_cert.key -out ssl_cert.pem; cat
ssl_cert.key >> ssl_cert.pem
K.O. |
1180
|
13 Jun 2016 |
Konstantin Olchanski | Info | running mhttpd on port 443 | mhttpd running as non-root cannot bind to standard https port 443. By default, mhttpd uses port
8443 and it works just fine, but some applications such as the SSLlabs https tester insist on using
port 443.
To connect mhttpd with port 443, I use the tcpproxy package from
git://git.spreadspace.org/tcpproxy.git
./tcpproxy -D -U -p 443 -r localhost4 -o 8443
(you can run this from rc.local)
(to remember, for best security one should run mhttpd behind an industry-standard https proxy)
K.O. |
1179
|
17 May 2016 |
Konstantin Olchanski | Info | openssl situation, MacOS 10.11 (El Capitan) openssl compilation errors | > I recently upgraded my macbook to MacOS 10.11.
> [ and midas would not compile ]
> It seems that MacOS has now fully removed openssl ...
My read of tea leaves - the macos version of openssl was so old it was almost useless, did not support any of the modern HTTPS
features. So to use mhttpd with https you pretty much had to install openssl from macports anyway. For macos 10.11 maybe they
looked at upgrading to newer version, but since the openssl kerfuffle last year, there is several forks of openssl (the OpenBSD fork
named libressl is the best, IMO), so rather than picking and choosing, they deleted the whole thing.
Now back to MIDAS.
We use the mongoose web server module and I have expected by now for them to make a move on improving HTTPS support, but no
move happened.
Right now mongoose support OpenSSL only (I would expect the OpenBSD LibreSSL fork to work to of the box, too). Other then that,
they have:
a) their own mickey-mouse https library (krypton) which does not support any modern cryptography (RC4 only - when RC4 is known to
be useless).
b) an adapter library (polar) for interfacing with PolarSSL (mbedtls)
At this point I would rather abandon the implicit dependency on the system-provided openssl and have an explicit dependancy on a
modern https crypto library.
Option (b) would work for us -
1) add "git clone mbedtls; cd mbedtls; make" to midas build instructions
2) add polarssl_compat.c to midas git (from cessanta/polar repo)
3) retest mhttpd against ssllabs https scanner, retest against all web browsers.
The downside of this route is loss of automatic nightly updates to the https crypto library (for better or for worse).
K.O.
P.S. Because on MacOS use of openssl from macports is pretty much required, it should be moved from the "tricks" page to the
standard midas installation instructions ("install required packages"). |
1178
|
12 May 2016 |
Stefan Ritt | Info | MacOS 10.11 (El Capitan) openssl compilation errors | > I recently upgraded my macbook to MacOS 10.11. The compilation of MIDAS failed after the upgrade,
> complaining about
>
> gcc -c -g -O2 -Wall <snip> src/mongoose.c
> src/mongoose.c:322:10: fatal error: 'openssl/ssl.h' file not found
>
> It seems that MacOS has now fully removed openssl header files (they were deprecated for a while). There
> seems to be some notes on that here
>
> http://lists.apple.com/archives/macnetworkprog/2015/Jun/msg00025.html
>
> Konstantin suggested installing open-source builds of openssl using MacPorts. I did that and MIDAS
> compiled fine. I documented the procedure here:
>
> https://midas.triumf.ca/MidasWiki/index.php/Installation/Compilation_problems#MacOS_10.11_.28El_Capitan.2
> 9_openssl_errors
The MIDAS Wiki page points to https://guide.macports.org/ which covers OSX up to 10.9. Installers for 10.10 and the current 10.11
(El Captain) can be found here: https://www.macports.org/install.php
Stefan |
1177
|
11 May 2016 |
Thomas Lindner | Info | MacOS 10.11 (El Capitan) openssl compilation errors | I recently upgraded my macbook to MacOS 10.11. The compilation of MIDAS failed after the upgrade,
complaining about
gcc -c -g -O2 -Wall <snip> src/mongoose.c
src/mongoose.c:322:10: fatal error: 'openssl/ssl.h' file not found
It seems that MacOS has now fully removed openssl header files (they were deprecated for a while). There
seems to be some notes on that here
http://lists.apple.com/archives/macnetworkprog/2015/Jun/msg00025.html
Konstantin suggested installing open-source builds of openssl using MacPorts. I did that and MIDAS
compiled fine. I documented the procedure here:
https://midas.triumf.ca/MidasWiki/index.php/Installation/Compilation_problems#MacOS_10.11_.28El_Capitan.2
9_openssl_errors |
1176
|
22 Apr 2016 |
Wes Gohn | Bug Report | Calling external script from sequencer | Nevermind. I just had to give it a path to my script. Now it's fine.
> Can the MIDAS Sequencer call an external script? It seems that it should be able to. I have a simple
> test script to do so. It claims to execute, but the bash script never appears to be executed. Any
> suggestions?
>
> 1 COMMENT "This is a MSL test file"
> 2 RUNDESCRIPTION "Test run"
> 3
> 4 LOOP setting, 1,2, 3
> 5 SCRIPT test_wheel.sh ,$setting
> 6 TRANSITION START
> 7 WAIT Seconds 10
> 8 TRANSITION STOP
> 9 ENDLOOP
>
> I've also tried using an xml script with <Script params="1">test_wheel.sh</Script>, but with the same
> result.
>
> Thanks! |
1175
|
22 Apr 2016 |
Wes Gohn | Bug Report | Calling external script from sequencer | Can the MIDAS Sequencer call an external script? It seems that it should be able to. I have a simple
test script to do so. It claims to execute, but the bash script never appears to be executed. Any
suggestions?
1 COMMENT "This is a MSL test file"
2 RUNDESCRIPTION "Test run"
3
4 LOOP setting, 1,2, 3
5 SCRIPT test_wheel.sh ,$setting
6 TRANSITION START
7 WAIT Seconds 10
8 TRANSITION STOP
9 ENDLOOP
I've also tried using an xml script with <Script params="1">test_wheel.sh</Script>, but with the same
result.
Thanks! |
1173
|
30 Mar 2016 |
Belina von Krosigk | Forum | mserver ERR message saying data area 100% full, though it is free | Hi,
I have just installed Midas and set-up the ODB for a SuperCDMS test-facility (on
a SL6.7 machine). All works fine except that I receive the following error message:
[mserver,ERROR] [odb.c:944:db_validate_db,ERROR] Warning: database data area is
100% full
Which is puzzling for the following reason:
-> I have created the ODB with: odbedit -s 4194304
-> Checking the size of the .ODB.SHM it says: 4.2M
-> When I save the ODB as .xml and check the file's size it says: 1.1M
-> When I start odbedit and check the memory usage issuing 'mem', it says:
...
Free Key area: 1982136 bytes out of 2097152 bytes
...
Free Data area: 2020072 bytes out of 2097152 bytes
Free: 1982136 (94.5%) keylist, 2020072 (96.3%) data
So it seems like nearly all memory is still free. As a test I created more
instances of one of our front-ends and checked 'mem' again. As expected the free
memory was decreasing. I did this ten times in fact, reaching
...
Free Key area: 1440976 bytes out of 2097152 bytes
...
Free Data area: 1861264 bytes out of 2097152 bytes
Free: 1440976 (68.7%) keylist, 1861264 (88.8%) data
So I could use another >20% of the database data area, which is according to the
error message 100% (resp. >95%) full. Am I misunderstanding the error message?
I'd appreciate any comments or ideas on that subject!
Thanks, Belina |
1172
|
22 Mar 2016 |
Konstantin Olchanski | Info | emacs web-mode.el | For those who use emacs to edit web pages - the built-in CSS and Javascript modes seem to work
just fine for editing files.css and files.js, but the built-in html modes fall flat on modern web pages
which contain a mix of html, javascript inside <script> tags and javascript inside button "onclick"
attributes.
So I looked at several emacs "html5 modes" and web-mode.el works well for me - html is indented
correctly (default indent level is easy to change), javascript inside <script> tags is indented
correctly (default indent level is easy to change), javascript inside "onclick" attributes has to be
indented manually.
web-mode code repository and instructions are here, the author is very responsive and fixed my
one request (permit manual intentation of javascript inside html attributes):
https://github.com/fxbois/web-mode
I now edit the html files in the MIDAS repository using these emacs settings:
8s-macbook-pro:web-mode 8ss$ more ~/.emacs
(setq-default indent-tabs-mode nil)
(setq-default tab-width 3)
(add-to-list 'load-path "~/git/web-mode")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 3)
(setq web-mode-script-padding 0)
(setq web-mode-attr-indent-offset 2)
8s-macbook-pro:web-mode 8ss$
K.O. |
1171
|
22 Mar 2016 |
Stefan Ritt | Bug Report | incomplete copy using odbedit copy | > Hi,
>
> Attempting to copy a subtree to a new location in the ODB using odbedit with "copy <src> <dest>" is
> occasionally not copying the entire <src> subtree.
>
> I am experiencing this issue consistently when trying to copy subtrees from the "/Equipment" ODB tree to
> a new location. The first 2-3 variables/directories of the <src> subtree will be copied to <dest> but the
> full subtree will not be copied over.
I just tried myself and could successfully copy of even large trees in the /Equipment subtree. Need to reproduce the problem to fix
it. Maybe close-to-full ODB?
Stefan |
|