Using cbMEX on Unix Operating Systems

Using cbMEX on Unix Operating Systems

Introduction

This article covers the method for allowing cbmex, our online Matlab interface, to function on unix operating systems. For more information on cbmex and our Matlab libraries, please refer to the user manuals section of our website. 
Note: This method of using cbMEX is not officially supported by Blackrock Microsystems; it is put here for reference and convenience, but we cannot help troubleshoot issues with cbMEX when it is used in this way.

Installation

This solution is entirely based on the Cerelink project, which can be found at  https://github.com/dashesy/CereLink, for convenience, we have compiled cbMEX and its dependencies from this repo and included them as an attachment to this article. 
On the OSX computer, configure the instrument port to the following address:
IP: 192.168.137.5 (the last number here can be anything between 1-16 not already on the network)
Subnet: 255.255.255.0

Inside the attached zipped file you will find three files:
-cbmex.mexmaci64
-QtCore
-QtXml

The first one is the mex file that is cbmex that we will be using to interface with the NSP. The other two are libraries that we want Matlab to correctly use. There is a good chance that Matlab will be referring to the wrong location to look for these file, the following instructions will outline how to place them where Matlab can find them.

From finder, navigate to the following folder:

/usr/lib

Place both QtCore and QtXml into this folder. They should not be in there initially, so you will not need to overwrite anything, but you will need administrator access (PS: MacOS 10.11+ has SIP protecting lib folder. You can disable the SIP by following this instruction). Once these are placed, you should be able to attempt to open cbmex by first placing it in the Matlab path and then attempting cbmex('open'). At this point one would get memory errors because Mac allows much less memory in these spaces than Windows; the best way to adjust these is in terminal. Open up terminal and type the following commands:

sudo sysctl -w kern.sysv.shmmax=33554432
sudo sysctl -w kern.sysv.shmall=4194304

Attempt to change max.sockbuf:

sudo sysctl -w kern.ipc.maxsockbuf=8388608

At this point, cbmex should be ready to open. Go to Matlab and use the following command:

cbmex('open','receive-buffer-size',6291456,'inst-addr', '192.168.137.128', 'inst-port', 51001, 'central-addr', '255.255.255.255', 'central-port', 51002)

This is the open command of cbmex, and after you have opened the interface, all other commands can be used normally.

    • Related Articles

    • cbPy Getting Started Guide

      The attached document gives you step-by-step instructions for installing cbPy, a Python API for real-time interfacing with Blackrock data acquisition systems, on either a Windows 10 or Linux operating system using the 3rd-party CereLink distribution ...
    • MATLAB Interfaces For Blackrock Microsystems Data Acquisition Systems

      Introduction Blackrock has several functions for looking at and interacting with data collected through our neural signal processors. These functions are available for post-recording processing (Neural Processing MATLAB Kit - NPMK) or for interacting ...
    • Broadcasting Data from nPlayServer to Multiple Computers

      Introduction This article will cover how to make nPlayServer, Blackrock's data playback program, send data out from a computer as if it were a Neural Signal Processor. This can be done whether you own a CerePlex Direct or Neural Signal Processor ...
    • Multiple Instances of Central on the Same Host PC

      NOTICE: This feature has been removed as of Central version 7.5.0. 7.5.0 and later supports running two NSPs in one instance of Central, but cannot run 3 or more in one instance. If you prefer having separate instances for each NSP connected to your ...
    • How to Synchronize Multiple Neural Signal Processors

      Introduction Neural Signal Processors can be synchronized to achieve higher channel counts on the combined system. Hardware Requirements Neural Signal Processors with PN 4176 were not all synchronization capable. To check whether your unit is ...