Skip to content

Commit

Permalink
WIP: Read data from Ph2C probe (see notes.txt)
Browse files Browse the repository at this point in the history
  • Loading branch information
medengineer committed Mar 28, 2024
1 parent 6791610 commit a865069
Show file tree
Hide file tree
Showing 6 changed files with 1,144 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Ph2C_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Compiled plugin w/ API 3.67 by commenting out all code related to setting SYNC param.
Initially plugin wouldn't load. Dependency walker showed it was linking to NeuropixAPI_x64_3_67_dbg.dll.
Renaming NeuropixAPI_x64_3_67.dll to NeuropixAPI_x64_3_67_dbg.dll enabled the plugin to load properly.

I was able to connect to one headstage and one probe:

[open-ephys] Scanning for devices...
[open-ephys] Found 1 device.
[open-ephys] Opening device on slot 4
[open-ephys] Opened BS on slot 4
[open-ephys] BS firmware: 2.0169
[open-ephys] Searching for probes...
[open-ephys] Got HS part #: NPM_HSTC_ext <-- Do we ignore this part #?
[open-ephys] Got HS part #: NPM_HS_32
[open-ephys] Found 2.0 Phase 2C dual-dock headstage on port: 1
[open-ephys] No headstage detected on port: 3
[open-ephys] No headstage detected on port: 4
[open-ephys] Found probe part number: NP2020
[open-ephys] Found probe serial number: 22053112201

On subsequent connections randomly getting either error code 8 OR 2.0 probe headstage number:

[open-ephys] ***detectHeadstage failed w/ error code: 8
[open-ephys] Got HS part #: NPM_HS_01

TODO: Add Geometry next so probe gets validated.
6 changes: 6 additions & 0 deletions Source/Basestations/Basestation_v3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../Headstages/Headstage2.h"
#include "../Headstages/Headstage_Analog128.h"
#include "../Headstages/Headstage_Custom384.h"
#include "../Headstages/Headstage_Ph2C.h"

#define MAXLEN 50

Expand Down Expand Up @@ -129,6 +130,11 @@ ThreadPoolJob::JobStatus PortChecker::runJob()
LOGC(" Found 2.0 dual-dock headstage on port: ", port);
headstage = new Headstage2(basestation, port);
}
else if (hsPartNumber == "NPM_HS_32") //Ph2C headstage
{
LOGC(" Found 2.0 Phase 2C dual-dock headstage on port: ", port);
headstage = new Headstage_Ph2C(basestation, port);
}
else
{
headstage = nullptr;
Expand Down
119 changes: 119 additions & 0 deletions Source/Headstages/Headstage_Ph2C.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2024 Allen Institute for Brain Science and Open Ephys
------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "Headstage_Ph2C.h"
#include "../Probes/Neuropixels_Ph2C.h"

#define MAXLEN 50

void Headstage_Ph2C::getInfo()
{

int version_major;
int version_minor;

errorCode = Neuropixels::getHSVersion(basestation->slot, port, &version_major, &version_minor);

info.version = String(version_major) + "." + String(version_minor);

errorCode = Neuropixels::readHSSN(basestation->slot, port, &info.serial_number);

char pn[MAXLEN];
errorCode = Neuropixels::readHSPN(basestation->slot, port, pn, MAXLEN);

info.part_number = String(pn);

}


void Flex_Ph2C::getInfo()
{

int version_major;
int version_minor;

errorCode = Neuropixels::getFlexVersion(headstage->basestation->slot,
headstage->port,
dock,
&version_major,
&version_minor);

info.version = String(version_major) + "." + String(version_minor);

char pn[MAXLEN];
errorCode = Neuropixels::readFlexPN(headstage->basestation->slot,
headstage->port,
dock,
pn,
MAXLEN);

info.part_number = String(pn);

}


Headstage_Ph2C::Headstage_Ph2C(Basestation* bs_, int port) : Headstage(bs_, port)
{
getInfo();

int count;

Neuropixels::getHSSupportedProbeCount(basestation->slot, port, &count);

for (int dock = 1; dock <= count; dock++)
{
bool flexDetected;

Neuropixels::detectFlex(basestation->slot, port, dock, &flexDetected);

if (flexDetected)
{
flexCables.add(new Flex_Ph2C(this, dock));
Neuropixels_Ph2C* probe = new Neuropixels_Ph2C(basestation, this, flexCables.getLast(), dock);

if (probe->isValid)
{
probe->setStatus(SourceStatus::CONNECTING);
probes.add(probe);
}
else
{
delete probe;
probes.add(nullptr);
}

}
else {
probes.add(nullptr);
}

}

}

Flex_Ph2C::Flex_Ph2C(Headstage* hs_, int dock) : Flex(hs_, dock)
{
getInfo();

errorCode = Neuropixels::SUCCESS;
}
52 changes: 52 additions & 0 deletions Source/Headstages/Headstage_Ph2C.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2024 Allen Institute for Brain Science and Open Ephys
------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __NEUROPIXHSP2C_H_2C4C2D67__
#define __NEUROPIXHSP2C_H_2C4C2D67__


#include "../API/v3/NeuropixAPI.h"
#include "../NeuropixComponents.h"


class Headstage_Ph2C : public Headstage
{
public:
Headstage_Ph2C::Headstage_Ph2C(Basestation*, int port);
void getInfo() override;
bool hasTestModule() override { return false; }
void runTestModule() override {}

Neuropixels::NP_ErrorCode errorCode;
};

class Flex_Ph2C : public Flex
{
public:
Flex_Ph2C::Flex_Ph2C(Headstage*, int dock);
void getInfo() override;

Neuropixels::NP_ErrorCode errorCode;
};

#endif // __NEUROPIXHSP2C_H_2C4C2D67__
Loading

0 comments on commit a865069

Please sign in to comment.