diff --git a/ansible/roles/canfd/meta/main.yaml b/ansible/roles/canfd/meta/main.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/ansible/roles/canfd/tasks/main.yaml b/ansible/roles/canfd/tasks/main.yaml new file mode 100644 index 00000000000..a81837470a6 --- /dev/null +++ b/ansible/roles/canfd/tasks/main.yaml @@ -0,0 +1,28 @@ +- name: Add systemd managed CAN interface + ansible.builtin.blockinfile: + path: /etc/systemd/network/80-can.network + create: true + mode: "0644" + block: | + [Match] + Name=can* + + [CAN] + BitRate=500000 + FDMode=yes + SamplePoint=75% + DataBitRate=4000000 + DataSamplePoint=80% + RestartSec=0.5s + become: true +- name: Add CAN utils + ansible.builtin.apt: + name: can-utils + become: true +- name: Disable network wait on boot + ansible.builtin.systemd: + unit: systemd-networkd-wait-online.service + enabled: false + state: stopped + masked: true + become: true diff --git a/ansible/roles/canfd_pi/meta/main.yaml b/ansible/roles/canfd_pi/meta/main.yaml new file mode 100644 index 00000000000..7144d728269 --- /dev/null +++ b/ansible/roles/canfd_pi/meta/main.yaml @@ -0,0 +1,2 @@ +dependencies: + - role: autoware.dev_env.canfd diff --git a/ansible/roles/canfd_pi/tasks/main.yaml b/ansible/roles/canfd_pi/tasks/main.yaml new file mode 100644 index 00000000000..7251346dc4d --- /dev/null +++ b/ansible/roles/canfd_pi/tasks/main.yaml @@ -0,0 +1,20 @@ +- name: Disable serial console + ansible.builtin.replace: + path: /boot/firmware/cmdline.txt + # backup: yes + regexp: console=serial0,[0-9]+ + replace: "" + become: true +- name: Enable CAN FD driver + ansible.builtin.blockinfile: + block: | + dtparam=spi=on + + # Disable internal bluetooth + dtoverlay=disable-bt + + dtoverlay=spi0-2cs,cs0_pin=8,cs1_pin=7 + dtoverlay=mcp251xfd,spi0-0,interrupt=25,oscillator=20000000 + # backup: yes + path: /boot/firmware/config.txt + become: true