arduino engineering kit invalid i2c address formatt

3 vues (au cours des 30 derniers jours)
Kevin Graebner
Kevin Graebner le 15 Avr 2019
hello! i am trying to complete the arduino engineering kit using matlab 2019 and simulink
here is a link to where i currently am, down in the section of that page where you connect the arduino board to matlink to control that little geared motor.
"As you switched the MKR1000 board's power source from USB to LiPo battery, you must re-establish your MATLAB connection to Arduino. Run the following commands to do so:
>> clear a
>> a = arduino
Now let's create a second MATLAB object to provide access to the MKR Motor Carrier. Use the following command to create a Carrier object in the MATLAB Workspace that is associated with the Arduino object a :
>> carrier = addon(a, 'Arduino/MKRMotorCarrier')
Just as the MKR Motor Carrier provides a physical interface between the motor drive wiring and the MKR1000 board, the carrier object is an intermediary between the Arduino object and the DC and servo motors we may connect.
The Motor Carrier allows you to drive your motors with a relatively powerful battery. This can provide much larger currents than the Arduino board itself, which derives all its power from the USB connection to your computer. The USB port cannot provide enough current to drive motors at the necessary voltage, and it can be dangerous to attempt to do so.
Now let's create a third object to give you control of the motor connected to M3 in MATLAB. Use the following command to create a DC Motor object that is associated with the Carrier object, and examine the displayed object properties in theCommand Window :
>> dcm = dcmotor(carrier,3)
when i follow these directions exactly and even copy and paste the commands from the tutorial it gives me this error when trying to access the MKRMotorCarrier library.
>> clear a
>> a = arduino
a =
arduino with properties:
Port: 'COM8'
Board: 'MKR1000'
AvailablePins: {'D0-D14', 'A0-A6'}
AvailableDigitalPins: {'D0-D14', 'A0-A6'}
AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'}
AvailableAnalogPins: {'A0-A6'}
AvailableI2CBusIDs: [0]
Libraries: {'Arduino/MKRMotorCarrier', 'I2C', 'RotaryEncoder', 'SPI', 'Servo', 'Ultrasonic'}
>> carrier = addon(a, 'Arduino/MKRMotorCarrier')
Invalid I2C address format. The address must be a scalar integer (or hex character vector or string) between 0
and 127.
what am i doing wrong? or has something been updated to make this tutorial invalid?

Réponse acceptée

Madhu Govindarajan
Madhu Govindarajan le 18 Avr 2019
Thanks for sending the output, the problem arises from the fact that you are using the old Arduino_Engineering_Kit_Hardware_Support instead of Arduino_Engineering_Kit_Hardware_Support_19a. To fix this I recommend the following:
1) Make a copy of any modifications you made inside this toolbox that are important to you (ideally you did not use this folder as most users don't, but just to be sure)
2) Uninstall Arduino_Engineering_Kit_Hardware_Support Add-on by going to Add-Ons > Manage Add-Ons and clicking on the vertical ellipsis right next to the file
3) Go to Add-Ons > Get Add-Ons. Search for Arduino_Engineering_Kit_Hardware_Support_19a and 'Add' this.
Then try arduinosetup and you should not receive any errors.
  2 commentaires
Aby Elias
Aby Elias le 28 Juin 2019
Thanks Madhu.
Sourabh Karmakar
Sourabh Karmakar le 25 Juil 2022
Modifié(e) : Sourabh Karmakar le 26 Juil 2022
Hi Madhu,
I followed all the instructions and updated the kit in Matlab 2022a on windows 11. I am getting the following error:
>> a = arduino('COM5', 'Due'),
a =
arduino with properties:
Port: 'COM5'
Board: 'Due'
AvailablePins: {'D2-D53', 'A0-A11'}
AvailableDigitalPins: {'D2-D53', 'A0-A11'}
AvailablePWMPins: {'D2-D13'}
AvailableAnalogPins: {'A0-A11'}
AvailableI2CBusIDs: [0, 1]
AvailableSerialPortIDs: [1, 2, 3]
Libraries: {'I2C'}
Show all properties
>> x = scanI2CBus(a,1)
x =
2×1 cell array
{'0x48'}
{'0x49'}
>> deviceObj = device(a,'I2CAddress','0x49')
Invalid I2C device address '0x49'. Use scanI2CBus for a list of devices detected on an I2C bus.
>> deviceObj = device(a,'I2CAddress',0x49)
Invalid I2C device address '0x49'. Use scanI2CBus for a list of devices detected on an I2C bus.
I am not able to figure out what I am doing wrong in the deviceObj creation.
May you please suggest a solution for this?

Connectez-vous pour commenter.

Plus de réponses (4)

Madhu Govindarajan
Madhu Govindarajan le 16 Avr 2019
The tutorial is still valid as I am using it in R2019a, so let's try and see where the error is coming from.
Type the following in MATLAB and share the output:
matlabshared.supportpkg.getInstalled
tbx = matlab.addons.toolbox.installedToolboxes
tbx.Name
tbx.Version

Kevin Graebner
Kevin Graebner le 18 Avr 2019
thank you kind sir! i apprecaite your assistance very greatly.
ok. when i first try to do arduino setup. it gives me this error repeatedly.
"Warning: Class arduinoio.LibraryBase will be removed. Following Add-On classes need to be updated to work in future
release : Arduino/MKRMotorCarrier. Follow steps mentioned in this Arduino Add-On document to update. Click here to
turn off this warning.
Warning: Class arduinoio.AddonBase will be removed. Inherit class arduinoioaddons.arduino.MKRRotaryEncoder from
matlabshared.addon.LibraryBase instead. For more information, see Arduino Add-On document.Click here to turn off
this warning."
wen i go to the link they give and type the commands exactly, i get this
">> classdef MyAddon < matlabshared.addon.LibraryBase
classdef MyAddon < matlabshared.addon.LibraryBase
Error: Illegal use of reserved keyword "classdef"."
-------------------------------------------------------------------------------
when i try to follow tutorial, and type in your commands i get this response.
>> matlabshared.supportpkg.getInstalled
Name Version Base Product
--------------------------------------------- ------- ------------
Simulink Support Package for Arduino Hardware 19.1.0 Simulink
MATLAB Support Package for Arduino Hardware 19.1.0 MATLAB
MATLAB Support Package for USB Webcams 19.1.0 MATLAB
MATLAB Support for MinGW-w64 C/C++ Compiler 19.1.0 MATLAB
>>
>> tbx = matlab.addons.toolbox.installedToolboxes
tbx =
1×2 struct array with fields:
Name
Version
Guid
>> tbx.Name
ans =
'Arduino_Engineering_Kit_Project_Files'
ans =
'Arduino_Engineering_Kit_Hardware_Support'
>>
>> tbx.Version
ans =
'1.2'
ans =
'1.1.2'
thank you again!

Kevin Graebner
Kevin Graebner le 18 Avr 2019
thank you very much my friend! it works perfectly now.
i apprecite you very much!
have a great and happy day!

Kevin Graebner
Kevin Graebner le 23 Avr 2019
i am having another issue if you are still available for assistance!
when i try to just put a few arduino digtal inputs in sumulink and hook it up to a scope to test if the buttons work it gives me this error.
i went to simulation, model configuration, hardware implimentation, have the correct board selected. even tried manually setting the COM port. re-installing the latest matlab and simulink support for arduino.
any thoughts or ideas you have would be most apprecaited!
Simulation
3 1
Clear
07:18 AM Elapsed: 26 sec
### Starting build procedure for model: untitled
Code Generation
1
Elapsed: 22 sec
AVR Memory Usage ---------------- Device: atmega328p Program: 19560 bytes (59.7% Full) (.text + .data + .bootloader) Data: 864 bytes (42.2% Full) (.data + .bss + .noinit)
### Build procedure for model: 'untitled' aborted due to an error.
The following error occurred during deployment to your hardware board: Could not connect to specified Arduino board. Verify that the board is connected to your host, and that the host COM port number set in the model matches the COM port number in Windows. To change the host COM port number in the model, click 'Simulation ', click 'Model Configuration Parameters'... In the dialog that opens, select the 'Hardware Implementation' pane, click 'Target hardware resources > Host-board connection' and set the COM port number. To find out the COM port number in Windows, open Device Manager and open your board in the COM ports group.
  1 commentaire
Madhu Govindarajan
Madhu Govindarajan le 23 Avr 2019
Have you tried putting the board in bootloader mode and making Simulink select the COM port Automatically. Here are the steps to try:
1) Double press the reset button on your Arduino board.
2) Open up Device Manager and check if the board is now detected in boot loader mode. If not repeat Step 1 till it changes to boot loader mode.
3) Go to Simulink model, Configuration Parameters > Hardware Implementation > Hardware board settings > Target hardware resources > Host-board connection > Set host COM port > Automatically and click OK.
4) Ensure the mdoel is in external mode and press play.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by