commit 0877016c48617d134656e84751d2074fe1bf4879 Author: devdesk Date: Fri May 2 13:23:12 2025 +0300 readme diff --git a/readme b/readme new file mode 100644 index 0000000..cee479c --- /dev/null +++ b/readme @@ -0,0 +1,225 @@ +# TK1-SOM CSI Camera Testing Guide + +## Hardware Information + +- The TK1-SOM supports dual CSI-2 ports +- Default camera sensor: IMX135 +- Alternative sensor: AR0330 (3MP, 1/3" CMOS) +- Camera connects through CSI interface and I2C for control + +## Prerequisites + +1. TK1-SOM running L4T (Linux for Tegra) +2. Camera module properly connected to CSI port +3. Required kernel modules: + - videobuf2-dma-contig.ko + - soc_camera_platform.ko + - nvhost-vi.ko + - tegra_camera.ko + +## Checking Camera Presence + +### 1. Hardware Connection Check + +- Verify physical connection to CSI port +- Check cable orientation and connection integrity +- Ensure camera power supply is connected + +### 2. I2C Detection + +```bash +# Check each I2C bus for camera presence +for i in {0..5}; do + echo "=== i2c-$i ===" + sudo i2cdetect -y $i +done +``` + +The IMX135 sensor should appear on one of the I2C buses if properly connected. +For AR0330, check i2c-2 for addresses 0x10 or 0x18. + +### 3. Kernel Module Status + +```bash +# Check if camera modules are loaded +lsmod | grep -E 'video|tegra|camera' + +# Check for video devices +ls -l /dev/video* +``` + +### 4. System Logs + +```bash +# Check kernel messages for camera detection +dmesg | grep -i 'camera\|imx\|tegra\|ar0330' +``` + +## GStreamer Testing + +### 1. Check Available GStreamer Plugins + +```bash +# List NVIDIA-specific plugins +gst-inspect-1.0 | grep nv + +# Check nvcamerasrc capabilities +gst-inspect-1.0 nvcamerasrc +``` + +### 2. Test Camera Stream + +```bash +# Basic camera test pipeline +gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,format=NV12,framerate=30/1' ! nvvidconv ! nvoverlaysink +``` + +## Troubleshooting + +### 1. Initial Checks + +- Verify camera is connected to CSI #1 port +- Check I2C detection: + - For IMX135: bus 0 (devices at 0x56 and 0x4c-0x4d) + - For AR0330: bus 2 (devices at 0x10 or 0x18) +- Verify appropriate driver is loaded in kernel logs +- Check for video device nodes (/dev/video*) + +### 2. Module Loading Issues + +- Kernel modules must match the running kernel version +- Current kernel: 3.10.40-gc017b03 +- Required modules: + - videobuf2-dma-contig.ko + - soc_camera_platform.ko + - nvhost-vi.ko + - tegra_camera.ko +- Module paths: + - /lib/modules/3.10.40-gc017b03/kernel/drivers/media/v4l2-core/videobuf2-dma-contig.ko + - /lib/modules/3.10.40-gc017b03/kernel/drivers/media/platform/soc_camera/soc_camera_platform.ko + - /lib/modules/3.10.40-gc017b03/kernel/drivers/video/tegra/host/vi/nvhost-vi.ko + - /lib/modules/3.10.40-gc017b03/kernel/drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko + +### 3. Device Node Issues + +- Check if /dev/video- nodes exist +- Verify permissions on video devices +- Check video4linux subsystem: ls -l /sys/class/video4linux/ + +### 4. GStreamer Testing + +- Verify nvcamerasrc plugin is available: gst-inspect-1.0 | grep nv +- Check nvcamerasrc capabilities: gst-inspect-1.0 nvcamerasrc +- Test camera stream with: + + ```bash + gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,format=NV12,framerate=30/1' ! nvvidconv ! nvoverlaysink + ``` + +- Common GStreamer errors: + - "Can not open camera device": Check physical connection and kernel modules + - "Pipeline doesn't want to pause": Verify camera power and CSI connection + +### 5. Common Problems + +- Missing kernel modules +- Mismatched L4T version +- Incorrect I2C address +- CSI lane configuration issues +- Power supply problems +- Camera not properly initialized +- Driver compatibility issues + +### 6. AR0330 Specific Issues + +- Built into kernel (CONFIG_VIDEO_AR0330=y) +- Uses Platform Camera Layer (PCL) for initialization +- Check device tree configuration: + + ```bash + # View camera PCL profiles + cat /proc/device-tree/camera-pcl/profiles/ar0330@2_*/name + ``` + +- Common AR0330 problems: + - I2C communication failures on bus 2 + - PCL initialization failures + - Video Input (vi) driver registration issues + - Power sequencing problems +- Hardware checks for AR0330: + - Verify correct I2C address selection (0x10 or 0x18) + - Check MIPI/Parallel interface configuration + - Confirm power supply meets 2.8V analog and 1.8V digital requirements + - Verify MCLK is properly configured + +## System Information + +- L4T Version: R21.3 +- Kernel Version: 3.10.40 +- Architecture: armv7l +- Camera Support: + - IMX135: Built into kernel (CONFIG_VIDEO_IMX135=y) + - AR0330: Built into kernel (CONFIG_VIDEO_AR0330=y) +- VI Support: Modular (CONFIG_TEGRA_GRHOST_VI=m) + +## Additional Resources + +- TK1-SOM Reference Guide +- L4T Documentation +- GStreamer Documentation for NVIDIA plugins +- AR0330 Datasheet for detailed sensor specifications + +## AR0330 Camera Troubleshooting Solution + +If you're experiencing issues with the AR0330 camera not being detected or initialized properly, follow these steps: + +### Module Conflict Resolution + +There is a known conflict between the `nvhost_vi` and `tegra_camera` modules. Both try to register the VI driver, causing initialization failures. To resolve this: + +1. Check if the `nvhost_vi` module is loaded: + ```bash + lsmod | grep -i vi + ``` + +2. If `nvhost_vi` is loaded but `tegra_camera` is not, unload `nvhost_vi` and load `tegra_camera`: + ```bash + sudo rmmod nvhost_vi + sudo modprobe tegra_camera + ``` + +3. Verify that the camera modules are now loaded correctly: + ```bash + lsmod | grep -E "video|tegra|camera" + ``` + + You should see output similar to: + ``` + tegra_camera 20484 0 + soc_camera_platform 2106 1 + videobuf2_dma_contig 8796 1 tegra_camera + ``` + +4. Check if the video device node has been created: + ```bash + ls -l /dev/video* + ``` + + You should see `/dev/video0` or similar device nodes. + +5. Verify the camera is working by checking its properties: + ```bash + v4l2-ctl --all --device /dev/video0 + ``` + +### Kernel Version Considerations + +- The solution above was tested on kernel version `3.10.40-grinch-21.3.4` +- Make sure you're using the correct module for your kernel version +- Module path: `/lib/modules/3.10.40-grinch-21.3.4/kernel/drivers/media/platform/soc_camera/tegra_camera/tegra_camera.ko` + +### Additional Notes + +- The AR0330 driver is built into the kernel (`CONFIG_VIDEO_AR0330=y`) +- The PCL profiles for AR0330 are present at `/proc/device-tree/camera-pcl/profiles/ar0330@2_0010` and `/proc/device-tree/camera-pcl/profiles/ar0330@2_0018` +- Even if the camera is not detected on I2C bus 2 (addresses 0x10 or 0x18), this module conflict resolution may still fix the issue