Error running BNO055 through Simulink on an Arduino Uno
19 次查看(过去 30 天)
显示 更早的评论
I am simply trying to read output data from a BNO055 through Simulink on an Arduino Uno. This is the error code I am recieving when I try to run it on hardware:
MATLAB System block 'bno055test/BNO055 IMU Sensor' error occurred when invoking 'getSampleTime' method of 'codertarget.arduinobase.internal.arduinoBNO055'. The error was thrown from ' 'C:\Program Files\MATLAB\R2022b\toolbox\rtw\rtw\tlc_c.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\coder\simulinkcoder_core\+coder\+internal\ModelBuilder.m' at line 722 'C:\Program Files\MATLAB\R2022b\toolbox\coder\simulinkcoder_core\+coder\+internal\ModelBuilder.m' at line 119 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\private\build_target.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\private\build_target.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\private\build_standalone_rtw_target.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\private\slbuild_private.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\private\slbuild_private.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\sl_feval.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\slbuild.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\slbuild.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\simulink\core\general\slprivate.p' at line 0 'C:\Program Files\MATLAB\R2022b\toolbox\coder\sltoolstrip_base_hw\m\+coder\+internal\+toolstrip\HardwareBoardHandler.m' at line 121 'C:\Program Files\MATLAB\R2022b\toolbox\target\codertarget\sltoolstrip\m\+codertarget\+sltoolstrip\EmbeddedHardwareBoardContext.m' at line 252 'C:\Program Files\MATLAB\R2022b\toolbox\target\codertarget\sltoolstrip\m\+codertarget\+sltoolstrip\EmbeddedHardwareBoardContext.m' at line 218 'C:\Program Files\MATLAB\R2022b\toolbox\coder\sltoolstrip_base_hw\m\+coder\+internal\+toolstrip\HardwareBoardContext.m' at line 346'.
Caused by:
- The return value from 'getSampleTimeImpl' must be an instance of 'matlab.system.SampleTimeSpecification'.
It is not a board issue as I am able to run a Servo with no issues through Simulink. It also isnt a problem with the BNO055 as I am able to use it using the test code through Arduino. Any help would be much appreciated. Thanks
3 个评论
Radko
2023-11-19
Hi, very similar here:
MATLAB System block 'IMU_0/BNO055 IMU Sensor/Base sensor block' error occurred when invoking 'setupImpl' method of 'codertarget.arduinobase.internal.arduinoBNO055'. The error was thrown from '
'C:\Program Files\MATLAB\R2023b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\IOProtocol.p' at line 0
'C:\Program Files\MATLAB\R2023b\toolbox\target\shared\ioserver\+matlabshared\+ioclient\+peripherals\I2C.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduinoI2CWrite.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduinoBNO055.p' at line 0
'C:\ProgramData\MATLAB\SupportPackages\R2023b\toolbox\target\supportpackages\arduinobase\+codertarget\+arduinobase\+internal\arduinoBNO055.p' at line 0
'C:\Program Files\MATLAB\R2023b\toolbox\target\codertarget\sltoolstrip\m\+codertarget\+internal\+sltoolstrip\ConnectedIOHandler.m' at line 106
'C:\Program Files\MATLAB\R2023b\toolbox\target\codertarget\sltoolstrip\m\+codertarget\+sltoolstrip\EmbeddedHardwareBoardContext.m' at line 523'.
Caused by:
Error writing IOServerBlock.
Invalid operation. Object must be connected to the serial port.
Matlab 2023b
回答(1 个)
Raj
2024-2-8
Hi Walker,
I went through the Simulink model that you attached. I was able to run the model without any errors with few minor warnings in MATLAB R2022b and R2023a release. I have attached screenshots for both of them.
The issue you are facing might be due to incomplete installatation of the necessary libraries. Try reinstalling 'Simulink Support Package for Arduino Hardware' from Add-Ons icon in MATLAB Toolstrip.
Additionally you can refer to the 'Simulink Support Package for Arduino Hardware' documentation link below for better understanding-
Hope this fixes the error you had and you are able to proceed further!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!