Python API bug: "Moku 502 Error" when relinquish_ownership()

Moku model: Moku Pro, Firmware 587
Operating system: Mac OS Ventura 13.4.1
Software version: Moku 3.1.0, Mokucli 2.2.1

The following combination of settings causes a 502 error when trying to relinquish_ownership() of the Moku Pro in Mim mode. There doesn’t appear to be any issues with function, until I try to relinquish ownership, but I cant be certain.

If I remove any single one of those lines, it seems to work okay… Others who’ve posted about similar issues on the forum seems to suggest that its about having a double up of instruments, but that doesnt appear to be the case here.

from moku.instruments import CloudCompile, MultiInstrument, ArbitraryWaveformGenerator, WaveformGenerator, LockInAmp

mim = MultiInstrument('', force_connect=True, platform_id=4)
arb = mim.set_instrument(1, ArbitraryWaveformGenerator)
#mcc = mim.set_instrument(2, CloudCompile, bitstream="multip_mokupro_587_e5cacd7.tar.gz") # N.B. Not nessecary to replicate the bug so I commented it out
wg = mim.set_instrument(3, WaveformGenerator)
lia = mim.set_instrument(4, LockInAmp)

wg.generate_waveform(channel=1,type='Sine', amplitude = 1.0,frequency = 144e6,phase = 0)


arb.burst_modulate(1, "InputA", "NCycle", burst_cycles=1e6, trigger_level=0.8)


Thank you for bringing this to our attention! We’ve noted this as a new bug in Multi-Instrument mode for the Moku:Pro and are working towards a fix. For now, the best solution for when this occurs would be to comment out mim.relinquish_ownership and rely on force_connect=True when connecting to your Moku:Pro.

1 Like

Thank you! Just to add to this, when I comment out relinquish_ownership(), the Moku gives another 502 error when trying to re-run the script and connect to the device. I have to run the script twice to get it to connect.

Its not an issue for me to keep developing my application, but I thought I should mention it :slight_smile:

Ah yes, I did notice that! If it does become an issue and you don’t mind a little extra run time, you could try something like this for more reliable runs:

import time
######### YOUR CODE #########