09-01-2020, 10:27 AM
TTL (parallel port) signalling remains one of the most common techniques for synchronizing different recording devices. Understanding how it works, and how it can be used to synchronize EyeLink systems with other devices such as EEG and fMRI scanners will help you troubleshoot any issues you may be having.
Background:
TTL stands for Transistor-Transistor Logic - paired transistors allow voltage to be rapidly changed between <0.8v ("low" or 0) or > 2.4v. ("high" or 1). Nowadays the term TTL is often used to refer to the signal itself, rather than the mechanism behind it.
In the simplest form of TTL integration, a stimulus PC sends TTLs that mark the onsets of critical trial events. The TTL signals are sent (via a splitter or "Y" cable) to both the Host PC and the other biometric device. Thus both datastreams receive common event markers which can be used to synchronize the data at the analysis stage. An alternative strategy is to send a TTL to the biometric device, and a simultaneous message (via the ethernet link) to the Host PC. The two approaches are illustrated below:
Note that in both instances a TTL is being sent to the EEG recording equipment. This TTL is either being split and sent to the EyeLink Host PC (route 1) or alternatively is accompanied by a simultaneous message, sent to the Host PC via the ethernet link (route 2). In either case, it helps to understand the basics of TTL signalling.
Parallel Ports:
Computers typically send TTLs via a Parallel Port - an increasingly rare feature that in the past was mainly used for communicating with line-printers - indeed it is still often referred to as the LPT port. Whilst TTL technology has a long history, and may seem increasingly out-dated, it remains a popular means by which to integrate equipment in laboratories - not least because it is "tried and tested" and has excellent and reliable timing properties.
Early motherboards often had a proper Parallel Port built in. More recent motherboards often don't have a port, but they have a "header" so one can be easily added.
Unfortunately, many current motherboards do not even have header pins. However, devices such as the USB2TTL8 provide the same functionality, with the same excellent timing properties.
Parallel Port Pins and Registers:
Parallel Ports have 25 pins, and are "D" shaped. Consequently, the ports (and cables that connect to them) are sometimes referred to as D-Sub25 or DB25. The pinout diagram below illustrates the functions of the 25 pins.
The first 3 sets of pins are also known as "Registers". Importantly these registers have addresses in computer memory (e.g. Data Register is often 0x378, Status = 0x379 and Control = 0x37A). You can find the address of your parallel port in Windows via the Device Manager:
The first value shown is the address (in Hex) for the Data register. The Status Register address is one higher (So 0x379 in the example above) and the Control Register is one higher than that (0x37A).
TTL Signalling:
You can write a byte (a value between 0 and 255) to these addresses, with corresponding consequences for the voltage level of the pins belonging to that register. For example writing the value 13 to the data register will turn pins 2,4 and 5 "High", because 13 in binary is 00001101. The exact syntax used to write a byte to the parallel port will depend on your stimulus presentation software.
Note that whilst the data pins make an entire byte, the status pins are the "highest" 5 bits of a byte and the control pins are the "lowest" 4 bits of a byte. This is one reason why TTL signalling is generally done via the Data Register.
One important consideration is whether the TTL needs to be cleared (e.g. all pins set back to 0) and if so, how soon this clearing signal should be sent. For many devices, clearing the signal (by writing a 0) after 20ms should work.
Trigger Cables:
Many biometric devices, including all popular EEG systems, will accept TTL input of some sort or another. The Desktop versions of EyeLink Host PCs accept TTL input on their parallel ports, and provided that the system has been configured to expect input on the data pins (see below) a standard "straight-through" parallel port cable (DB25-DB25 cable) can be used.
In the most basic form of TTL integration, the TTL is split - so that it can be received by both the EyeLink Host PC and the other biometric device. A simple DB25 Splitter cable, such as the one below can be used.
Depending on the biometric equipment used, a proprietary "Trigger" cable may be required. These cables typically have a DB25 connector at one end (the end that joins to the DB25 Splitter cable, or directly to the Parallel Port of the Stimulus PC) and a connector at the other end designed to fit with the "Trigger Input" socket on the device itself. Users should contact the relevant manufacturers to ensure that they have a suitable trigger cable for their device.
Setting bidirectional mode:
By default, Data is output / sent by writing a byte to the Data pins. But parallel ports are generally expecting data to be input / received on the status pins. Telling a parallel port that it should expect to receive data on the data pins can be done via the control register:
If you are sending TTLs to the parallel port on the Host PC, you need to make sure that the Host PC has been configured correctly. The relevant commands are in buttons.ini, but for convenience it is usually simplest to paste the relevant lines into FINAL.INI. For the EyeLink 1000 Plus use the following lines:
For the EyeLink 1000, change the first line to
A quick way to check whether the Host PC is receiving the TTLs is to put the Host Software into Offline mode. The TTLs will appear as numbers towards the bottom right of the screen. Alternatively, you can record some data and open the EDF file in Data Viewer. With the Toggle Input Event Visibility button selected, the input events are visible as grey squares in the spatial overlay view, or grey flags in the temporal view. Finally, you can convert the EDF file to ASCII, and check for INPUT events.
If having configured things correctly in FINAL.INI you are still not seeing the TTLs appear on the Host PC / in the EDF Files, it may be worth checking that the parallel port has been configured correctly in the BIOS settings. Instructions for accessing the BIOS differ from computer to computer, but typically hitting the Del or F12 key during the boot process will bring up the BIOS settings. The exact location of the relevant settings may depend on the BIOS version, but in general, the parallel port mode should be set to EPP or ECP / EPP. Please take care to only change the relevant parallel port settings. Please contact support@sr-research.com if you require assistance.
Background:
TTL stands for Transistor-Transistor Logic - paired transistors allow voltage to be rapidly changed between <0.8v ("low" or 0) or > 2.4v. ("high" or 1). Nowadays the term TTL is often used to refer to the signal itself, rather than the mechanism behind it.
In the simplest form of TTL integration, a stimulus PC sends TTLs that mark the onsets of critical trial events. The TTL signals are sent (via a splitter or "Y" cable) to both the Host PC and the other biometric device. Thus both datastreams receive common event markers which can be used to synchronize the data at the analysis stage. An alternative strategy is to send a TTL to the biometric device, and a simultaneous message (via the ethernet link) to the Host PC. The two approaches are illustrated below:
Note that in both instances a TTL is being sent to the EEG recording equipment. This TTL is either being split and sent to the EyeLink Host PC (route 1) or alternatively is accompanied by a simultaneous message, sent to the Host PC via the ethernet link (route 2). In either case, it helps to understand the basics of TTL signalling.
Parallel Ports:
Computers typically send TTLs via a Parallel Port - an increasingly rare feature that in the past was mainly used for communicating with line-printers - indeed it is still often referred to as the LPT port. Whilst TTL technology has a long history, and may seem increasingly out-dated, it remains a popular means by which to integrate equipment in laboratories - not least because it is "tried and tested" and has excellent and reliable timing properties.
Early motherboards often had a proper Parallel Port built in. More recent motherboards often don't have a port, but they have a "header" so one can be easily added.
Unfortunately, many current motherboards do not even have header pins. However, devices such as the USB2TTL8 provide the same functionality, with the same excellent timing properties.
Parallel Port Pins and Registers:
Parallel Ports have 25 pins, and are "D" shaped. Consequently, the ports (and cables that connect to them) are sometimes referred to as D-Sub25 or DB25. The pinout diagram below illustrates the functions of the 25 pins.
The first 3 sets of pins are also known as "Registers". Importantly these registers have addresses in computer memory (e.g. Data Register is often 0x378, Status = 0x379 and Control = 0x37A). You can find the address of your parallel port in Windows via the Device Manager:
The first value shown is the address (in Hex) for the Data register. The Status Register address is one higher (So 0x379 in the example above) and the Control Register is one higher than that (0x37A).
TTL Signalling:
You can write a byte (a value between 0 and 255) to these addresses, with corresponding consequences for the voltage level of the pins belonging to that register. For example writing the value 13 to the data register will turn pins 2,4 and 5 "High", because 13 in binary is 00001101. The exact syntax used to write a byte to the parallel port will depend on your stimulus presentation software.
Note that whilst the data pins make an entire byte, the status pins are the "highest" 5 bits of a byte and the control pins are the "lowest" 4 bits of a byte. This is one reason why TTL signalling is generally done via the Data Register.
One important consideration is whether the TTL needs to be cleared (e.g. all pins set back to 0) and if so, how soon this clearing signal should be sent. For many devices, clearing the signal (by writing a 0) after 20ms should work.
Trigger Cables:
Many biometric devices, including all popular EEG systems, will accept TTL input of some sort or another. The Desktop versions of EyeLink Host PCs accept TTL input on their parallel ports, and provided that the system has been configured to expect input on the data pins (see below) a standard "straight-through" parallel port cable (DB25-DB25 cable) can be used.
In the most basic form of TTL integration, the TTL is split - so that it can be received by both the EyeLink Host PC and the other biometric device. A simple DB25 Splitter cable, such as the one below can be used.
Depending on the biometric equipment used, a proprietary "Trigger" cable may be required. These cables typically have a DB25 connector at one end (the end that joins to the DB25 Splitter cable, or directly to the Parallel Port of the Stimulus PC) and a connector at the other end designed to fit with the "Trigger Input" socket on the device itself. Users should contact the relevant manufacturers to ensure that they have a suitable trigger cable for their device.
Setting bidirectional mode:
By default, Data is output / sent by writing a byte to the Data pins. But parallel ports are generally expecting data to be input / received on the status pins. Telling a parallel port that it should expect to receive data on the data pins can be done via the control register:
If you are sending TTLs to the parallel port on the Host PC, you need to make sure that the Host PC has been configured correctly. The relevant commands are in buttons.ini, but for convenience it is usually simplest to paste the relevant lines into FINAL.INI. For the EyeLink 1000 Plus use the following lines:
Code:
write_ioport 0xA 0x20
create_button 1 8 0x01 0
create_button 2 8 0x02 0
create_button 3 8 0x04 0
create_button 4 8 0x08 0
create_button 5 8 0x10 0
create_button 6 8 0x20 0
create_button 7 8 0x40 0
create_button 8 8 0x80 0
input_data_ports = 8
input_data_masks = 0xFF
For the EyeLink 1000, change the first line to
Code:
write_ioport 0x37A 0x20
A quick way to check whether the Host PC is receiving the TTLs is to put the Host Software into Offline mode. The TTLs will appear as numbers towards the bottom right of the screen. Alternatively, you can record some data and open the EDF file in Data Viewer. With the Toggle Input Event Visibility button selected, the input events are visible as grey squares in the spatial overlay view, or grey flags in the temporal view. Finally, you can convert the EDF file to ASCII, and check for INPUT events.
If having configured things correctly in FINAL.INI you are still not seeing the TTLs appear on the Host PC / in the EDF Files, it may be worth checking that the parallel port has been configured correctly in the BIOS settings. Instructions for accessing the BIOS differ from computer to computer, but typically hitting the Del or F12 key during the boot process will bring up the BIOS settings. The exact location of the relevant settings may depend on the BIOS version, but in general, the parallel port mode should be set to EPP or ECP / EPP. Please take care to only change the relevant parallel port settings. Please contact support@sr-research.com if you require assistance.