Arduino Due CAN bus Communication via Simulink

조회 수: 12 (최근 30일)
Min
Min 2024년 5월 24일
답변: Min 2024년 6월 6일
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