Serial trigger to BrainVision TriggerBox stops working after OS upgrade (Windows 11)I

Dear Community,

Current environment:

  • Windows 11

  • Psychtoolbox-3 (3.0.22.1)

  • MATLAB R2025b

Previous environment:

  • Windows 10

  • Psychtoolbox-3 (3.0.19.3)

  • MATLAB R2023

We run an EEG experiment using BrainVision equipment (actiAmp, TriggerBox, Recorder). All experimental code is written in MATLAB, and the experiment had been running without any issues in the previous environment.

Recently, we updated the OS from Windows 10 to Windows 11 and reinstalled all related software (MATLAB R2025b, the latest Psychtoolbox, BrainVision TriggerBox software, etc.). After this update, the code now freezes at the point where a trigger is sent to the TriggerBox.

Specifically, after sending the trigger, MATLAB becomes unresponsive—there is no output, no error message, and even attempting to stop execution does not work.

Here is the relevant code flow:

>> [handle, ~] = IOPort('OpenSerialPort', 'COM3');
IOPort - Info: Configuration for device COM3:
IOPort - Info: Current baud rate is 9600
IOPort - Info: Baud rate changed to 9600

>> IOPort('Write', handle, uint8(0), 1);


In addition, after restarting the computer, there are occasions when we cannot even run the first line that opens the serial port. I have attached a screenshot showing the error message we receive in that case below:

What we have tried:

  • Verified the COM port number after the OS update (previously COM5, now COM3)

  • Tested older versions of Psychtoolbox (e.g., 3.0.18.10 and 3.0.19.3)

  • Changed the baud rate to 115200

Unfortunately, none of these attempts resolved the issue.

At this point, the only differences between the working and non-working setups are the Windows OS version and the Psychtoolbox version. Does anyone have suggestions on what might be causing this issue, or how we might further troubleshoot it?

Thank you very much for your time and help.

As far as I can see, you do everything right, and it is most likely a problem caused by the upgrade from Windows 10 to Windows 11, not anything else. Looking at our source code, the specific error patterns and messages should not be possible unless the serial device itself is misconfigured or has some driver problems. Error code 87 is “Invalid parameter” for the SetCommTimeouts() win32 operating system function, but given the code execution flow, it should be impossible to pass in invalid parameters on correctly working driver + hardware.

Is this a standard native serial port or a USB-to-serial converter? An internet search suggests that some older models of such converters may have device drivers incompatible with Windows 11, or will need driver updates for Windows 11, cfe.

So maybe that would be something to check - if your converter is unsupported on Windows 11 or needs a driver update? What model is it?

Update: I see the Triggerbox provides its own USB-Serial virtual com port drivers. Looking at that website and docs, your setup is correct for the old triggerbox. Some later revisions require a Baud rate of 2 Mbit/s, ie. their sample code tells to set that mode up like this:

TB = IOPort('OpenSerialPort', 'COM22','BaudRate=2000000');

That said, I’d make sure to have the latest triggerbox software from BrainProducts installed, and that their own test tools works.

Thank you for the insights! And yes, Triggerbox provides its own USB-Serial virtual com port drivers—I should have mentioned that earlier.

I tried setting the baud rate to 2 Mbit/s, but there is still no response after calling
IOPort("Write", handle, uint8(0), 1);

I checked the driver version and it is old (18.44.30.296), so I will try updating it to the latest version and see if that resolves the issue.

Hi,

I’m using Matlab serial port functions with NeuroSpec Box (instead of incredibly expensive BP trigger box). But in principle, the serial port functions are independent of BP.

Open port:

function port_handle = open_serial_port(port_nb)

% Open the serial/COM port. 

% portnb: number of the port to open (optional). Default is 4.

if nargin == 0

    port_nb = 4;

end

port_string = ['COM' num2str(port_nb)];

if isMATLABReleaseOlderThan('R2024a', 'release')

    port_handle = serial(port_string);

    set(port_handle,'BaudRate',9600); % 9600 is recommended by Neurospec

    fopen(port_handle);

else

    port_handle = serialport(port_string, 9600);

% in order to speed up function isMATLABReleaseOlderThan, let it run 10

% times

for i = 1 : 10

        isMATLABReleaseOlderThan('R2024a', 'release');

end

end

Sending trigger:

function send_serial_trigger(trigger_val, port_handle)

% Sends a trigger. trigger_val: value to be sent. Default is 1.

if nargin == 0

    trigger_val = 1;

end

if isMATLABReleaseOlderThan('R2024a', 'release')

    fwrite(port_handle, trigger_val);

else

    write(port_handle, trigger_val, "uint8");

end

Closing the port:

function close_serial_port(port_handle)

% Close the serial/COM port. port_handle: opened previously with open_ns_port.

if isMATLABReleaseOlderThan('R2024a', 'release')

    fclose(port_handle);

    delete(port_handle);

else

    configureCallback(port_handle, "off");

    delete(port_handle);

end

clear port_handle

Works on Windows 10 + 11, Matlab 2022b to 2025b.

I don’t understand how this relates to the OP’s problem with a BrainVision TriggerBox? Also Matlab’s serial functions are less portable and not optimized for neuroscience applications.