Error running BNO055 through Simulink on an Arduino Uno

18 ビュー (過去 30 日間)
Walker Hare
Walker Hare 2023 年 2 月 8 日
回答済み: Raj 2024 年 2 月 8 日
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 件のコメント
Walker Hare
Walker Hare 2023 年 2 月 14 日
R2022b
Thanks
Radko
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
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!

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by