Open krmpotic opened 2 years ago
The problem is that FPGA clears the sequence trigger bits of 0x500 (Front Panel 0 Input Mapping Register) while writing zero to 0x504 (Front Panel 1...).
It happens like this: After
dbpf MRF:{EVM1-SoftSeq:0}TrigSrc-Sel "Front0"
dbpf MRF:{EVM1-SoftSeq:0}Load-Cmd 1
dbpf MRF:{EVM1-SoftSeq:0}Commit-Cmd 1
EvgSeqManager::mapTriggerSrc(0,** 0x2010000)
gets called.
In order to assure that only "Front0" evgInput is triggering the sequence, it goes through all the evgInputs, and if the evgInput is "Front0" (match == true
) it sets sequence trigger bit SEQ0
, else it clears it.
When clearing the SEQ0 bit of 0x504 (FP1), bit SEQ0 of 0x500 (FP0) also gets cleared. So function doesn't achieve what it wanted because of FPGA behavior.
To see what the FPGA is doing do the following:
# EPICS IOC shell
pcidiagset 13 # <--- change 13 to bus number of your EVM
pciwrite 32 0x500 0x100 # <-- set SEQ0 bit of FP0 mapping register
pciread 32 0x500 # 0x100
pciwrite 32 0x504 0 # <-- clear SEQ0 bit of FP1 mapping register
pciread 32 0x500 # gives 0!
it is interesting that setting (instead of clearing) the SEQ0 bit of 0x504 doesn't affect 0x500.
pciwrite 32 0x500 0x100 # <-- set SEQ0 bit of FP0 mapping register
pciread 32 0x500 # 0x100
pciwrite 32 0x504 0x100 # <-- set SEQ0 bit of FP1 mapping register
pciread 32 0x500 # still 0x100
P.S. EVM is running firmware 207.c
0x500, 0x504... 0x50C refer to the same register.
First EvgSeqManager::mapTriggerSrc
sets SEQ0 at 0x500, then clears SEQ0 at 0x504. Effectively undoing its work.
My PR still needs to solve the problem of evgDbus.db
evgTrigEvt.db
hardcoding FrontInp0 & FrontInp1. For mtca-evm-300 there shouldn't be a reference to FrontInp1.
@krmpotic , is this issue still valid? Could you redo the test with "Front1"?
Setting SoftSeq*TrigSrc-Sel PV to "Front0" does not cause the sequence to be triggered by front panel input. What is missing is setting the EVM 0x500 register's bit 8 (FP0SEQ0) (and bit 9 FP0SEQ1, for "Front1").
Example test procedure (mTCA-EVM-300):
sequence with three events 3
caput -a MRF:{EVM1-SoftSeq:0}Timestamp-SP 4 0 100000 150000 200000 caput -a MRF:{EVM1-SoftSeq:0}EvtCode-SP 4 3 3 3 127
enable sequence
caput MRF:{EVM1-SoftSeq:0}TrigSrc-Sel "Front0" caput MRF:{EVM1-SoftSeq:0}RunMode-Sel "Normal" caput MRF:{EVM1-SoftSeq:0}Load-Cmd 1 caput MRF:{EVM1-SoftSeq:0}Commit-Cmd 1 caput MRF:{EVM1-SoftSeq:0}Enable-Cmd 1
only after step 5 does MRF:{EVR1}EvtBCnt-I start increasing