Simulink IO enabled error on Arduino Uno

62 次查看(过去 30 天)
I am trying to use the Simulink IO enabled feature in MATLAB 2018a. The platform is an Arduino Uno. Even with the simplest example, for instance trying to read from pin 4 and displaying it I get an error although simulation mode works fine without IO enabled, and when I load the program onto the hardware it also works fine. Here is error that I see when I enable Simulink IO:
MATLAB System block 'blink2/Digital Input/Digital Input' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.blocks.DigitalRead'. The error was thrown from '
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+transport\TransportLayerAbstract.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\DigitalIO.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+blocks\DigitalRead.p' at line 0'.
Caused by:
Transport layer object is corrupted. Try fclose(instrfind) and delete(instrfind) and then create a new hardware object
  3 个评论
Alex Kuzmichev
Alex Kuzmichev 2018-7-6
编辑:Walter Roberson 2018-7-7
I am trying run arduino_communication in normal mode with Simulink and I get same error:
MATLAB System block 'arduino_communication/Digital Output/Digital Output' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.blocks.DigitalWrite'. The error was thrown from '
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+transport\TransportLayerAbstract.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\DigitalIO.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+blocks\DigitalWrite.p' at line 0'.
*Caused by:
Transport layer object is corrupted.* Try fclose(instrfind) and delete(instrfind) and then create a new hardware object
After
fclose(instrfind)
delete(instrfind)
I get
...
*Caused by:
Instrument object OBJ is an invalid object.*
Claudio Eduardo Santiago
Eu tive o mesmo problema. Não consegui comunicação.

请先登录,再进行评论。

采纳的回答

Marc Fuller
Marc Fuller 2018-6-1
I have found that the problem was using a Sparkfun Redboard, which is an Arduino Uno clone. It uses a different serial port. Once I switched to an Arduino Uno the problem resovled.

更多回答(6 个)

Marc Fuller
Marc Fuller 2018-5-31
Tried that - same result.

Kaninika Pant
Kaninika Pant 2018-6-1
Try clearing the workspace. Try clear all, clear classes. Also try disconnecting the board and reconnecting it once.

Steffen Hartmann
Steffen Hartmann 2018-10-30
Hello, have the same problem here. Was it really the "incompatible" uno-board?

Kadir Tolga Dogukanli
I have the same errors. Did you solve the problem?
MATLAB System block 'sondeneme/I2C Read' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.internal.arduinoI2CRead'. The error was thrown from '
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+transport\TransportLayerAbstract.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\I2C.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduinoI2CRead.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\shared\svd\+matlabshared\+svd\I2CBlock.p' at line 0'.
Caused by:
Transport layer object is corrupted. Clear and recreate the hardware object
Component:Simulink | Category:Block error

Jussi Savola
Jussi Savola 2019-4-9
编辑:Jussi Savola 2019-4-9
Me too.
I'm trying to read data from A4, then do some fancy stuff with FFT and then light up a led in D10.
I'm using Matlab 2018A with Arduino (Elegoo) Mega 2560
Simulation 1 Clear
01:55 AM Elapsed: 28 sec
MATLAB System block 'blinker_a/Analog Input' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.internal.arduino_AnalogInput'. The error was thrown from '
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+transport\TransportLayerAbstract.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\AnalogInput.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduino_AnalogInput.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2018a\toolbox\target\shared\svd\+matlabshared\+svd\AnalogInSingle.p' at line 0'.
Caused by:
Transport layer object is corrupted. Try fclose(instrfind) and delete(instrfind) and then create a new hardware object
Edit: It seems that disabling Simulink I/O made the error go away. Go figure.

Lokendra Samba
Lokendra Samba 2020-6-14
go to this thread, you may find solution!!
https://de.mathworks.com/matlabcentral/answers/351957-do-simulink-deploy-to-hardware-and-external-modes-work-with-arduino-uno-clones
i have same problem, but changing 'BaudRate' help me solve problem. now it works for all mode for me.

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by