필터 지우기
필터 지우기

Building small CAN-Communication System with two Arduino Mega 2560 and MCP2515

조회 수: 23 (최근 30일)
Lorenz Klaus
Lorenz Klaus 2022년 6월 29일
답변: Yash 2024년 1월 10일
Hi, I am eagerly trying to build a CAN communication System for reading and writing Data on a CAN bus with an Arduino Mega 2560 and a MCP2515 shield.(https://www.az-delivery.de/products/mcp2515-can-bus-modul)
Therefore I tried the Simulinik examples for CAN-Transmit and CAN-Receive:
My problem is that the Transmit block does not transmit any Signals as far as I could check that.
I also used the LED-Output on the Arduino to check if the Transmit Block sends messages, but the LED did not light up. The Code should be built properly because i checked the signal infront of the transmit block with a scope block.
Since I have tried a lot to solve this situation and do not really know what to try next, I would be very pleased if somebody of you could help me.
Kind regards,
Lorenz

답변 (1개)

Yash
Yash 2024년 1월 10일
Hi Lorenz,
When working with hardware like the Arduino Mega 2560 and the MCP2515 CAN bus module, there are several points you need to check to troubleshoot communication issues. Here's a checklist to help you diagnose and resolve the problem:
  • Double-check the wiring. Ensure that the MCP2515 module is properly connected to the Arduino Mega 2560.
  • Make sure that the baud rate set in your Simulink model matches the baud rate of the CAN network you're trying to communicate with.
  • Check the block parameters in Simulink to make sure they match your hardware setup, such as the correct SPI Chip Select (CS) pin.
  • Confirm that the code is being generated without errors and is successfully uploaded to the Arduino Mega 2560.
I recommed to write a simple Arduino sketch in Arduino ISE (outside of Simulink) that initializes the CAN module and attempts to send a message. This can help determine if the issue is with the hardware setup or the Simulink model. This will help you to identify where the the issue is coming from in case the above workarounds don't work.
Hope this helps

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by