Skip to content

Additional consideration

Robert Crowley edited this page Oct 23, 2021 · 6 revisions

Additional Considerations

Future contributions and changes may require documentation to be expanded. All that information will be documented here. NOTE: The install script will create and configure all of the items below except for the brightness module and socketcan functionality (because not everyone has that display or setup).

Some things to consider when configuring your system:

  • Utilize the experimental gl driver with Fake KMS for qt-gstreamer usage (explained below)
  • Set the background color to black and hide any desktop elements (icons, panel, dock, etc.)
  • Set USB permissions (explained below)

Enable GL Driver on Raspberry Pi

1. Open a terminal

2. Run the following command:

sudo raspi-config

Using the arrow keys, Choose Advanced Options > GL Driver > G2 GL (Fake KMS) OpenGL desktop driver with fake KMS > Ok > Finish > Reboot

Create Secure udev Rules

In order to use OpenAuto with Linux-based OS (i.e. RaspbianOS), a rule must be created that allows communication with USB devices in R/W mode.

NOTE - sudo must be used when creating the rules file due to the permissions on the directory in this location

1. Create secure udev rules for OpenAuto purposes by doing the following:

cd /etc/udev/rules.d
sudo nano openauto.rules

2. Copy and paste the below rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="*", ATTR{idProduct}=="*", MODE="0660", GROUP="plugdev"

NOTE - This rule allows for any USB device to be opened in R/W mode by any app installed on the system. It is considered unsecure.

3. If you have the official Raspberry Pi 7" touchscreen, add the following rule as well (if not, skip this step):

# udev rules to allow write access to all users for Raspberry Pi 7" Touch Screen
SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness"_

4. Save the file by pressing Ctrl+x, press y to accept the filename, then press Enter

5. Reboot your device.

Enable Socketcan Functionality (Raspberry Pi)

Socketcan via SPI

1. Install Can-Utils:
sudo apt install -y can-utils libsocketcan2 libsocketcan-dev
2. Append /boot/config.txt with:
# CAN-BUS Overlay
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=mcp2515-can1,oscillator=8000000,interrupt=26  # Optional 
dtparam=spi=on
NOTE: The dtoverlay for your device may differ. Refer to your CAN device documentation.
2. Append /etc/network/interfaces with:
auto can0  
iface can0 inet manual
   pre-up /sbin/ip link set can0 type can bitrate 125000 triple-sampling on restart-ms 100
   up /sbin/ifconfig can0 up txqueuelen 125
   down /sbin/ifconfig can0 down
auto can1      # Optional
iface can1 inet manual    
   pre-up /sbin/ip link set can1 type can bitrate 500000 triple-sampling on restart-ms 100   
   up /sbin/ifconfig can1 up txqueuelen 500  
   down /sbin/ifconfig can1 down
4. Reboot:
sudo reboot
5a. Check Hardware & Network Status:
dmesg | grep mcp && ifconfig | grep can  
5b. Successful Result:
[    3.139428] mcp251x spi0.1 can0: MCP2515 successfully initialized.    
[    3.150549] mcp251x spi0.0 can1: MCP2515 successfully initialized.    
can0: flags=193<UP,RUNNING,NOARP>  mtu 16   
can1: flags=193<UP,RUNNING,NOARP>  mtu 16  

Socketan via Serial USB Device

1. Install Can-Utils:
sudo apt install -y can-utils libsocketcan2 libsocketcan-dev
2. Append /etc/network/interfaces with:
auto slcan0  
 iface can0 inet manual  
    pre-up /bin/slcand -o -s 500000 /dev/ttyACM0 && sbin/ip link set up slcan0  
    up /sbin/ifconfig slcan0 up      
    down /sbin/ifconfig slcan0 down
3. Reboot & Connect USB Device :
sudo reboot
4a. Check Hardware & Network Status:
ifconfig | grep can
4b. Successful Result:
slcan0: flags=193<UP,RUNNING,NOARP>  mtu 16

OBDII/ELM327

TBC

Clone this wiki locally