I am using the Moku Pro in the multi-instrument mode. The setup is fairly simple, all inputs are assigned to oscilloscopes and two outputs are assigned to the arbitrary waveform generator. A binary sequence is generated by the waveform generator and the output is looped back into the oscilloscope by an external cable.
The setup can be loaded via the Python API into the Moku. Loading is not an issue as I can independently verify the generated output sequence via an external oscilloscope. The Moku oscilloscope is also working correctly, I can verify this using the iPad app when I terminate the Python connection.
The error “moku.exceptions.MokuException: Unknown exception. Status code:502” occurs when I try to improve the resolution of the Oscilloscope data by running the following command:
mokuPro.set_timebase(-5e-7, 5e-7)
The error does not occur when I select t1 and t2 units below 5e6, but any higher resolution results in a loss of ethernet packets.
I have confirmed that the Moku is configured with the correct timebase values via the iPad app, but the same cannot be tested through the Python API.
The Moku is updated to the latest available version of the firmware.
Hey Alan, thanks for posting this error. Could you tell me how you are acquiring your Moku:Pro’s IP address to be used in python? The 502 error is generally related to server errors so the set_timebase() function shouldn’t have any effect. Be sure you are using the IP address given in the Desktop app or iPad app and not the one from ‘moku list’ as this can sometimes return a different address than the one used for connecting to the API server.
Could you also check that you have the latest instrument files downloaded for the moku-python package? You can do this by running
moku download --fw_ver=574
Please let me know if this issue persists after checking the above.
I am not using ‘moku list’ to identify the MokuPro’s IP address. I have manually set the IP address on the MokuPro, via the desktop app, and I can confirm that it works.
I am also running the latest version of the moku-python package, I ran the command you suggested and got a “Moku Client Version 2.5.1. Instruments already up to date for firmwareversion 574.” message.
As far as I can see I am able to control all moku functions with the exception of the Oscilloscope resolution in multi-instrument mode (high resolution, low seems to work fine). I agree that a drop in network connection shouldn’t be associated with the set_timebase() function, but that’s what’s happening in my case. Could it be that the moku is trying to send too many packets back and the network adapter is crashing? What is the maximum data throughput the moku can achieve over gigabit ethernet?
Traceback (most recent call last):
File “…testArbitraryWaveform.py”, line 148, in
raise e
File “…testArbitraryWaveform.py”, line 102, in
receivedData2 = mokuProScopeNo2.get_data()
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\instruments_oscilloscope.py”, line 529, in get_data
return self.session.post(
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 14, in func_wrapper
return self.resolve(response)
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 143, in resolve
self.handle_http_error(response)
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 86, in handle_http_error
raise exceptions.MokuException(
moku.exceptions.MokuException: Unknown exception. Status code:504
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “…testArbitraryWaveform.py”, line 152, in
mokuPro.relinquish_ownership()
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku_init_.py”, line 119, in relinquish_ownership
return self.session.post(“moku”, operation)
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 14, in func_wrapper
return self.resolve(response)
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 143, in resolve
self.handle_http_error(response)
File “…PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\moku\session.py”, line 86, in handle_http_error
raise exceptions.MokuException(
moku.exceptions.MokuException: Unknown exception. Status code:502
Thank you for confirming the instrument firmware version and IP. The way that the Moku API server handles data packet transfer over the internet doesn’t change based on set_timebase() either. When you call get_data(), it will return 1024 points per channel no matter what the sampling rate is set to, which is strange why certain timebase settings do not work.
Would it be possible for you to share snippets of your code, specifically the parts where you set up the instrument and especially where you have called get_data()?
Thanks for a quick response.
Here is the main body of code I am using to connect to the Moku (it is largely based on the API examples on your website):
Hey Alan, I just wanted to give you an update that our API team is taking a look into this bug right now. Please allow them a few days to work on this as they are also getting things ready for the next release at the end of January. I will respond here once I have an update for you. Thanks for reporting this and for your patience while we figure it out!
BTW - it is an issue with having multiple oscilloscopes deployed on the APIs MiM configuration (the error doesn’t occur with only one scope deployed) and you are correct about the timebase being the cause. Thank you for providing the code an information for us to debug.
I have tested my setup with one Oscilloscope (two channels), and it works as you suggested. I can now proceed with my experiment although I will need to use all the Oscilloscope inputs in the near future.
I appreciate your effort in this matter.
I also got the same error: MokuException: Unknown exception. Status code:502
when using the Moku:pro multi-instruments with python API and using the waveform generator and two LockInAmplifier.