Multiple digital ports through MSO API

I need to capture eight digital channels at once with the “Logic MSO 4x100” through the Python MSO API, so I have to use two ports. For testing purposes, I run the following code with only two digital channels from different ports set up:

scope = mso_api.MSO()
save_dir = Path('SaleaeLogicMSO-Capture')

scope.capture(
    mso_api.CaptureConfig(
        enabled_channels=[
            mso_api.DigitalChannel(port=0, channel=0, threshold_volts=2, name='P0_CH0'),
            mso_api.DigitalChannel(port=1, channel=0, threshold_volts=2, name='P1_CH0')
        ]
    ),
    save_dir=save_dir
)

Running this code throws following error:

[capture_commands.cpp:77] exception during recording: invalid map<K, T> key

The capture_stdout.txt is attached.

The same error occurs trying to capture all eight channels. Individually capturing channels of port 0 or 1 works, so it doesn’t seem to be a hardware error.

capture_stdout.txt (15.4 KB)

Hi @Philipp.M,

Thanks for sending this in! I’m sorry we didn’t catch this ourselves. It turns out this was caused by a race condition in our code, and by adding a sleep statement I was able to reproduce it locally. I have a fix for it and it will be in the next mso-api release. I don’t have a date yet, but I’ll work on that now and let you know once it’s out. Sorry for the trouble with this!

Ok, it’s fixed now. I just released mso-api 0.5.8.

I installed mine with pip, so I upgraded it like so:

pip install --upgrade saleae-mso-api --extra-index-url https://downloads.saleae.com/pypi/

Thank you for the quick fix, now it works perfectly!

1 Like