Skip to content

Commit

Permalink
Read 1536 channels from one Ph2C probe
Browse files Browse the repository at this point in the history
  • Loading branch information
medengineer committed Apr 3, 2024
1 parent 6791610 commit 8f8d938
Show file tree
Hide file tree
Showing 11 changed files with 1,404 additions and 1 deletion.
58 changes: 58 additions & 0 deletions Ph2C_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
3-28-2024
---

Upgraded QBSC firmware from .189 to .190
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




4-2-2024
---

Downgrading QBSC firmware back to .189 no longer gives wrong HS PN but rarely still getting error 8.

Created Ph2C Geometry based off NP2 multi shank class and Ph2C User Manual to validate probe.

Added a loop to read packets by base / source type 384 channels at a time to fill a 384 * 4 total buffer.

TOFIX:



Changes required for compatibility with current plugin paradigm

1. Upgrade PortChecker b/c ports are no longer independent and connecting to multiple Ph2C probes this way will not work.
We either have to scan ports serially and check that NPM_HS_32 is on port 1 or 3, if so, ensure that NPM_HSTC_ext is found on 3 or 4 respectively.
Otherwise, keep the parallel jobs but then validate port indeces before initiating connection to probes.

2. Modify basestation view in plugin editor.
If NP2020 detected on port 1/3, show as dual dock and remove port circle on 2/4 respectively.

Questions for Bill/Jan:

1. What to do about port 2/4 status LED, it currently remains red even if port 1/3 is connected/acquiring (see picture)
TODO: Try to open port 2/4 anyway and see if it changes the status LED.
Binary file not shown.
Binary file not shown.
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__
3 changes: 2 additions & 1 deletion Source/NeuropixComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ enum class ProbeType {
UHD2,
NP2_1,
NP2_4,
OPTO
OPTO,
PH2C
};

enum class SourceStatus {
Expand Down
Loading

0 comments on commit 8f8d938

Please sign in to comment.