tknopp / RedPitayaDAQServer

Advanced DAQ Tools for the RedPitaya (STEMlab 125-14)
https://tknopp.github.io/RedPitayaDAQServer/dev/
Other
34 stars 9 forks source link

Wrapping with calibration offset values #71

Closed jonschumacher closed 7 months ago

jonschumacher commented 7 months ago

With a configured offset value, a wrap-around of the fast DAC data might occur since it is not checked that the addition of the offset values does not exceed the limit of a 14 bit integer. @jusack

jusack commented 7 months ago

Have you checked that its also happening with a calibration offset value? I noticed it happening with a "normal" offset on the fast DAC channel (offsetDAC!(...) set manually) plus a txSlow Channel from MPIMeasurements

jusack commented 7 months ago

A check like this would ideally also include the check that all periodic components (including AW) on a single RP output, do not sum to over 1V at any point in time. However this might be a little bit difficult to catch in the server, since you would have to look at the whole time signal. Is there maybe a way to handle that overflow in the blocks that sum the individual components on the FPGA? And just clip the output signal to 1V if an overflow happens? That would also not be ideal, but it should be safer than wrapping around to -1V.

jonschumacher commented 7 months ago

No, I didn't check that, I just misunderstood you and wanted your issue to be documented ;)

jonschumacher commented 7 months ago

We could have a larger register for the output values and check if they exceed a 14 bit integer at the last stage.

nHackel commented 7 months ago

Yes, I think such a check should be done in the FPGA. I'll have to recheck what format the values are in, at some point we switch from Two's complement to just a binary value for the DAC.

We could even make this hard limit a configuration parameter, similar to the calibDACOffset. Than with something like calibDAC(Positive)Limit we could configure systems to not exceed 0.X V