PICO_INVALID_RATIO_MODE Error with psospaGetStreamingLatestValues Function

Post your Python discussions here.
Post Reply
sosongha3
Newbie
Posts: 1
Joined: Wed Aug 07, 2024 7:54 am

PICO_INVALID_RATIO_MODE Error with psospaGetStreamingLatestValues Function

Post by sosongha3 »

Hello,

I'm experiencing a PICO_INVALID_RATIO_MODE error when calling the psospaGetStreamingLatestValues function on a PicoScope 3000E Series device. I've set the downSampleRatioMode to PICO_RATIO_MODE_RAW, and it works fine with other function calls. However, this specific function returns an error.

Here is a portion of my code:

Code: Select all

class PCIO_STREAMING_DATA_INFO(ctypes.Structure):
    _pack_ = 1  # for byte alignment
    _fields_ = [
        ("channel_", ctypes.c_int32),
        ("mode_", ctypes.c_int32),
        ("type_", ctypes.c_int32),
        ("noOfSamples_", ctypes.c_int32),
        ("bufferIndex_", ctypes.c_uint64),
        ("startIndex_", ctypes.c_int32),
        ("overflow_", ctypes.c_int16),
    ]

class PCIO_STREAMING_DATA_TRIGGER_INFO(ctypes.Structure):
    _pack_ = 1  # for byte alignment
    _fields_ = [
        ("triggerAt_", ctypes.c_uint64),
        ("triggered_", ctypes.c_int16),
        ("autoStop_", ctypes.c_int16),
    ]

...

# get blocks
streaming_data_info_arr_type = ctypes.POINTER(PCIO_STREAMING_DATA_INFO) * len(chNums)
streaming_data_info_arr = streaming_data_info_arr_type()
for idx, chNum in enumerate(chNums):
    one = PCIO_STREAMING_DATA_INFO(
        chNum,
        ps.PSOSPA_RATIO_MODE["PICO_RATIO_MODE_RAW"],
        dataType,
        0,
        0,
        0,
        0,
    )
    streaming_data_info_arr[idx] = ctypes.pointer(one)

streaming_data_info_arr_ptr = ctypes.byref(streaming_data_info_arr)
streaming_data_trigger_info = PCIO_STREAMING_DATA_TRIGGER_INFO(0, 0, 0)
streaming_data_trigger_info_ptr = ctypes.byref(streaming_data_trigger_info)

status = ps.psospaGetStreamingLatestValues(
    unit, streaming_data_info_arr_ptr, len(chNums), streaming_data_trigger_info_ptr
)

I've attempted to correctly initialize and pass the structure array, but the same error persists.And successfully configured the channels for streaming, set up the buffers, and executed RunStreaming() in the omitted code sections.

I have no idea about which part to debug... Could you suggest any further steps to debug or resolve this issue? Is there something wrong with how I've declared or initialized the structure array?

Thank you!
Post Reply