Commit e3dc8d57 authored by Michel Arruat's avatar Michel Arruat Committed by Federico Vaga

adc_driver: channel signal transmisson delay conpensation

Trigger and channel signals are not going through the
same path on the board and trigger is faster.
Trying to sample the trigger itself by connecting
it to a channel, one can see a delay of 20ns between trigger and
its sampling. The compensation is done by delaying the trigger by 2
sample tick (2*10ns)
parent 427203c7
......@@ -363,6 +363,12 @@ static int __fa_init(struct fa_dev *fa)
fa_writel(fa, fa->fa_utc_base, &zfad_regs[ZFA_UTC_SECONDS],
get_seconds());
/*
* Set Trigger delay in order to compensate
* the channel signal transmission delay
*/
fa_writel(fa, fa->fa_utc_base, &zfad_regs[ZFAT_DLY], FA_CH_TX_DELAY);
/* disable auto_start */
fa->enable_auto_start = 0;
return 0;
......
......@@ -129,6 +129,11 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
* acquisition or other problems:
*/
break;
case ZFAT_DLY:
/*
* Add channel signal transmision delay
*/
tmp_val += FA_CH_TX_DELAY;
}
fa_writel(fa, fa->fa_adc_csr_base, &zfad_regs[zattr->id], tmp_val);
......
......@@ -363,7 +363,18 @@ struct zfad_block {
unsigned int first_nent;
};
#define FA_CAL_OFFSET 0x0100 /* Offset in EEPROM */
/*
* Channel signal transmission delay
* Trigger and channel signals are not going through the
* same path on the board and trigger is faster.
* Trying to sample the trigger itself by connecting
* it to a channel, one can see a delay of 20ns between trigger and
* its sampling. This constant is added to the trigger delay to
* conpensate the channel signal transmission delay.
* Expressed in tick count 2*10ns = 20ns
*/
#define FA_CH_TX_DELAY 2
#define FA_CAL_OFFSET 0x0100 /* Offset in EEPROM */
#define FA_CAL_NO_OFFSET ((int16_t)0x0000)
#define FA_CAL_NO_GAIN ((uint16_t)0x8000)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment