Cannot connect to the Moku:Lab using MATLAB

Moku model: Moku:Lab
Operating system: Microsoft Windows 10 Enterprise Version 10.0 (Build 19045)
Software version: MATLAB Version: 9.10.0.1602886 (R2021a) / moku-MATLAB 3.0.1

Bug description: I cannot connect to the Moku:Lab using MATLAB.

I have tried with two different Moku:Lab and get the same error.
I am able to connect when using a Moku:Go.
I am sharing the code below:

%%
clc
clear
close all
 
%% Connect to your Moku
ip = '192.168.73.1';
 
% Connect to your Moku and deploy the desired instrument
m = MokuOscilloscope(ip, force_connect='True');

m.relinquish_ownership()

I get the following error:

sun.net.www.protocol.http.HttpURLConnection:http://192.168.73.1/api/moku/claim_ownership

   404

Error using Requests/parse_response (line 40)
Unexpected error occurred

Error in Requests/http_post (line 128)
            response = obj.parse_response(output, extras);

Error in Moku/claim_ownership (line 219)
            response = obj.session.http_post('moku/claim_ownership', params);

Error in Moku (line 180)
                obj.claim_ownership('force_connect', force_connect, 'ignore_busy',
                ignore_busy, ...

Error in MokuOscilloscope (line 84)
            obj@Moku(IpAddr, force_connect, ignore_busy, persist_state, read_timeout,
            mimInited);

Error in MokuPhaseExmaple (line 17)
m = MokuOscilloscope(ip, force_connect='True');

We recently updated the Moku:Lab firmware so that it now uses the same API as Moku:Go and Moku:Pro. Have you recently updated your Moku:Lab firmware to 580? If so then it will use the moku-MATLAB toolbox which should work for both devices given the code you posted above (except of course changing the IP address). If not, then it will use the legacy MATLAB toolbox which you can download from here under the Legacy section.

Can confirm which firmware both devices are on to see if there is an issue with the API toolbox version?

1 Like

I just updated the firmware to 580.
I ran the same code with the new firmware and the same moku-MATLAB toolbox, and I got a different error message:

Error using Moku/load_instrument_resources (line 323)
Cannot find bitstream C:\Users\xxxx\AppData\Roaming\MathWorks\MATLAB
Add-Ons\Toolboxes\moku-MATLAB\data\moku20\01-000, please run moku_download(580) to download
instrument data

Error in MokuOscilloscope (line 87)
                obj.load_instrument_resources('01-000');

Error in MokuPhaseExmaple (line 17)
m = MokuOscilloscope(ip, force_connect='True');

Then, I uninstall the toolbox and installed the legacy MATLAB toolbox.
It got a different error message for the Moku:Lab and for the Moku:Go:

Error using moku/check_compatibility (line 172)
input file does not exist

Error in moku (line 71)
            [compat, py_vers] = obj.check_compatibility();

Error in MokuOscilloscope (line 36)
            obj@moku(IpAddr, 'oscilloscope');

Error in Test (line 10)
m = MokuOscilloscope(ip);

Type “moku_download(580)” in Matlab command window and hit enter (you should be connected to the Internet). That’s what I had to do after updating the Moku Matlab API yesterday.

1 Like

Thank you.
So, in summary:

  • I updated the firmware of my Moku:Lab.
  • Updated the API to 3.0.1.
  • Run moku_download(580).

Now its working.

1 Like