Skip to content

added measure frequency and Mk2 libraries#54

Merged
newville merged 22 commits intoepics-modules:masterfrom
TomQD-94:Mk2
Sep 17, 2025
Merged

added measure frequency and Mk2 libraries#54
newville merged 22 commits intoepics-modules:masterfrom
TomQD-94:Mk2

Conversation

@TomQD-94
Copy link
Contributor

This is a branch to allow using the community EPICS with Mk2 hardware.

Measures frequency of the clock to generate the right time frame for the acquisition time.

Updates to libraries for updates to firmware.

@newville
Copy link
Contributor

@TomQD-94 Thanks - the timing parts look okay to me.

I'm not sure what the MOD_IMAGE and MOD_IMAGE3D changes mean. What are these for?

@newville
Copy link
Contributor

@TomQD-94 Is this ready for merge?

@TomQD-94
Copy link
Contributor Author

TomQD-94 commented Aug 6, 2024

@TomQD-94 Is this ready for merge?

I think now it is ready but would prefer a test from someone else to ensure I haven't forgotten something. Perhaps when I have confirmed it works with the shipped systems at your facility we can merge it in.

TomQD-94 and others added 15 commits October 3, 2024 15:07
remove superfluous logging
Feature/ttl internal.

TTL start the frame with provided frame length from itfg
* bzip-devel to bzip2-devel

* erase maximum of requested (next run) and actual (last run) frames, avoiding errorenous timing values

* disable circular buffers for GSE ioc

* tweak GSE-7elem config

* trim scalars saved by default via XML file, but add 'full' XML config

* add short (25ms) sleep before checking if frame 0 acquire is done

* Bring the iocDualMini_4ch IOC up-to-date, using the common startup files

---------

Co-authored-by: Matt Newville <newville@cars.uchicago.edu>
Co-authored-by: Tejas Guruswamy <tguruswamy@anl.gov>
@TomQD-94 TomQD-94 marked this pull request as ready for review September 9, 2025 09:59
Copy link

@BenBradnick BenBradnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just needs a bit of a tidy up to not lose the default configuration for IOCs.

Comment on lines +4 to +5
dbpf("$(PREFIX)det1:NumImages", 1000)
dbpf("$(PREFIX)det1:AcquireTime", 1)

This comment was marked as resolved.

Comment on lines 52 to 53
# dbpf("$(PREFIX)det1:CONFIG_PATH", "/etc/xspress3/calibration/initial")
dbpf("$(PREFIX)det1:CONFIG_PATH", "$(SUPPORT)/../xspress3_settings/current/")
dbpf("$(PREFIX)det1:CONFIG_PATH", "/home/xspress3/xspress3_settings/4channel")

This comment was marked as resolved.


# Number of xspress3 cards and IP ADDR
epicsEnvSet("XSP3CARDS", "1")
epicsEnvSet("XSP3CARDS", "2")

This comment was marked as resolved.

# card0_clocks.dat, chan1_reion0.dat, etc
# dbpf("$(PREFIX)det1:CONFIG_PATH", "/etc/xspress3/calibration/initial")
dbpf("$(PREFIX)det1:CONFIG_PATH", "$(SUPPORT)/../xspress3_settings/current/")
dbpf("$(PREFIX)det1:CONFIG_PATH", "$(SUPPORT)/../xspress3_settings/4channel/")

This comment was marked as resolved.

}
plotcom {
title="Last Frame"
title="Last Fram"

This comment was marked as resolved.

}

printf("xsp3_clocks_setup: Measured frequency %.2f MHz\n", float(xsp3_status)/1.0e6);
// TODO: XSP4_CLK_SRC_MIDPLN_LMK61E2 for Mk2 systems

This comment was marked as resolved.

Comment on lines +401 to +403
xsp3_status = xsp3->clocks_setup(xsp3_handle_, -1, generation == 3 ? XSP3M_CLK_SRC_LMK61E2 : (generation == 2 ? ((mark == 2) ? XSP4_CLK_SRC_MIDPLN_LMK61E2 : XSP3M_CLK_SRC_CDCM61004) : XSP3_CLK_SRC_XTAL),
XSP3_CLK_FLAGS_MASTER | XSP3_CLK_FLAGS_NO_DITHER, 0);
if (xsp3_status < 0) {

This comment was marked as resolved.

Comment on lines 1204 to 1212
// TODO Is this needed for Mk2?
// u_int32_t actual_trigger_mode;
// xsp3_get_glob_timeA(xsp3_handle_, card, &actual_trigger_mode);
// }
// int xsp3_status = xsp3->set_sync_mode(xsp3_handle_, XSP3_SYNC_MIDPLANE, 0 , 0);
// if (xsp3_status != XSP3_OK) {
// checkStatus(xsp3_status, "xsp3_set_sync_mode", functionName);
// status = asynError;
}

This comment was marked as resolved.

@TomQD-94 TomQD-94 requested a review from BenBradnick September 9, 2025 15:04
@BenBradnick
Copy link

@TomQD-94 Thanks - the timing parts look okay to me.

I'm not sure what the MOD_IMAGE and MOD_IMAGE3D changes mean. What are these for?

Almost all of the changes are just renaming data_float to data_type and changing some types from int to size_t. There are a couple of new functions added but I don't think these are used in the current Xspress library from a quick check.

The data module library is a generic library so it is used in many device libraries.

@TomQD-94
Copy link
Contributor Author

TomQD-94 commented Sep 10, 2025

Branch ready for merge.
Adds TTL start internal frame trigger mode,
Adds Mk2 and Mk1 compatability with clock frequency check
also removes repeated called noted in issue. Resolves #56

@TomQD-94
Copy link
Contributor Author

@newville Please review and suggest any changes you want to this before merging in. Thanks

@newville
Copy link
Contributor

@TomQD-94 Will this solve #56?

I added some workarounds in the code (and would have merged the related #62).

Do you think those added sleeps are no longer needed?

It would be really good to know how these things could be better tested with various Xspress3 generations.

@BenBradnick
Copy link

Hi @newville I have commented on your issue (#60) - I was unable to reproduce it here. If you still get the issue when testing this branch (and commenting out your original sleep) then I don't think #62 will cause any issues for systems which don't have the problem.

#56 should be resolved as the repeated call has been removed and we haven't identified any problems during testing so far.

@newville
Copy link
Contributor

@TomQD-94 @BenBradnick OK, as discussed at #60, I think we should merge this, and I'll see if something specific to "very old Xspress3" requires the "sleep" discussed there and at #56.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants