Hello Eduard,
Let me answer your questions:
- I've set the DIP switches 2 & 4 to ON on the bottom face of the PLC.
That is okay for expansion slot 2. For expansion slot you do not need to configure anything.
- I'm pretty sure my client chose Expansor slot 1 when buying the PLC, but just in case I've tried both configurations:
For Expansor 1: RSTpin 6, INTpin 5, pinCS 32
For Expansor 2: RSTpin 3, INTpin 1, pinCS 2
Expansor 1 is usually used when there is only one expansion board (regardless of what is chosen on the website). Nonetheless, you can try both. Also, if you remove the top cover (where the LEDs are) you can see where the expansion boards is located:
- 1 is the one further away form the Ethernet port.
- 2 is the one next to the Ethernet port.
-
Is the quartz clock on the CAN board 8MHZ? Could one with 16MHz have
been installed by mistake (I say this because it happened to me once
with a similar CAN board)?
The CAN post you link was in fact updated not long ago due to the oscillator frequency.
The oscillator on our CAN devices works at 10MHz. For this reason, the library and examples on the post have the "MCP_10MHZ" macro, to properly configure the CAN controller.
- From what I've read about
Arduino CAN boards in general, the initialization doesn't require that
any other device is connected through H & L lines, nor that I
connect the 120ohm terminations yet. I've still tried it just in case.
That is right, the initialization can be done without any other device connected to the CAN bus.
Regarding the impedance adaptation, the CAN board already has a 120Ohm resistor in it, active by default. If you need to disable it, it can be done by removing a jumper located on the board.
- Where exactly are the 3 pins physically connected? Are RSTpin and INTpin on the expansor, and pinCS on the ESP32?
That is right. The used pins are:
- Expansion slot 1:
- The ESP32 SPI pins (MISO, MOSI, SCK)
- CS: GPIO 2 (ESP32)
- RST: 3 (expansor)
- INT: 1 (expansor)
- Expansion slot 2:
- The ESP32 SPI pins (MISO, MOSI, SCK)
- CS: GPIO 32 (ESP32)
- RST: 6 (expansor)
- INT: 5 (expansor)
Please try one of the examples on the post, for example the receive one. After uploading it, you should see the following message on the serial monitor (with no need to have any other device connected through CAN):
Entering Configuration Mode Successful!
Setting Baudrate Successful!
MCP2515 initialized successfully!
Please try this and let us know what results you get!