Trigger signal inaccuracies

OS: MacOS Ventura Version 13.3.1 (Processor: Apple M1 (2020))
OS: Win10 Pro (Processor: 12th Gen Intel(R) Core i7-1265U 2.70GHz)
PsychoPy version (e.g. 1.84.x): Psychopy v.2022.2.5
**Standard Standalone?: **yes
What are you trying to achieve?: We want to send trigger signals from PsychoPy to a MEG system via StimTracker (manufacturer Cedrus). Following code is used to send trigger signals:
###Section for setting up StimTracker###
import pyxid2 as pyxid #import usb driver
import time

devices = pyxid.get_xid_devices()
dev = devices[0]
dev.reset_base_timer()
dev.reset_rt_timer()

###Section for sending trigger signals###
dev.set_pulse_duration(10) #define trigger duration to 10ms
dev.activate_line(lines=[1,4]) #send the trigger signal to line 1 and 4

time.sleep(0.01) #wait until the 10ms trigger signal is executed

time.sleep(0.01) # interval of 10ms between trigger signals

Note: ftd2xx (version: 1.4.24) is used to directly access from computer to StimTracker through DLL for MacBook Pro.

Upon inspecting the actual trigger signals generated using an oscilloscope, we saw both variations in time taken for sending trigger signals and interval duration between trigger signals.

What did you try to make it work?:
We suspected that OS might be a reason for the inaccuracies, so we ran the script on Windows. Furthermore, since the MacBook Pro uses a USB hub to connect to StimTracker, we also tested whether removing the USB hub solves the issue on the Windows computer.

What specifically went wrong when you tried that?:
We found the millisecond inaccuracies in all three cases (on macOS, Windows 10 pro, and Windows 10 Pro with USB hub). This inaccuracy is problematic since these errors accumulate for each trial which results in significant variation in trigger timing.