
EIglesias (Customer) asked a question.
I'm facing challenges while configuring the P1AM-100 Controller with the MKR CANBUS SHIELD, along with the P1AM-ETH, P1AM-SERIAL, and three P1-04TRS modules.
My setup involves integrating CANBUS functionality alongside Ethernet and serial communication modules.
I’ve tried running this configuration with the can.h library, but I haven't been able to achieve the desired outcome. The system fails to initialize the Ethernet, and the CAN is not transmitting the expected messages to the bus.
Has anyone encountered similar projects or configurations? Any tips, positive feedback, or advice would be greatly appreciated to help me troubleshoot and improve the setup.
Since the ETH and CAN are both SPI devices, I would start by setting each of their CS pins high manually.
In this case that would be pins 5 and 3. Afterwards you can call the init routines and other functions as you'd normally do.
I tried implementing your suggestions, but I'm still having trouble getting the communications to work in this configuration. Could you take a look at the attached code and see if you can identify what might be going wrong?
Right after you set your CS pins high for ETH and CAN, call P1.init()
Also, do not manually control your CS pins as you have shown. The libraries will handle that for you.
I've tried to implement the changes you suggested, but haven't had much success.
How are you powering the P1AM. The P1AM itself and the modules on the left can be powered from USB but modules right of the P1AM require either a P1 power supply or to be powered from the terminal on the bottom of the P1AM
I am using a DCDC to provide 24VDC to the modules using the power terminal beneath the P1AM-100.
Is your P1AM library and board package up to date?
Yes, the libraries are up to date. The CAN.h library by Sandeep Mistry is version 0.3.1, the Ethernet library is version 2.0.2, and the P1AM library is version 1.0.9. The board is using the P1AM-100 package, version 1.6.21.
Modifying 10E6 to 8E6 in the CAN library successfully initializes the CANBUS, but the messages aren’t being transmitted to the bus. I can observe other device messages on the same CANBUS, indicating that the connection to the analyzer is stable. Using an oscilloscope to inspect the bus, I see no transmission from the CANBUS shield.
Additionally, the Ethernet module still isn't initializing.
I suspect that the SPI setup, either in the code or the libraries, needs to be adjusted, as the issue affects both the CAN and Ethernet bases. If you have any insights or suggestions regarding the potential causes of these issues, I would greatly appreciate any input.
I noticed that the silkscreen labels for CAN High and CAN Low on the MKR CAN Shield are reversed. I'm not sure if the CAN.h library has a configuration setting to compensate for this, but after swapping the connections manually, everything is now transmitting and receiving correctly.