epics-modules / asyn

EPICS module for driver and device support
http://epics-modules.github.io/asyn/
Other
37 stars 75 forks source link

mbboDirect with asyn:READBACK is not processed #207

Closed exzombie closed 3 months ago

exzombie commented 3 months ago

With the database below, combined with a driver that periodically calls setUIntDigitalParam() and callParamCallbacks() for the RANDOM reason, the first record is processed, while the second is not. If it's relevant, I tried setting both valueMask and interruptMask parameters to setUIntDigitalParam() to 0xffff.

record(longout, "$(user):random1") {
    field(DTYP, "asynUInt32Digital")
    field(OUT, "@asynMask($(port),0,0xffff) RANDOM")
    info(asyn:READBACK, 1)
}

record(mbboDirect, "$(user):random2") {
    field(DTYP, "asynUInt32Digital")
    field(OUT, "@asynMask($(port),0,0xffff) RANDOM")
    info(asyn:READBACK, 1)
}
exzombie commented 3 months ago

Correction, the record $(user):random2 is processed, but VAL remains unchanged. The change ends up in RVAL and is not propagated to VAL and B0-B1F.

MarkRivers commented 3 months ago

It appears that the same block of code that sets RVAL also then sets VAL. https://github.com/epics-modules/asyn/blob/33a66b58732521ee176b28dfeb9ebc1e2e985e47/asyn/devEpics/devAsynUInt32Digital.c#L1088

Can you add some debugging there to see why VAL is not changing?

exzombie commented 3 months ago

What happens there is that RVAL is set from the callback result, then VAL is set, bit by bit, based on values of B1-B1F. RVAL is not considered, and bits are zero, so VAL stays at zero. Given that this piece of code is intended specifically for handling callbacks, that should be turned around, no? VAL should be set from RVAL (after a shift), and B1-B1F should be set from VAL.