How to Fix CAN Controller Initialization Error in ATmega2560 with Zephyr OS?

Hey guys, I am trying to implement a real-time control system for automotive applications using an ATmega2560 microcontroller, an MCP2515 CAN controller, and Zephyr OS, while integrating a Bosch BMP280 sensor for pressure data. How can I address the error of failing to initialize the CAN controller? I have tried configuring the SPI peripheral in Zephyr, integrating the MCP2515 CAN controller, and the Bosch BMP280 sensor, but I still encounter the error "CAN: Device driver not found." If the implementation is successful, the output should log a message indicating that the CAN frame has been sent successfully. Here is my code in the attached file.
attachment 0
Solution:
Yeah, I was able to redefine the MCP2515 CAN controller in the device tree file and also confirmed that the MCP2515 CS pin is correctly configured. I've been able to get a lead on it, thanks buddy @RED HAT
Jump to solution
2 Replies
RED HAT
RED HAT5mo ago
@Dtynin Make sure the MCP2515 CAN controller is correctly defined in your device tree file. The CAN_0 device binding you use should match the label in the device tree.
Solution
Dtynin
Dtynin5mo ago
Yeah, I was able to redefine the MCP2515 CAN controller in the device tree file and also confirmed that the MCP2515 CS pin is correctly configured. I've been able to get a lead on it, thanks buddy @RED HAT
Want results from more Discord servers?
Add your server