Raspberry: Difference between revisions
Line 39: | Line 39: | ||
bootcode.bin + kernel (arm v7l) | bootcode.bin + kernel (arm v7l) | ||
kernel parameters | |||
device tree overlay | |||
cmdline.txt | /boot/firmware/cmdline.txt | ||
video=HDMI-A-1:800x480M@60D | |||
/boot/firmware/config.txt | /boot/firmware/config.txt | ||
hdmi_group=2 | |||
hdmi_mode=87 | |||
hdmi_cvt 800 480 60 6 0 0 0 | |||
/boot/firmware/config.txt | /boot/firmware/config.txt | ||
start_x=1 | |||
This enabled MMAL /dev/video0 | This enabled MMAL /dev/video0 |
Latest revision as of 11:42, 19 January 2025
Firmware update
https://www.raspberrypi.com/documentation/computers/os.html
rpi-eeprom-update
for bootloader EEPROM (Pi 4 or Pi 5)
rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
FW_REV:84e180662bc3f6646860a328d328a38d58325c8a
BOOTLOADER_REV:f2e314d29442e0b332caa2a26cd156dd3d3e1797
Broken USB
Unknown USB Device (Device Descriptor Request Failed)
Broken Decoupling capacitor C97 and C98: 47uF 16V 1206
https://forums.raspberrypi.com/viewtopic.php?t=202800
PIN OUT
https://alselectro.wordpress.com/wp-content/uploads/2018/07/image-a.jpg
Network (Debian Bookworm)
nmcli device reapply
Boot process
Raspberry PI boots from first partition of the SD card (/dev/mmcblk0p1 vfat), mounted in linux as /boot/firmware. The file /boot/config.txt contains the device tree overlays that used by the kernel to load modules, the modules are the drivers for the devices.
The firmware for raspberry can be updated using
rpi-eeprom-update -a
uname -a Linux rasp4 6.2.0-1009-raspi #11-Ubuntu SMP PREEMPT Mon Jul 17 10:19:57 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
bootcode.bin + kernel (arm v7l) kernel parameters device tree overlay
/boot/firmware/cmdline.txt
video=HDMI-A-1:800x480M@60D
/boot/firmware/config.txt
hdmi_group=2 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0
/boot/firmware/config.txt
start_x=1
This enabled MMAL /dev/video0
sudo v4l2-ctl -D sudo v4l2-ctl --list-devices
libcamera-hello
firmware for devices CSI Bus Driver KO
lsmod |grep ov5647
/dev/video0 Lib SO App
https://www.waveshare.com/5inch-hdmi-lcd.htm
https://www.waveshare.com/wiki/5inch_HDMI_LCD
SKU: 10563
grub_default video=800x480M@60D
https://www.waveshare.com/wiki/5inch_HDMI_LCD_(H)
hdmi_group=2 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0
https://www.systutorials.com/configuration-of-linux-kernel-video-mode/
Using 5V power supply, the working current is about 400mA https://github.com/jonaslorander/OctoPiPanel/issues/44
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/index.html
x : resolution M: compute a CVT mode? R: reduced blanking? -: color depth @: refresh rate i: interlaced (non-CVT mode) m: margins? e: output forced to on d: output forced to off D: digital output forced to on (e.g. DVI-I connector) You can override the modes of several outputs using "video" several times, for instance, to force DVI to 1024x768 at 85 Hz and TV-out off: video=DVI-I-1:1024x768@85 video=TV-1:d
https://cgit.freedesktop.org/nouveau/linux-2.6/tree/Documentation/fb/modedb.txt
Raspbee2
https://phoscon.de/de/raspbee2/install#connection
Raspberry Strompi v3
https://github.com/joy-it/strompi3
https://joy-it.net/en/products/RB-StromPi3
https://www.pienergy.joy-it.net/files/files/downloads/anleitungen/RB-StromPi3_Manual_2022-06-23.pdf
https://www.pienergy.joy-it.net/en/downloads
minicom -D /dev/serial0 -b 38400
sspc
Raspberry Pi Camera
https://www.raspberrypi.com/documentation/accessories/camera.html
https://www.partco.fi/fi/raspberry-pi/sbc-kamerat/25193-rpi-camboardv3.html
v1.3 | Omnivision OV5647 | ||
v2.1 | Sony IMX219 | ||
https://www.raspberrypi.com/documentation/accessories/camera.html#preparing-the-software
bcm2835_unicam
lsmod dependancy tree
mc videodev v4l2_fwnode ov5647
blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="C839-E506" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="427c7b7d-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="568caafd-bab1-46cb-921b-cd257b61f505" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="427c7b7d-02"
rpi-update
sudo rpi-update ffdfc6e625eb38086b8c15eead2be90acab825c2
https://github.com/raspberrypi/rpi-firmware/commits/master
ffdfc6e
Oct 19, 2021
Oct 28 ... Mark the Hexxeh repo as obsolete
https://github.com/raspberrypi/rpi-firmware
"firmware: improve firmware camera detection"
ov5647.dtbo
/boot/config.txt
dtoverlay=vc4-fkms-v3d #dtoverlay=imx219 #dtoverlay=ov5647 start_x=1 camera_auto_detect=1
v4l2-ctl --list-devices
unicam (platform:fe801000.csi):
/dev/video0
/dev/media0
uname -a
Linux raspberrypi 5.10.89-v7l+ #1508 SMP Tue Jan 4 19:52:01 GMT 2022 armv7l GNU/Linux
*** Updating firmware *** Updating kernel modules *** Updating VideoCore libraries *** Using HardFP libraries *** Updating SDK *** Running ldconfig *** Storing current firmware revision
dmesg | grep -i ov5647 ov5647 10-0036: write sensor_oe_enable_regs error [ 7.572380] ov5647 10-0036: Consider updating driver ov5647 to match on endpoints
v1.3 grep ov5647 /lib/modules/$(uname -r)/modules.dep ls -la /lib/modules/$(uname -r)/kernel/drivers/media/i2c/ov*
v2.0 kernel/drivers/media/i2c/imx219.ko dmesg | grep imx [ 9.371924] imx219 10-0010: failed to read chip id 219 [ 9.374746] imx219: probe of 10-0010 failed with error -5
raspi-config > 3 Interfaces > Legacy Camera
vcgencmd get_camera supported=1 detected=0
v4l2-ctl --list-devices Failed to open /dev/video0: Remote I/O error
/usr/bin/libcamera-hello -n [0:01:59.178388298] [871] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3385-44d59841 [0:01:59.201706454] [872] ERROR CameraSensor camera_sensor.cpp:535 'ov5647 10-0036': Camera sensor does not support test pattern modes. [0:01:59.620225253] [872] ERROR V4L2 v4l2_device.cpp:91 /dev/video0[-1:cap]: Failed to open V4L2 device: Remote I/O error [0:01:59.622099400] [872] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov5647 10-0036: -121 ERROR: *** no cameras available ***
[ 556.205413] ov5647 10-0036: write sensor_oe_enable_regs error [ 556.209438] ov5647 10-0036: write sensor_oe_enable_regs error
libcamera-jpeg -o /data/test.jpg
raspinfo grep -m 1 model /proc/cpuinfo
cat /etc/debian-version Raspbian Debian Bullseye 11.1
rpi-update cat /boot/.firmware_revision 479b4a969355b9cee39cc74b8ea415ab0337c510
rm -rf /boot/.firmware_revision rpi-update
raspi-config (update tool) sets dt
vcgencmd version version 58e03c94953762222f2b838390dde54d46c38381 (clean) (release) (start) version d9b293558b4cef6aabedcc53c178e7604de90788 (clean) (release) (start)
vcgencmd get_camera supported=0 detected=0
https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/gencmd
vcgencmd get_camera supported=1 detected=0, libcamera interfaces=1
/usr/bin/libcamera-hello -n [0:06:53.878391690] [1140] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+19-960d0c1e [0:06:54.205800297] [1142] INFO RPI vc4.cpp:390 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media0 and ISP device /dev/media2 [0:06:54.209629219] [1140] INFO Camera camera.cpp:1033 configuring streams: (0) 1296x972-YUV420 [0:06:54.211036747] [1142] INFO RPI vc4.cpp:512 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
Pi Camera
https://libcamera.org/getting-started.html
https://www.raspberrypi.com/documentation/accessories/camera.html#building-libcamera-apps
libcamera
apt install cmake meson gnutls-dev git clone https://git.libcamera.org/libcamera/libcamera.git cd libcamera meson setup -Dprefix=/usr build cd build meson compile meson install
ninja -C build install
ldconfig dynamic linker /lib/ld-linux.so.3
libcamera-apps
apt install cmake libboost-dev libboost-program-options-dev libdrm-dev libexif-dev git clone https://github.com/raspberrypi/libcamera-apps.git git clean -f -x -d
meson setup -Dprefix=/usr build cd build meson compile meson install
mkdir build cd build cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_DRM=1 -DENABLE_X11=0 -DENABLE_QT=0 -DENABLE_OPENCV=0 -DENABLE_TFLITE=0 make install
libcamera-hello --version libcamera-apps build: b9a692385d32-intree 07-01-2022 (12:08:03) libcamera build: v0.0.0+3385-44d59841
libcamera-hello -n Opening camera... [0:41:07.818836425] [1467] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3156-f4070274 Closing Libcamera application(frames displayed 0, dropped 0) Camera stopped! Tearing down requests, buffers and configuration Camera closed ERROR: *** no cameras available ***
[0:02:05.034378068] [923] INFO Camera camera.cpp:1028 configuring streams: (0) 1296x972-YUV420 [0:02:05.035319900] [924] INFO RPI raspberrypi.cpp:738 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
libcamera-detect
http://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming
https://datasheets.raspberrypi.com/camera/raspberry-pi-camera-guide.pdf
https://cdn.sparkfun.com/datasheets/Dev/RaspberryPi/ov5647_full.pdf
kernel modules ov5647 lsmod | grep ov5647
libcamera-hello --tuning-file /usr/share/libcamera/ipa/raspberrypi/imx219_noir.json
# Enable audio (loads snd_bcm2835) dtparam=audio=on disable_touchscreen=1
# Enable DRM VC4 V3D drive dtoverlay=ov5647 max_framebuffers=2 arm_64bit=1 start_x=1 gpu_mem=128
[0:29:30.040200604] [1636] ERROR V4L2 v4l2_device.cpp:91 /dev/video0[-1:cap]: Failed to open V4L2 device: Remote I/O error [0:29:30.041926662] [1636] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov5647 10-0036: -121
libcamera-hello -n -v
[0:30:01.427329620] [1640] WARN RPI raspberrypi.cpp:1202 Mismatch between Unicam and CamHelper for embedded data usage! [0:30:01.460196685] [1640] ERROR V4L2 v4l2_device.cpp:91 /dev/video0[-1:cap]: Failed to open V4L2 device: Remote I/O error [0:30:01.461953965] [1640] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov5647 10-0036: -121
[0:12:21.370364549] [992] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3385-44d59841 [0:12:21.394928552] [993] ERROR CameraSensor camera_sensor.cpp:535 'ov5647 10-0036': Camera sensor does not support test pattern modes. [0:12:21.500676308] [993] ERROR V4L2 v4l2_device.cpp:91 /dev/video0[-1:cap]: Failed to open V4L2 device: Remote I/O error [0:12:21.502495829] [993] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov5647 10-0036: -121
v4l2-ctl --list-devices unicam (platform:fe801000.csi): /dev/media2 Failed to open /dev/video0: Remote I/O error [ 834.101238] ov5647 10-0036: write sensor_oe_enable_regs error [ 834.105368] ov5647 10-0036: write sensor_oe_enable_regs error
libcamera-hello -n ERROR: the system appears to be configured for the legacy camera stack
libcamera-hello -n [0:00:45.629777859] [911] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3385-44d59841 [0:00:45.650538841] [912] ERROR CameraSensor camera_sensor.cpp:535 'ov5647 10-0036': Camera sensor does not support test pattern modes. [0:00:46.091778100] [912] ERROR V4L2 v4l2_device.cpp:91 /dev/video0[-1:cap]: Failed to open V4L2 device: Remote I/O error [0:00:46.093755341] [912] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov5647 10-0036: -121 ERROR: *** no cameras available ***
LIBCAMERA_LOG_LEVELS=0 libcamera-hello -n
dmesg | grep ov
[ 6.818879] ov5647 10-0036: Consider updating driver ov5647 to match on endpoints
[ 6.876201] ov5647 10-0036: write sensor_oe_enable_regs error
[ 119.041903] ov5647 10-0036: write sensor_oe_enable_regs error
[ 119.626186] ov5647 10-0036: write sensor_oe_enable_regs error
[ 131.218425] ov5647 10-0036: write sensor_oe_enable_regs error
[ 131.223414] ov5647 10-0036: write sensor_oe_enable_regs error
https://github.com/torvalds/linux/blob/master/drivers/media/i2c/ov5647.c#L774 ov5647_power_on
Build Process
cmake libraries (.so files) /etc/ld.so.conf ldconfig
include .h files /usr/include cmake . make make install
meson -Dprefix=/usr build ninja -C build install
DTB
device_tree= dtparam=i2c=on,i2s=on,spi=on
raspi-config /etc/modprobe.d/raspi-blacklist.conf
PI Camera
libcamera-vid -t 0 -n --rotation 180 --codec mjpeg --inline --listen -o tcp://0.0.0.0:9876 libcamera-vid -t 0 -n --rotation 180 -q 90 --inline --listen -o tcp://0.0.0.0:9876
raspinfo vcgencmd version vcgencmd get_camera libcamera-hello --version libcamera-hello -n libcamera-jpeg -o /data/test.jpg
cmake . -DENABLE_DRM=1 -DENABLE_X11=0 -DENABLE_QT=0 -DENABLE_OPENCV=0 -DENABLE_TFLITE=0 ls -la /lib/modules/$(uname -r)/kernel/drivers/media/i2c/ov* grep ov5647 /lib/modules/$(uname -r)/modules.dep
Device Tree Bluetooth
/boot/config.txt
dtparam=audio=on
/etc/modprobe.d/raspi-blacklist.conf
#snd_bcm2835
https://www.raspberrypi-spy.co.uk/2019/06/using-a-usb-audio-device-with-the-raspberry-pi/
aplay -l
alsamixer
cat /proc/asound/modules
sudo nano /usr/share/alsa/alsa.conf
defaults.ctl.card 0 defaults.pcm.card 0
/lib/modprobe.d/aliases.conf
#snd-usb-audio index=-2
speaker-test -c2
/boot/config.txt
#dtoverlay=pi3-disable-bt
/etc/systemd/system/bluetooth.target-wants/bluetooth.service
add --compat
sdptool
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sdptool
sudo sdptool browse local
Handsfree has ServiceNumber 0x10003
sdptool del 0x10003
https://www.systutorials.com/configuration-of-linux-kernel-video-mode/
https://cgit.freedesktop.org/nouveau/linux-2.6/tree/Documentation/fb/modedb.txt
kernel boot options
video=<conn>:<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] video=HDMI-1:800x480@60 nomodeset
/etc/default/grub
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 KEYTABLE=us rd.luks=0 LANG=en_US.UTF-8 video=1024x800-32 GRUB_GFXMODE=800x480x32 GRUB_GFXPAYLOAD_LINUX=keep GRUB_TERMINAL=gfxterm