Jump to content

Contributions:NeuralynxADC

From BCI2000 Wiki
NeuraLynx

Synopsis

The NeuralynxNetComADC allows data acquisition from Neuralynx Cheetah or Pegasus system.
The module is able to record data with two different modes:
(1) Acquisition via the NetCom interface, which connects to Cheetah/Pegasus.
(2) Low-latency data acquisition via a fiber cable directly connected to the Acquisition amplifier.

Known Issues

This module requires the VS2012 C++ runtime to be installed (https://www.microsoft.com/en-us/download/details.aspx?id=30679). If the runtime is not installed you will get an error for a missing DLL!

Location

Versioning

Authors

Markus Adamek

Version History

Source Code Revisions

  • Initial development: 6024
  • Tested under: 9096
  • Known to compile under: 9096
  • Broken since: --

Hardware Configuration

This Acquisition module has two ways to stream data from a Pegasus/Cheetah System.

Acquisition via the NetCom Interface

To acquire data via the NetCom interface the experimental Computer (Running BCI2000) has to be connected to the Pegasus/Cheetah System (Running the Acquisition Software) via Ethernet.

(1) Make sure that both computers are on the same subnet and that the Acquisition Software is running on the Pegasus/Cheetah System (You don't need to start an acquisition or recording).
(2) Configure BCI2000 with the correct IP address (ServerName). Be aware that the Pegasus/Cheetah System has multiple Network ports!
(3) After pressing Set Config in BCI2000 it should seamlessly connect to the Pegasus/Cheetah System. BCI2000 will automatically start data acquisition.
You can check if BCI2000 has connected correctly by opening the Acquisition System Status on the Pegasus/Cheetah System. In this window you should see a field called NetCom Clients. If BCI2000 is connected, it should be listed.

Acquisition via low-latency connection

The low-latency stream allows us to tap directly into the data streamed from the ADC without the Pegasus/Cheetah System. This approach significantly reduces latency and increases the stability of the timebase. While data is streamed directly from the amplifier, configuration still requires the Pegasus/Cheetah System and connection via the NetCom interface. You can follow the steps above to ensure that you are able to connect to the NetCom Interface.

The low-latency stream requires direct connection to the amplifier via a fiber optic ethernet connection. Therefore, the BCI2000 computer requires an optical ethernet interface.

The optical ethernet card has to be configured identical to the card installed in the Pegasus/Cheetah System (see (5) below). This requires an optical ethernet card that matches the specifications of the card installed in the Neuralynx computer. Unfortunately, the exact optical ethernet card that is installed in many Neuralynx computers is no longer manufactured. Some alternate options have been tested with varying results - we recommend the Intel X710-DA2 optical ethernet card to effectively stream data from the Neuralynx amplifier to the BCI2000 computer. This needs to be compatible with your motherboard. Also, a FiberChannel compatible optical transceiver is required to match the card's SFP interface to the fiber cable.

Once the fiber cable is in place, follow these steps:

(1) Obtain the IP address, subnet mask as well as the MAC address. To get this information open a command window on the Pegasus/Cheetah System (To find the command prompt type cmd in the Windows search bar). Type ipconfig -all which will give you information of all Network adapters. You will need to find the physical port that connects the amplifier with the Pegasus/Cheetah System. A good way to ensure that you chose the correct adapter is to turn of the amplifier and check which adapter changed. Your result might look different than the example below.

Ethernet adapter Ethernet:
  Connection-specific DNS Suffix  . :
  Description . . . . . . . . . . . : Intel(R) Ethernet Server Adapter I350-F2
  Physical Address. . . . . . . . . : 48-2A-E3-40-45-DB
  Link-local IPv6 Address . . . . . : fe80::cc21:7e8e:f65a:158e%11
  IPv4 Address. . . . . . . . . . . : 172.20.2.144
  Subnet Mask . . . . . . . . . . . : 255.255.0.0
  Lease Obtained. . . . . . . . . . : Wednesday, July 15, 2020 8:25:32 AM
  Lease Expires . . . . . . . . . . : Thursday, July 16, 2020 8:25:25 AM
  Default Gateway . . . . . . . . . : 172.20.1.1
  DHCP Server . . . . . . . . . . . : 172.20.1.1
  DHCPv6 IAID . . . . . . . . . . . : 105392867
  DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-24-67-EF-14-48-2A-E3-40-45-DB
  DNS Servers . . . . . . . . . . . : 172.20.1.1
  NetBIOS over Tcpip. . . . . . . . : Enabled

You will need the information shown in Physical Address (MAC address), IPv4 Address, and Subnet Mask.

(2) Change the settings of the fiber card Network Adapter on your BCI2000 machine. To change the MAC address you can use a tool like the Technitium MAC Address Changer. Make sure that you are changing the correct Network connection!

(3) Replace your current MAC address with the Physical Address obtained from the Pegasus/Cheetah System. To change IP address and Subnet mask you can follow a tutorial like this one:Change IP Address (Start at step 3) .

(4) Connect the BCI2000 computer to the Amplifier with an appropriate fiber cable. The BCI2000 machine should be connected via the free fiber-cable ethernet port on the amplifier. Make sure that you plugged the fiber cable into the free port on the amplifier and not the free fiber port on the Pegasus/Cheetah System.

(5) Adapt "Advanced" options of your optical ethernet card in the Device Manager to the following values:

  • Flow control: Disabled,
  • Jumbo Packet: 9014 bytes,
  • Receive Buffers: 4096,
  • Transmit Buffers: 4096.

(6) Check if the data gets streamed to the BCI2000 computer. If you have configured everything correctly, data should now be streamed to your computer if the acquisition is started on the Pegasus/Cheetah System. The easiest way to check this is to open the Task Manager (Ctrl+Shift+Esc) on the BCI2000 system. In the performance tab, you can monitor incoming and outgoing traffic on your network adapters. If you were successful, you should see a steady inflow of data on the ethernet port which connects your computer to the amplifier. If you are unsure, open the task manager on the Pegasus/Cheetah System, you should see the same type of data usage.

(7) Start BCI2000 and enable UseDirectUDPStream for the Low-Latency stream. If you have issues, consider that the Pegasus software may sometimes exit by itself. Always make sure that the Pegasus software is running before starting BCI2000.

Parameters

Signal Properties

Signal Properties describe Settings common to most Amplifiers.

  • SourceCh: The number of channels that the Neuralynx software reads.
  • SampleBlockSize: Samples per channel per digitized block. Together with the sampling rate, this parameter determines how often per second data is collected, processed, and feedback is updated.
  • SamplingRate: Sampling rate of the data. The SamplingRate has to be an integer fraction of 32kHz.
  • ChannelNames: List of Names for Channels. Space-separated list; Must be the same length as Number of Channels. If set to auto, BCI2000 will query the Names from the Neuralynx system.
  • SourceChOffset: Setting is not used in this module, default is 0
  • SourceChGain: This is also not used, default is 1

NeuralynxNetCom

This Section describes Settings Necessary to communicate with the Cheetah/Pegasus System via the NetCom Interface

  • ServerName: IP Address of the NetCom server (Typically the IP of your Cheetah/Pegasus System)

NeuralynxUDPStream

Settings if you want to use the Low Latency Stream. This requires a fiber-optic connection between the Amplifier and the BCI2000 computer.

  • Boards: The Number of Boards which are connected in the Neuralynx Chassis
  • SourceChnList: List of transmitted Channels. This allows you to only submit a subset of Channels. Its a list of channel ids (starting from 0). If set to auto, all channels will be transmitted.
  • UseDirectUDPStream: Easy way to switch the UDP stream on or off. This has to be enabled for low latency communication
  • UDPStreamPort: Port through which the BCI2000 computer receives data from the Neuralynx System. This port is provided by Neuralynx.
  • DecimationFactor: Decimation Factor for incoming Data. Incoming Data is sampled at 32kHz. If Decimation Factor is set, SamplingRate has to match or has to be set to auto. similarly, if SamplingRate is set, DecimationFactor can be set to auto and the system will determine the correct decimation factor automatically. Downsampling is done after an antialiasing filter (4th order IIR, 2/3 f_Nyquist) is applied to the original signal. The filter depends on the decimation factor.
  • NRDStreamingFile: Leave Empty. This can be used to stream data from a Neuralynx NRD file for debugging purposes.

States

NeuralynxTimestamp

This is a truncated version of a 64 bit HPC timestamp, shifted right by 32 bits. There is no further information available about that timestamp. The header file claims it's in microseconds but that seems incorrect in case of a direct UDP connection.

In case of the direct UDP connection, the timestamp is per sample. Otherwise, it is per Neuralynx data block.

NeuralynxDigitalInput<1..32>

32 binary states which match the 32 bits of the Neuralynx digital trigger input.

Network Troubleshooting

If everything has been configured as described above (which you should double-check at this point), it is still possible that no connection can be made between the experimental Computer (Running BCI2000) and the Pegasus/Cheetah System (Running the Acquisition Software).

For the connection to work, the following conditions must be met:

1. A physical connection must be established between the two machines. Make sure a working ethernet cable is plugged in, connecting the two machines. Typically, this will be a tradional ethernet cable, not a fiber cable. When a fiber cable is used, this will be in addition to the traditional wired ethernet cable.

2. The ethernet cards involved must be configured to the same subnet with two different IP addresses. A subnet is defined by the "subnet mask", and the leading part of the IP address. E.g., if the Pegasus/Cheetah System's IP address is 192.168.1.5 and the subnet mask is 255.255.0.0, then you are free to choose from the 192.168.x.x range as far as you don't reuse the Pegasus/Cheetah System's address. Make sure to set the subnet mask to the same value on both machines.

3. Make sure the two machines can see each other on the network. For this purpose, open a command prompt on the BCI2000 machine, and execute PING <IP address of the Pegasus/Cheetah System> (terminate the command with the Enter key on the computer's keyboard). If everything goes well, you will see an output like this:

Pinging 192.168.1.5 with 32 bytes of data:
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.5:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

4. If addresses and cabling are correct but PING does not work, it is possible that the echo service required for PING is not enabled in the Windows OS. Perform the following steps on the Pegasus/Cheetah System:

  • Open Windows Defender Firewall with Advanced Security: Click the Start button, type "firewall," and select "Windows Defender Firewall with Advanced Security".
  • Navigate to Inbound Rules: In the left-hand pane, click on "Inbound Rules".
  • Find the ICMPv4 rule: Look for the rule named "File and Printer Sharing (Echo Request - ICMPv4-In)". There may be multiple such rules, some for IPv4 and some for IPv6.
  • Enable the rule: Right-click the rule and select "Enable Rule".
  • Apply changes: Click "Apply" and then "OK" to save your changes.

Then, execute the PING command again from the BCI2000 machine. If it does not work, go back to the beginning, and double-check every condition for being met.

5. If PING works but the Neuralynx Source Module does not, chances are that the Neuralynx Client is blocked by the firewall on the BCI2000 machine. On the BCI2000 machine, perform the following steps:

  • Make sure to terminate BCI2000.
  • Open Windows Defender Firewall with Advanced Security: Click the Start button, type "firewall," and select "Windows Defender Firewall with Advanced Security".
  • Navigate to Inbound Rules: In the left-hand pane, click on "Inbound Rules".
  • Find rules named "NeuralynxNetComADC.exe" (capitalization may vary) and delete them.
  • Apply changes: Click "Apply" and then "OK" to save your changes.
  • Again, start up BCI2000 using the previously used Neuralynx batch file.
  • You will be asked whether NeuralynxNetComADC should be allowed to listen for incoming connections. Click "yes".
  • You may need to click SetConfig before being asked.

Now data should be flowing normally between the Pegasus/Cheetah system, and the BCI2000 system. If you still have issues, consider that the Pegasus software may sometimes exit by itself. Always make sure that the Pegasus software is running before starting BCI2000.

See also

User Reference:Filters, Contributions:ADCs