Arduino Due CAN bus Communication via Simulink

8 次查看(过去 30 天)
Hi,
I have Arduino Due with CAN shield to read and send CAN messages but some reason I was not able to read with the message via CAN receive block by Arduino Support Package.
I was successfully able to read the CAN message if I use the Arduino IDE but not with Simulink.
I did check both CP, SPI, and Inturrup Pin set up which matches what I have on Arduino IDE.
Can someone explain how this works?
My current blocks are
CAN Receive (Arduino Package) -> CAN Unpack (With DBC File) -> Scope.
THanks!

采纳的回答

Min
Min 2024-6-6
Forgot to answer and share the knowledge that I have since the issue has been conditionally resolved.
  1. It is possible to read the CAN message via Arduino as long as the hardware set up is appropriate.
  2. It is required to follow this step to not fail the CAN set up
  • Turn off the system
  • Plug the Arduino without turning the entire system on
  • Deploy the Simulinik model
  • Once it is deployed turn on the entire system
Sending CAN message is also posisble but with Arduino, it is limited due to its speed.
I am currently looking into using Raspberry Pi for higher speed (84 Mhz vs 1.4 Ghz).

更多回答(1 个)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU 2024-6-6
Hi Min,
Simulink's CAN Receive block might not fully support Due's CAN bus. Consider using the S-Function Block for more control.
There could be mismatches between Simulink's generated code and your CAN shield setup. Enable Simulink's Hardware Logging to monitor CAN communication during simulation.
If these suggestions don't help, share details about your CAN shield, DBC file, and relevant code for further troubleshooting.

类别

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

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by