Moku:go "Unknown exception. Status code:504"

Hello Everyone,

Following the code for “One port method” using the frequency response analyzer posted at https://knowledge.liquidinstruments.com/en_US/meauring-impedance-with-mokugo-part-1 and running Moku:go firmware version 587 I get:

“Exception: Unknown exception. Status code:504”

This appears to be thrown as a result of taking a single sweep via start_sweep(single=True). This is not a result of get_data timeout as the sweep takes far less time than the default 60 second time out. Placing a pause via time.sleep does not help. The code will run if I remove the single=True request, however any attempt to stop the sweep [start_sweep(); time.sleep(1); stop_sweep();] will result in the same error when get_data() is called.

In the case where I simply leave the sweep running, start_sweep(), it is hit or miss. Half the time I get an error in the definition of the magnitude dBm = ‘nan’. This is because the later part of the magnitude array is filled with ‘nan’ values. Possibly the get_data() in this case grabs an incomplete sweep which is constantly looping.

If this is a connectivity issue, I have tested via USB connection as well as Access Point and get the same issue.

Hello,

The most reliable solution to this issue would be to start the sweep without single sweep mode enabled, then enable wait_complete when getting the data:

i.start_sweep()
frame = i.get_data(wait_complete=True)

Setting wait_complete will ensure the data is free of those ‘nan’ values. This is less suitable for longer sweep times as it often takes twice as long as the estimated sweep time.

Hello, I have also run into this issue with the 504 error and the solution you offered there does work. As you mentioned though, it is less ideal for longer sweep times. Do you know of any other alternatives when dealing with longer sweeps? Thanks.

There is currently an issue with the Moku:Go and retrieving a single sweep after resetting the FRA, i.e. connecting via the API. After looking further into the behaviour of sweep times on Moku:Go it appears it only takes twice as long as the estimated sweep time on the first call, this is a bug we will be fixing. Until then, for longer sweep times it may be best to retrieve data from a shorter sweep, after connecting to the device, then running the desired settings with single sweep.

For example:

# Quick Sweep (a few seconds)
i.set_sweep(start_frequency=6e4, stop_frequency=100, num_points=256,
          averaging_time=1e-6, settling_time=1e-6, averaging_cycles=1, settling_cycles=1)
i.start_sweep()
frame = i.get_data(wait_complete=True)
# Desired Sweep (run time matches the estimated sweep time)
i.set_sweep(start_frequency=6e4, stop_frequency=100, num_points=256,
          averaging_time=0.1, settling_time=0.1, averaging_cycles=1, settling_cycles=1)
i.start_sweep(single=True)
frame = i.get_data(wait_complete=True)