marcone / teslausb

A smart USB drive for Tesla Dashcam - extended storage, auto archive, web viewer
MIT License
1.95k stars 355 forks source link

Add support for Raspberry Pi 5 #800

Closed withinfocus closed 9 months ago

withinfocus commented 1 year ago

Begins support for Pi 5 that has essentially all the capabilities of Pi 4 and more. USB gadget support isn't quite ready on the PI OS based on Bookworm (that's needed for the 5) per https://github.com/raspberrypi/bookworm-feedback/issues/77 so this is waiting on some firmware updates before it can actually be used and tested, but thought I'd push an initial update for review.

There's a number of whitespace and Markdown formatting changes my editor caught that are also included.

marcone commented 11 months ago

As you said, this depends on future Raspberry Pi OS changes so I don't want to merge this until it actually works. Also, I would really prefer to not mix functional changes with unrelated whitespace changes. The fact that your particular editor prefers some other formatting isn't a good enough reason to reformat large swaths of text. If there's a strong case for the reformatting, it should be done as a separate change.

withinfocus commented 11 months ago

@marcone definitely agree about the formatting being a separate change, and I pushed #802 for your review.

withinfocus commented 10 months ago

Rebased for the moment, but I'll get to some testing of this.

KrzysztofHajdamowicz commented 10 months ago

Does gadget mode work on Pi 5 now?

Seems so.
https://github.com/raspberrypi/bookworm-feedback/issues/77

withinfocus commented 10 months ago

find /sys/class/udc -type l -prune | wc -l is still reporting 0 for me even with me on the latest RPi5 image so I'm not sure what's up since UDC support was supposed to be added. I'll experiment some more with it.

MingyaoLiu commented 10 months ago

I have a pi5, i can do some testing as well.

ravibowman commented 10 months ago

I have a pi5, i can do some testing as well.

I also have a Pi 5. Would love to help get it working so we can have better connection to the car and WiFi.

marcone commented 10 months ago

I also have a Pi 5. Would love to help get it working so we can have better connection to the car and WiFi.

Better than what? Isn't it going to be pretty much the same as as Pi 4?

Arthur-Philip-Dent commented 10 months ago

Isn't it going to be pretty much the same as as Pi 4?

Right. To enhance the throughput we would need to attach an USB-Dongle with better performance... and reaching soon the limit of the USB3.0 controller.

ravibowman commented 10 months ago

I also have a Pi 5. Would love to help get it working so we can have a better connection to the car and WiFi.

Better than what? Isn't it going to be pretty much the same as Pi 4?

For some reason, I thought Pi4 didn't support 5 GHz. Your reply made me go look at the tech specs again! That point was the only reason I even got a Pi5. How about connecting to the car via USB3? Does that work?

marcone commented 10 months ago

Isn't it going to be pretty much the same as as Pi 4?

Right. To enhance the throughput we would need to attach an USB-Dongle with better performance... and reaching soon the limit of the USB3.0 controller.

Do such dongles exist? It would have to be a USB device with two sides that can both act as peripherals, right?

marcone commented 10 months ago

How about connecting to the car via USB3? Does that work?

No. Like the Pi4, the Pi5's only OTG capable port is USB2.

marcone commented 9 months ago

People above mentioned they were going to do some more testing. Does it work on Pi5 now? There's also one unaddressed review comment remaining.

Arthur-Philip-Dent commented 9 months ago

People above mentioned they were going to do some more testing. Does it work on Pi5 now? There's also one unaddressed review comment remaining.

Will have time this weekend for testing.

Arthur-Philip-Dent commented 9 months ago

Isn't it going to be pretty much the same as as Pi 4?

Right. To enhance the throughput we would need to attach an USB-Dongle with better performance... and reaching soon the limit of the USB3.0 controller.

Do such dongles exist? It would have to be a USB device with two sides that can both act as peripherals, right?

Yes. The USB3.0 would be the limit, but ~5x faster IRL, than the build in WiFi.

You have to deply kernel module for that: rtl88x2bu module Kudos to @cilynx for their work.

I work with this dongle since one year, but this one is same chipset, currently for a better price.

Hope that may help someone...

The Hitchhiker

Arthur-Philip-Dent commented 9 months ago

[!TIP] Ok, I just learned, Bullseye is nothing for the Pi5... Seen here, in the Raspi formum After I walked into this boot screen...

Arthur-Philip-Dent commented 9 months ago

Installation TeslaUSB on a Pi5 with Bookworm, Part1 (before personalized teslausb_setup_variables.conf): Looks good! (Y)

Will continue tomorrow configuring the teslausb_setup_variables.conf-file and testing it on the car.

Log file: Installing TelsaUSB on Pi5 Bookworm.txt part1

[!NOTE] To be continued tomorrow!

The Hitchhiker

Arthur-Philip-Dent commented 9 months ago

Locked myself out yesterday. I configured access via authorized keys file with the Pi Imager. After reboot the user didn't log in via ssh... and I realized, I should have taken also the fork from Matt:

teslausb-headless-setup.log
(...)
Sun 18 Feb 15:45:47 CET 2024 : Verifying that the requested configuration is valid...
Sun 18 Feb 15:45:47 CET 2024 : Downloaded /tmp/verify-configuration.sh ...
Sun 18 Feb 15:45:47 CET 2024 : STOP: unsupported hardware: 'Raspberry Pi 5 Model B Rev 1.0'
Sun 18 Feb 15:45:47 CET 2024 : (only Pi Zero W and Pi 4 have the necessary hardware to run teslausb)

Will start another attempt now with @withinfocus' repo fork for the Pi5.

Arthur-Philip-Dent commented 9 months ago

For me all looks good!

Setting:

[!NOTE] @marcone: Gadget mode drive is visible on laptop and car connected via USB-C. Power and Data through one cable.

While installing an rebooting current went over 1000mA. Idling though around 500mA. Will walk over to the car and check, if a Model3P PFL has enough power to feed this Pi5 trhough a USB-hub via 2 USB-A plugs ... EDIT: works like a charme via hub (unsing a JEDA USB-hub for Tesla Model3) on any port via USB-A/USB-C or USB-C/USB-C cable. Using only one cable works.

drwxr-xr-x  3 root root     4096 Feb 18 18:05 .
drwxr-xr-x 20 root root     4096 Feb 18 18:05 ..
-rw-r--r--  1 root root       92 Feb 18 17:00 cmdline.txt
(...)
-rw-r--r--  1 root root       91 Feb 18 17:00 config.txt
drwxr-xr-x  4 root root     4096 Jan  1  1970 firmware
(...)
lrwxrwxrwx  1 root root       18 Dec 11 05:54 issue.txt -> firmware/issue.txt
lrwxrwxrwx  1 root root       17 Dec 11 05:36 overlays -> firmware/overlays
(...)
-rw-r--r--  1 root root     9733 Feb 18 18:05 teslausb-headless-setup.log
-rw-r--r--  1 root root        0 Feb 18 18:05 TESLAUSB_SETUP_FINISHED
(...)
-rw-r--r--  1 root root        0 Feb 18 17:23 WIFI_ENABLED
-rw-r--r--  1 root root      266 Feb 18 17:25 wpa_supplicant.conf.sample
root@teslausb:~#

EDIT2: also the installation with NVMe drive (a Samsung PM9B1 with 512GB in a Pineberry HATDrive! Top) works fine. Not much difference in power consumption (no SD-Card inserted).

When plugging in a RTL8812BU WiFi6 Dongle on USB3.0 (internal WiFi off via dtoverlay=disable-wifi) the consumption was slightliy higher with 1.1A and when idle was around 550mA.

Arthur-Philip-Dent commented 9 months ago

As you said, this depends on future Raspberry Pi OS changes so I don't want to merge this until it actually works. Also, I would really prefer to not mix functional changes with unrelated whitespace changes. The fact that your particular editor prefers some other formatting isn't a good enough reason to reformat large swaths of text. If there's a strong case for the reformatting, it should be done as a separate change.

Last year the updates for the bootloader / EEPORM went through and I can confirm, that I can use USB-C connector for gadget-mode and front USB-A socket for WiFi dongle.

Pi5 on bookworm works.

withinfocus commented 9 months ago

@marcone made a few language tweaks. Per the testing I think this is safe to merge and allow Pi 5 support.

njbarrett commented 9 months ago

Just wanted to mention that I was able to successfully get this working on a Pi 5 using the manual setup instructions. Thanks!