5 - 20
emPC-A/RPI3
(
Hardware and
Software Manual)
•
Operating System and Drivers
©
Janz Tec AG
Rev. 1.3
5.2.4.1 spi-bcm2835 : SPI driver (optimized for emPC-A/RPI3)
CAN and RS232/RS485 controllers are connected by SPI to the Raspberry PI board and we have
optimized the default Raspberry SPI (spi-bcm2835) driver for better performance.
5.2.4.2 mcp2515 : CAN driver (optimized for emPC-A/RPI3)
This driver installation includes a SocketCan compatible driver. In the configuration file
/etc/network/interfaces the CAN device with the Linux device name
can0
is enabled by default (bus-
on) and is configured to 500Kbit (bitrate 500000). To change the default bitrate, edit file
/etc/network/interfaces, change the bitrate parameter and restart your system.
Here are some can-utils examples:
Print incoming can frames:
pi@raspberry ~$
candump can0
Send random can frames:
pi@raspberry ~$
cangen can0
Show can bus load information:
pi@raspberry ~$
canbusload can0@500000 -r -t -b -c
NOTICE
On high CAN-bus utilization, incoming CAN frames might get dropped because of an
overrun in the MCP2515 FIFO. To reduce the possibility of such overruns, we have
highly optimized the CAN and SPI drivers to receive incoming CAN frames significant
faster than the default mcp2515 Linux driver. As a result, even with high bus utilization,
baudrates up to 500Kbit/s can be used with (almost) no CAN frame drops. Because of
the limitations of the MCP2515 controller and the interrupt latency of Linux, the 1Mbit/s
baudrate is not recommend, when CAN frame drops cannot be accepted.
5.2.4.3 sc16is7xx : RS232/RS485 driver (optimized for emPC-A/RPI3)
By default the emPC-A/RPI3 is configured to RS232 mode (Jumper J301 is set).
If you want to use RS485 mode, open the case as described in chapter 4 and remove the jumper J301
and check the following configuration:
pi@raspberry ~$
sudo nano /boot/cmdline.txt
When parameter RS485 is set t
o 2 (RS485=2), then ‘automatic mode’ is enabled. Starting with
hardware revision 1.1, this parameter sets RS232 or RS485 mode based on the jumper J301 setting
and no further manual software configuration is required. For older hardware revisions, manually
configuration as shown below is required.
Parameter RS485=1 enables the automatic RS485 RTS control mode and automatically controls the
RS485 transceiver direction for sending or receiving.
Parameter RS485=0 disabled the RS485 mode and enables normal RS232 operation.