diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 04d95fc0b..04b091032 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -1502,8 +1502,9 @@ int configureMAC() { } #endif - // get struct memory - udp_header *udp = (udp_header *)(Arm_getUDPBaseAddress()); + // build udp header + udp_header header; + udp_header *udp = &header; memset(udp, 0, sizeof(udp_header)); // mac addresses @@ -1535,6 +1536,14 @@ int configureMAC() { calcChecksum(udp); + // force FPGA writes to be aligned and in order + volatile uint32_t *dst = (volatile uint32_t *)Arm_getUDPBaseAddress(); + uint32_t words[sizeof(udp_header) / sizeof(uint32_t)]; + memcpy(words, udp, sizeof(udp_header)); + for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) { + dst[i] = words[i]; + } + return OK; }