aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--pi_configs/boot/firmware/config.txt55
-rw-r--r--pi_configs/etc/home/Spartan_Racing_Charger/.config/systemd/user/mycan.service11
-rw-r--r--pi_configs/etc/systemd/system/can0.service11
4 files changed, 80 insertions, 4 deletions
diff --git a/README.md b/README.md
index b6cf48b..33c05fc 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,8 @@ mycan vcan0
all_SRE_edited.c and all_SRE_edited.h are auto generated by [dbcc](https://github.com/howerj/dbcc) via `dbcc all_SRE_edited.dbc`, see Makfile. all_SRE_edited.dbc is edited from [SR-16 Custom BMS.dbc](https://github.com/spartanracingelectric/SR16-CustomBMS/blob/main/SR-16%20Custom%20BMS.dbc) by editing some lines to make dbcc work.
-Infrastructure configs not included yet on raspberry pi:
-- /etc/wireguard/wg0.conf wireguard config
-- /etc/NetworkManager/system-connections/wg0.nmconnection networkmanager wireguard config imported from wireguard config
-- /etc/modules-load.d/wireguard.conf autostart load wireguard kernel module, see <https://wiki.archlinux.org/title/Kernel_module#systemd>
+Infrastructure configs, included in pi_configs dir
+- I prefer manage infrastructure configs using my [cfg](https://git.flylightning.xyz/fsh/tree/sh/cfg) script, but that script is my personal project and I don't want to force people to use that, so I include those config files in this repo and I did not manage it with my cfg script on raspberry pi.
+- /boot/firmware/config.txt raspberry pi configs to make CAN hat work, make CAN network interface on raspberry pi work
- /etc/systemd/system/can0.service autostart CAN network interface configs
- /home/Spartan_Racing_Charger/.config/systemd/user/mycan.service autostart mycan
diff --git a/pi_configs/boot/firmware/config.txt b/pi_configs/boot/firmware/config.txt
new file mode 100644
index 0000000..2274249
--- /dev/null
+++ b/pi_configs/boot/firmware/config.txt
@@ -0,0 +1,55 @@
+dtparam=spi=on
+dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
+
+# For more options and information see
+# http://rptl.io/configtxt
+# Some settings may impact device functionality. See link above for details
+
+# Uncomment some or all of these to enable the optional hardware interfaces
+#dtparam=i2c_arm=on
+#dtparam=i2s=on
+#dtparam=spi=on
+
+# Enable audio (loads snd_bcm2835)
+dtparam=audio=on
+
+# Additional overlays and parameters are documented
+# /boot/firmware/overlays/README
+
+# Automatically load overlays for detected cameras
+camera_auto_detect=1
+
+# Automatically load overlays for detected DSI displays
+display_auto_detect=1
+
+# Automatically load initramfs files, if found
+auto_initramfs=1
+
+# Enable DRM VC4 V3D driver
+dtoverlay=vc4-kms-v3d
+max_framebuffers=2
+
+# Don't have the firmware create an initial video= setting in cmdline.txt.
+# Use the kernel's default instead.
+disable_fw_kms_setup=1
+
+# Run in 64-bit mode
+arm_64bit=1
+
+# Disable compensation for displays with overscan
+disable_overscan=1
+
+# Run as fast as firmware / board allows
+arm_boost=1
+
+[cm4]
+# Enable host mode on the 2711 built-in XHCI USB controller.
+# This line should be removed if the legacy DWC2 controller is required
+# (e.g. for USB device mode) or if USB support is not required.
+otg_mode=1
+
+[cm5]
+dtoverlay=dwc2,dr_mode=host
+
+[all]
+enable_uart=1
diff --git a/pi_configs/etc/home/Spartan_Racing_Charger/.config/systemd/user/mycan.service b/pi_configs/etc/home/Spartan_Racing_Charger/.config/systemd/user/mycan.service
new file mode 100644
index 0000000..1282f7d
--- /dev/null
+++ b/pi_configs/etc/home/Spartan_Racing_Charger/.config/systemd/user/mycan.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Start mycan to process CAN
+After=can0.service
+
+[Service]
+Type=simple
+ExecStart=/usr/local/bin/mycan
+
+[Install]
+WantedBy=default.target
+
diff --git a/pi_configs/etc/systemd/system/can0.service b/pi_configs/etc/systemd/system/can0.service
new file mode 100644
index 0000000..70b59df
--- /dev/null
+++ b/pi_configs/etc/systemd/system/can0.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Setup can0 CAN bus
+After=network.target
+
+[Service]
+Type=oneshot
+ExecStart=sh -c 'ip link set can0 up type can bitrate 500000; \
+ ifconfig can0 txqueuelen 65536'
+
+[Install]
+WantedBy=multi-user.target