Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8dee7029ecb1
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b135693f9f95
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Dec 17, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b135693 View commit details
Showing with 48 additions and 16 deletions.
  1. +1 −1 scopehal/Oscilloscope.h
  2. +45 −15 scopehal/TektronixOscilloscope.cpp
  3. +2 −0 scopehal/TektronixOscilloscope.h
2 changes: 1 addition & 1 deletion scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@ class Oscilloscope : public virtual Instrument
///Just got triggered, data is ready to read
TRIGGER_MODE_TRIGGERED,

///WAIT - waiting for something (not sure what this means, some Rigol scopes use it?)
///WAIT - not yet fully armed
TRIGGER_MODE_WAIT,

///Auto trigger - waiting for auto-trigger
60 changes: 45 additions & 15 deletions scopehal/TektronixOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -576,6 +576,11 @@ bool TektronixOscilloscope::IsChannelEnabled(size_t i)

void TektronixOscilloscope::EnableChannel(size_t i)
{
if(!CanEnableChannel(i))
return;
if(i == m_extTrigChannel->GetIndex())
return;

{
lock_guard<recursive_mutex> lock(m_cacheMutex);

@@ -1307,16 +1312,26 @@ Oscilloscope::TriggerMode TektronixOscilloscope::PollTrigger()
if (!m_triggerArmed)
return TRIGGER_MODE_STOP;

//If AcquireData() is in progress, block until it's completed before allowing the poll.
lock_guard<recursive_mutex> lock(m_mutex);

// Based on example from 6000 Series Programmer's Guide
// Section 10 'Synchronizing Acquisitions' -> 'Polling Synchronization With Timeout'
string ter = m_transport->SendCommandImmediateWithReply("TRIG:STATE?");

//Note, we need to push all pending commands
//(to make sure the trigger is armed if we just submitted an arm request)
string ter = m_transport->SendCommandQueuedWithReply("TRIG:STATE?");

if(ter == "SAV")
{
m_triggerArmed = false;
return TRIGGER_MODE_TRIGGERED;
}

//Trigger is armed but not yet ready to go
if(ter == "ARM")
return TRIGGER_MODE_WAIT;

if(ter == "REA")
{
m_triggerArmed = true;
@@ -1344,7 +1359,16 @@ bool TektronixOscilloscope::AcquireData()
case FAMILY_MSO5:
case FAMILY_MSO6:
if(!AcquireDataMSO56(pending_waveforms))
{
//Clean up any partially acquired data
for(auto it : pending_waveforms)
{
auto vec = it.second;
for(auto w : vec)
delete w;
}
return false;
}
break;

default:
@@ -1712,10 +1736,7 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<WaveformBase*> >& p
size_t nsamples;
int8_t* samples = (int8_t*)m_transport->SendCommandImmediateWithRawBlockReply("CURV?", nsamples);
if(samples == NULL)
{
pending_waveforms[i].push_back(NULL);
continue;
}
return false;

//Set up the capture we're going to store our data into
//(no TDC data or fine timestamping available on Tektronix scopes?)
@@ -1800,10 +1821,7 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<WaveformBase*> >& p
size_t msglen;
double* samples = (double*)m_transport->SendCommandImmediateWithRawBlockReply("CURV?", msglen);
if(samples == NULL)
{
pending_waveforms[nchan].push_back(NULL);
continue;
}
return false;
size_t nsamples = msglen/8;

//Set up the capture we're going to store our data into
@@ -1867,7 +1885,6 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<WaveformBase*> >& p
if(!enabled)
continue;


//Configuration
if(firstDigital)
{
@@ -1892,11 +1909,7 @@ bool TektronixOscilloscope::AcquireDataMSO56(map<int, vector<WaveformBase*> >& p
size_t msglen;
char* samples = (char*)m_transport->SendCommandImmediateWithRawBlockReply("CURV?", msglen);
if(samples == NULL)
{
for(int j=0; j<8; j++)
pending_waveforms[m_digitalChannelBase + i*8 + j].push_back(NULL);
continue;
}
return false;

//Process the data for each channel
for(int j=0; j<8; j++)
@@ -2272,6 +2285,23 @@ void TektronixOscilloscope::SetDeskewForChannel(size_t channel, int64_t skew)
}
}

void TektronixOscilloscope::SetUseExternalRefclk(bool external)
{
switch(m_family)
{
case FAMILY_MSO5:
case FAMILY_MSO6:
if(external)
m_transport->SendCommandQueued("ROSC:SOU EXT");
else
m_transport->SendCommandQueued("ROSC:SOU INTER");
break;

default:
break;
}
}

int64_t TektronixOscilloscope::GetDeskewForChannel(size_t channel)
{
//Cannot deskew digital/trigger channels
2 changes: 2 additions & 0 deletions scopehal/TektronixOscilloscope.h
Original file line number Diff line number Diff line change
@@ -124,6 +124,8 @@ class TektronixOscilloscope
virtual void SetDeskewForChannel(size_t channel, int64_t skew);
virtual int64_t GetDeskewForChannel(size_t channel);

virtual void SetUseExternalRefclk(bool external);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Logic analyzer configuration