[DllImport(_DRIVER_FILENAME, EntryPoint = "ps6000SetSimpleTrigger")]
internal static extern UInt32 SetSimpleTrigger(
short handle,
short enabled,
Channel channel,
short threshold,
ThresholdDirection direction,
uint delay,
short autoTriggerMs);
[DllImport(_DRIVER_FILENAME, EntryPoint = "ps6000SetExternalClock")]
internal static extern UInt32 setExternalClock(
short handle,
ExternalSyncFrequency frequency,
short threshold);
However, the call to ps6000SetExternalClock returns error 86, which I understand to be: PICO_TRIGGER_AND_EXTERNAL_CLOCK_CLASH
I can understand I would get this error if I was attempting to use the AUX input as both a trigger and external clock. However, the trigger is defined as channel C so it's not clear to me why I am seeing this.
Please can anyone suggest where I might be going wrong or what this error really means?
I've modified my code so that ps6000SetExternalClock is called immediately after ps6000OpenUnit, but ps6000SetExternalClock still returns error 86: PICO_TRIGGER_AND_EXTERNAL_CLOCK_CLASH.
Any other thoughts as to what the problem might be?
internal uint picoSyncTest()
{
string[] devices = { "" };
uint status = 0;
try
{
//Enumerate devices
short serialNumLength = 255;
StringBuilder sb = new StringBuilder(serialNumLength);
status = Imports.EnumerateUnits(out short deviceCount, sb, ref serialNumLength);
if (status != StatusCodes.PICO_OK)
{
throw new ArgumentException($"EnumerateUnits: {status} = {StatusMessage.Text[status]}");
}
devices = sb.ToString().Split(',');
//Try to open the first unit
sb = new StringBuilder(devices[0]);
status = Imports.OpenUnit(out _handle, sb);
if (status != StatusCodes.PICO_OK)
{
throw new ArgumentException($"OpenUnit({devices[0]}): {status} = {StatusMessage.Text[status]}");
}
//Try to sync the picoScope to an external 10MHz clock, threshold = -0.5V
Imports.ExternalSyncFrequency externalSyncFrequency = Imports.ExternalSyncFrequency.PS6000_FREQUENCY_10MHZ;
short threshold_lsb = Convert.ToInt16(-0.5 * Imports.MaxValue);
status = Imports.setExternalClock(_handle, externalSyncFrequency, threshold_lsb);
if (status != StatusCodes.PICO_OK)
{
throw new ArgumentException($"setExternalClock: {status} = {StatusMessage.Text[status]}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Picoscope:{ex.Message}");
}
return status;
}
This runs, but function Imports.setExternalClock() returns 86 which according to StatusMessage.Text[86] is "PICO_TRIGGER_AND_EXTERNAL_CLOCK_CLASH"
In case its relevant, the sync signal is sequence of negative going pulses running from 0V (the baseline) to -0.8V (when terminated). Each pulse is 5ns in duration and the pulse frequency is 10MHz.
The issue may be due to the AC coupling used for the external clock signal. We haven't specifically tested anything other than 50% duty cycle however would expect that 60:40 would work but beyond that may cause difficulties.