MATLAB Answers

Arduino MKRMotorCarrier library failure

68 views (last 30 days)
Marius Ionita
Marius Ionita on 5 Nov 2019
Commented: Ross Wilkinson on 5 Aug 2020
Dear friends,
I know this topic has been discussed previously and I really tried every suggestion but nothing seems to work for me.
When I run a = arduino I get the bellow answer:
Updating server code on board MKR1000 (/dev/ttyACM0). This may take a few minutes.
On the second attempt, a = arduino I get the bellow answer:
arduino with properties:
Port: '/dev/ttyACM0'
Board: 'MKR1000'
AvailablePins: {'D0-D14', 'A0-A6'}
AvailableDigitalPins: {'D0-D14', 'A0-A6'}
AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'}
AvailableAnalogPins: {'A0-A6'}
AvailableI2CBusIDs: [0]
Libraries: {'I2C', 'SPI', 'Servo'}
When I ran carrier = addon(a, 'Arduino/MKRMotorCarrier')
It returned:
No add-on library uploaded to the board. Clear and recreate the current arduino object to include the
appropriate library. For a list of available libraries, type 'listArduinoLibraries'.
After that, when I run listArduinoLibraries it shows me the Arduino/MKRMotorCarrier included in the list as bellow:
ans =
8×1 cell array
{'Adafruit/MotorShieldV2' }
{'Arduino/MKRMotorCarrier'}
{'I2C' }
{'RotaryEncoder' }
{'SPI' }
{'Servo' }
{'ShiftRegister' }
{'Ultrasonic' }
Note: I only marked Arduino/MKRMotorCarrier and RotaryEncoder (I don't know why Adafruit/MotorShieldV2 appears in the list)
After that I did the following:
I downloaded the latest version of MKRMotorCarrier library (1.0.5) - i followed again the steps in which I move the folder in Arduino / libraries, as instructed in tutorial.
I ran arduinosetup again the this time it told me that the libraries have been added and that if I want to use my Arduino with the current settings to use a = arduino
I figured out that I have installed the wrong Arduino Engineering Kit (18b and I run matlab 19a); after that i tried to install 19a support kit, but when i run arduinosetup it won't show me the MKRMotorCarrier library to be checked and more than that when I press 'Program' in the wizzard it shows in the command window:
Warning: Inputs must be character vectors, cell arrays of character vectors, or string arrays.
> In arduinoio.internal.Utility/generateAddonLibrariesHeader (line 338)
In arduinoio.internal.Utility/updateServer (line 53)
In arduinoio.setup.internal.HardwareInterface/uploadArduinoServer (line 188)
In arduinoio.setup.internal.UpdateServerScreen/uploadServer (line 281)
In arduinoio.setup.internal.UpdateServerScreen>@(varargin)obj.uploadServer(varargin{:}) (line 181)
In matlab.hwmgr.internal.hwsetup.executeWidgetCallback (line 15)
In matlab.hwmgr.internal.hwsetup.Widget/safeCallbackInvoke (line 114)
In matlab.hwmgr.internal.hwsetup.hg.Button/buttonPushedCbk (line 43)
In matlab.hwmgr.internal.hwsetup.hg.Button>@(varargin)obj.buttonPushedCbk(varargin{:}) (line 24)
More than that, when I restart Matlab, the 19a kit gets automatically uninstalled.
It won't appear in Manage Add-ons, but if I search it manually in MATLAB Add-ons folder, it is there and it also contains MKRMotorCarrier libraries.
My OS is Ubuntu 16.04.3 LTS
I have a standard license and the license from Arduino:
MATLAB Version: 9.6.0.1135713 (R2019a) Update 3
MATLAB License Number: STUDENT
Operating System: Linux 4.4.0-166-generic #195-Ubuntu SMP Tue Oct 1 09:35:25 UTC 2019 x86_64
Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Could you please be so kind and help me in this issue?
Best regards,
Marius

  0 Comments

Sign in to comment.

Answers (2)

Madhu Govindarajan
Madhu Govindarajan on 6 Nov 2019
Please perform a clean reinstall of everything except MATLAB and see what happens. Here are the steps to take for a clean reinstall of everything:
  • If you type arduinoio.PackageRoot on MATLAB Command Window, this will tell you the Arduino Support Package root location.
Example – C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\arduinoide.instrset\idepkgs
In here, Note the location till R2018b or R2018a depending on what version of MATLAB you have.
  • The location where add-ons are installed can be found by clicking on Preferences icon in MATLAB toolstrip and then go to MATLAB > Add-Ons here. Note the location.
  • After this go ahead and uninstall the support packages and the add-on toolboxes.
  • Next go to these locations outside of MATLAB and ensure no more files are left, and feel free to delete any left over.
  • Then close MATLAB and reopen it as administrator by launching it from a terminal window with sudo permissions.
  • Next attempt to install the necessary and appropriate hardware support packages. Do not close any terminal windows that pop up during this process and let them complete.
  • Note: Do not manually edit any Arduino libraries after this step as only certain versions of each library is tested with MATLAB and Simulink.
  • Next install the needed add-on toolboxes and follow instructions on the toolbox itself.
  • Now attempt to communicate with arduino using arduinosetup
This should work. If not, please reach out to TS to get their assistance with installation.
Madhu

  0 Comments

Sign in to comment.


Marius Ionita
Marius Ionita on 7 Nov 2019
Dear Madhu,
Thank you very much for the detailed answer!
What I did was to create the arduino object by modifying the syntax:
a = arduino ('port', 'board type', 'Libraries','Arduino/MKRMotorCarrier and other libraries I needed included').
After creating the object like that it worked perfectly.
Best regards,

  1 Comment

Ross Wilkinson
Ross Wilkinson on 5 Aug 2020
Hi Marius,
Thank you for sharing this soluton! It worked for me too.
Ross

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by