Read and Write CAN protocol messages using SPI through an Arduino Uno

9 ビュー (過去 30 日間)
Danyal Pike
Danyal Pike 2019 年 4 月 3 日
コメント済み: Jenny H 2020 年 6 月 3 日
I have been spending a significant amount of time trying to find an answer to this but cannot find the full solution. I would appreciate some help on the issue. A bit of background to my issue:
  • I am designing a set of hardware and software tools that can be used to quickly assess and test components in a car that utilise CAN protocol
  • The objective of the set of tools is that anyone with Simulink can grab this kit, connect it up to their laptop and rapidly run a model through Simulink in order to send a few messages to the hardware and read the response. It has to be using simulink
  • The hardware consists of (but is not limited to) an Arduino Uno and an MCP2515 CAN controller module (https://makerfabs.com/Comunication?product_id=340)
  • I have the CANdbs for the hardware I'm trying to test
I have been using the "Simulink Support Package for Arduino" for communication and can drive parts of the 12V components, however when it comes to sending a CAN message, I'm having trouble constructing the blocks to achieve this. I have been trying to use the "CAN device driver for mcp2515" and the CAN blocks from the "Vehicle Network Toolbox" but have come up short.
Could someone provide feedback on the attached image and help guide me towards a solution? I'm not sure if I'm being a bit dim or I've gotten something fundamentally wrong.
  1 件のコメント
Jenny H
Jenny H 2020 年 6 月 3 日
I see the MCP2515 CAN controller module's link is broken, are you talking about this MCP2515 module: https://makerfabs.com/can-module-mcp2515.html?

サインインしてコメントする。

回答 (1 件)

Arun Kumar
Arun Kumar 2019 年 9 月 27 日
Hi,
Support for sending and receiving CAN messages from Arduino using MCP2515 is available in R2019b.
Use these blocks to send and receive CAN Messages:
  1. CAN Transmit: https://in.mathworks.com/help/supportpkg/arduino/ref/cantransmit.html
  2. CAN Receive: https://in.mathworks.com/help/supportpkg/arduino/ref/canreceive.html
Here are some examples on how to use the blocks:
Hope this helps.
  2 件のコメント
Danyal Pike
Danyal Pike 2019 年 9 月 30 日
Hi,
Thanks for the links and tutorials. This still requires the use of 2019b which isn't yet supported at my company.
Is there another method where it can be used in 2019a and earlier?
Regards,
Danyal
Arun Kumar
Arun Kumar 2019 年 9 月 30 日
Hi Danyal,
For 2019a or earlier, you can use the following library block:
HTH!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDevice Driver Blocks についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by