- 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.
Building small CAN-Communication System with two Arduino Mega 2560 and MCP2515
17 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Yash
on 10 Jan 2024
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:
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
0 Comments
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!