mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
changed dac values, fixed settings bug of not looking at nchan,nchips, , fixed clock divider, changed usleep in configuremac
This commit is contained in:
@ -90,7 +90,7 @@ u_int32_t progressMask=0;
|
|||||||
int phase_shift=0;//DEFAULT_PHASE_SHIFT;
|
int phase_shift=0;//DEFAULT_PHASE_SHIFT;
|
||||||
int ipPacketSize=DEFAULT_IP_PACKETSIZE;
|
int ipPacketSize=DEFAULT_IP_PACKETSIZE;
|
||||||
int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
||||||
int clockdivider;
|
int clockdivider = 20;
|
||||||
/*
|
/*
|
||||||
#ifndef NEW_PLL_RECONFIG
|
#ifndef NEW_PLL_RECONFIG
|
||||||
u_int32_t clkDivider[2]={32,16};
|
u_int32_t clkDivider[2]={32,16};
|
||||||
@ -539,7 +539,6 @@ u_int32_t adcPipeline(int d) {
|
|||||||
if (d>=0){
|
if (d>=0){
|
||||||
printf("Setting ADC Pipeline to 0x%x\n",d);
|
printf("Setting ADC Pipeline to 0x%x\n",d);
|
||||||
bus_w(ADC_PIPELINE_REG, d);
|
bus_w(ADC_PIPELINE_REG, d);
|
||||||
clockdivider = d;
|
|
||||||
}
|
}
|
||||||
return bus_r(ADC_PIPELINE_REG);
|
return bus_r(ADC_PIPELINE_REG);
|
||||||
|
|
||||||
@ -1504,12 +1503,12 @@ int configureInterface(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bus_w(CONTROL_REG,GB10_RESET_BIT);
|
bus_w(CONTROL_REG,GB10_RESET_BIT);
|
||||||
sleep(1);
|
usleep(500 * 1000);
|
||||||
bus_w(CONTROL_REG,0);
|
bus_w(CONTROL_REG,0);
|
||||||
usleep(10000);
|
usleep(10* 1000);
|
||||||
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
|
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
|
||||||
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
|
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
|
||||||
|
usleep(500 * 1000);
|
||||||
return 0; //any value doesnt matter - dhanya
|
return 0; //any value doesnt matter - dhanya
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1550,7 +1549,7 @@ int configureMAC(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int source
|
|||||||
|
|
||||||
bus_w(CONTROL_REG,GB10_RESET_BIT);
|
bus_w(CONTROL_REG,GB10_RESET_BIT);
|
||||||
bus_w(CONTROL_REG,0);
|
bus_w(CONTROL_REG,0);
|
||||||
usleep(10000);
|
usleep(10 * 1000);
|
||||||
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
|
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
|
||||||
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
|
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
|
||||||
return OK;
|
return OK;
|
||||||
|
Binary file not shown.
@ -133,6 +133,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
|||||||
/* #endif */
|
/* #endif */
|
||||||
destMod->serialnumber=srcMod->serialnumber;
|
destMod->serialnumber=srcMod->serialnumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ((srcMod->nchip)>(destMod->nchip)) {
|
if ((srcMod->nchip)>(destMod->nchip)) {
|
||||||
printf("Number of chip of source is larger than number of chips of destination\n");
|
printf("Number of chip of source is larger than number of chips of destination\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -141,6 +143,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
|||||||
printf("Number of channels of source is larger than number of channels of destination\n");
|
printf("Number of channels of source is larger than number of channels of destination\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ((srcMod->ndac)>(destMod->ndac)) {
|
if ((srcMod->ndac)>(destMod->ndac)) {
|
||||||
printf("Number of dacs of source is larger than number of dacs of destination\n");
|
printf("Number of dacs of source is larger than number of dacs of destination\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -153,8 +157,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac);
|
printf("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac);
|
||||||
printf("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc);
|
printf("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc);
|
||||||
printf("Chips: src %d, dest %d\n",srcMod->nchip,destMod->nchip);
|
//printf("Chips: src %d, dest %d\n",srcMod->nchip,destMod->nchip);
|
||||||
printf("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan);
|
//printf("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -162,8 +166,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
|||||||
|
|
||||||
destMod->ndac=srcMod->ndac;
|
destMod->ndac=srcMod->ndac;
|
||||||
destMod->nadc=srcMod->nadc;
|
destMod->nadc=srcMod->nadc;
|
||||||
destMod->nchip=srcMod->nchip;
|
// destMod->nchip=srcMod->nchip;
|
||||||
destMod->nchan=srcMod->nchan;
|
//destMod->nchan=srcMod->nchan;
|
||||||
if (srcMod->reg>=0)
|
if (srcMod->reg>=0)
|
||||||
destMod->reg=srcMod->reg;
|
destMod->reg=srcMod->reg;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -1081,7 +1085,7 @@ int initMCBregisters(int cm, int imod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int initModulebyNumber(sls_detector_module myMod) {
|
int initModulebyNumber(sls_detector_module myMod) {
|
||||||
|
printf("\nInitializing Module\n");
|
||||||
int nchip,nchan;//int ichip, nchip, ichan, nchan;
|
int nchip,nchan;//int ichip, nchip, ichan, nchan;
|
||||||
int im, modmi,modma;
|
int im, modmi,modma;
|
||||||
// int ft, cae, ae, coe, ocoe, counts, chanreg;
|
// int ft, cae, ae, coe, ocoe, counts, chanreg;
|
||||||
@ -1110,6 +1114,7 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//printf("ndac:%d\n",NDAC);
|
//printf("ndac:%d\n",NDAC);
|
||||||
|
|
||||||
for (idac=0; idac<NDAC; idac++){
|
for (idac=0; idac<NDAC; idac++){
|
||||||
retval = setDac(idac,(myMod.dacs)[idac]);
|
retval = setDac(idac,(myMod.dacs)[idac]);
|
||||||
if(retval ==(myMod.dacs)[idac])
|
if(retval ==(myMod.dacs)[idac])
|
||||||
@ -1128,6 +1133,8 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
}
|
}
|
||||||
//setting the conf gain and the settings register
|
//setting the conf gain and the settings register
|
||||||
setSettings(myMod.reg,imod);
|
setSettings(myMod.reg,imod);
|
||||||
|
|
||||||
|
printf("Done Initializing Module\n");
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,15 +124,15 @@ int init_detector(int b) {
|
|||||||
printf("Setting Default Dac values\n");
|
printf("Setting Default Dac values\n");
|
||||||
enum dacNames{VB_COMP,VDD_PROT,VIN_COM,VREF_PRECH,VB_PIXBUF,VB_DS,VREF_DS,VREF_COMP};
|
enum dacNames{VB_COMP,VDD_PROT,VIN_COM,VREF_PRECH,VB_PIXBUF,VB_DS,VREF_DS,VREF_COMP};
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int dacvalues[14][2]={
|
int dacvalues[8][2]={
|
||||||
{VB_DS, 1000},
|
|
||||||
{VB_COMP, 1220},
|
{VB_COMP, 1220},
|
||||||
{VB_PIXBUF, 750},
|
|
||||||
{VREF_DS, 480},
|
|
||||||
{VREF_COMP, 400},
|
|
||||||
{VREF_PRECH,1550},
|
|
||||||
{VIN_COM, 1053},
|
|
||||||
{VDD_PROT, 3000},
|
{VDD_PROT, 3000},
|
||||||
|
{VIN_COM, 1053},
|
||||||
|
{VREF_PRECH,1450},
|
||||||
|
{VB_PIXBUF, 750},
|
||||||
|
{VB_DS, 1000},
|
||||||
|
{VREF_DS, 480},
|
||||||
|
{VREF_COMP, 420},
|
||||||
};
|
};
|
||||||
for(i=0;i<8;++i){
|
for(i=0;i<8;++i){
|
||||||
retval=setDac(dacvalues[i][0], dacvalues[i][1]);
|
retval=setDac(dacvalues[i][0], dacvalues[i][1]);
|
||||||
@ -144,6 +144,9 @@ int init_detector(int b) {
|
|||||||
printf("\nPowering on the chip\n");
|
printf("\nPowering on the chip\n");
|
||||||
bus_w(POWER_ON_REG,0x1);
|
bus_w(POWER_ON_REG,0x1);
|
||||||
|
|
||||||
|
/* Only once */
|
||||||
|
bus_w(CONFGAIN_REG,0x0);
|
||||||
|
|
||||||
printf("Resetting ADC\n");
|
printf("Resetting ADC\n");
|
||||||
writeADC(ADCREG1,0x3); writeADC(ADCREG1,0x0);
|
writeADC(ADCREG1,0x3); writeADC(ADCREG1,0x0);
|
||||||
writeADC(ADCREG2,0x40);
|
writeADC(ADCREG2,0x40);
|
||||||
@ -1456,9 +1459,9 @@ int set_module(int file_des) {
|
|||||||
myModule.nchan=NCHAN*NCHIP;
|
myModule.nchan=NCHAN*NCHIP;
|
||||||
myModule.nadc=NADC;
|
myModule.nadc=NADC;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Setting module\n");
|
printf("Setting module\n");
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
ret=receiveModuleGeneral(file_des, &myModule, 0); //0 is to receive partially (without trimbits etc.)
|
ret=receiveModuleGeneral(file_des, &myModule, 0); //0 is to receive partially (without trimbits etc.)
|
||||||
|
|
||||||
@ -1468,9 +1471,9 @@ int set_module(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("module number is %d,register is %d, nchan %d, nchip %d, ndac %d, nadc %d, gain %f, offset %f\n",myModule.module, myModule.reg, myModule.nchan, myModule.nchip, myModule.ndac, myModule.nadc, myModule.gain,myModule.offset);
|
printf("module number is %d,register is %d, nchan %d, nchip %d, ndac %d, nadc %d, gain %f, offset %f\n",myModule.module, myModule.reg, myModule.nchan, myModule.nchip, myModule.ndac, myModule.nadc, myModule.gain,myModule.offset);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
if (myModule.module>=getNModBoard()) {
|
if (myModule.module>=getNModBoard()) {
|
||||||
@ -2467,7 +2470,6 @@ int send_update(int file_des) {
|
|||||||
retval=setExposureTime(tns);
|
retval=setExposureTime(tns);
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
||||||
retval=setPeriod(tns);
|
retval=setPeriod(tns);
|
||||||
cprintf(RED,"updated frame period from %lld tns:%d\n", (long long int)retval, tns);
|
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
||||||
retval=setDelay(tns);
|
retval=setDelay(tns);
|
||||||
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
n = sendDataOnly(file_des,&retval,sizeof(int64_t));
|
||||||
|
Reference in New Issue
Block a user