working cam
This commit is contained in:
parent
0877016c48
commit
3dcbaee69f
262
readme
262
readme
@ -1,188 +1,31 @@
|
|||||||
# TK1-SOM CSI Camera Testing Guide
|
# TK1-SOM AR0330 Camera Setup Guide
|
||||||
|
|
||||||
## Hardware Information
|
## Hardware Information
|
||||||
|
|
||||||
- The TK1-SOM supports dual CSI-2 ports
|
- The TK1-SOM supports dual CSI-2 ports
|
||||||
- Default camera sensor: IMX135
|
- AR0330 sensor: 3MP, 1/3" CMOS
|
||||||
- Alternative sensor: AR0330 (3MP, 1/3" CMOS)
|
|
||||||
- Camera connects through CSI interface and I2C for control
|
- Camera connects through CSI interface and I2C for control
|
||||||
|
|
||||||
## Prerequisites
|
## System Requirements
|
||||||
|
|
||||||
1. TK1-SOM running L4T (Linux for Tegra)
|
- TK1-SOM running L4T (Linux for Tegra) R21.3
|
||||||
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
|
- Kernel Version: 3.10.40
|
||||||
- Architecture: armv7l
|
- AR0330 driver built into kernel (CONFIG_VIDEO_AR0330=y)
|
||||||
- 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
|
## AR0330 Camera Module Conflict Resolution
|
||||||
|
|
||||||
- TK1-SOM Reference Guide
|
The AR0330 camera on TK1-SOM has a known issue with module conflicts. The `nvhost_vi` and `tegra_camera` modules both try to register the VI driver, causing initialization failures.
|
||||||
- L4T Documentation
|
|
||||||
- GStreamer Documentation for NVIDIA plugins
|
|
||||||
- AR0330 Datasheet for detailed sensor specifications
|
|
||||||
|
|
||||||
## AR0330 Camera Troubleshooting Solution
|
### Manual Fix
|
||||||
|
|
||||||
If you're experiencing issues with the AR0330 camera not being detected or initialized properly, follow these steps:
|
To manually fix the issue:
|
||||||
|
|
||||||
### 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:
|
1. Check if the `nvhost_vi` module is loaded:
|
||||||
```bash
|
```bash
|
||||||
lsmod | grep -i vi
|
lsmod | grep -i vi
|
||||||
```
|
```
|
||||||
|
|
||||||
2. If `nvhost_vi` is loaded but `tegra_camera` is not, unload `nvhost_vi` and load `tegra_camera`:
|
2. Unload `nvhost_vi` and load `tegra_camera`:
|
||||||
```bash
|
```bash
|
||||||
sudo rmmod nvhost_vi
|
sudo rmmod nvhost_vi
|
||||||
sudo modprobe tegra_camera
|
sudo modprobe tegra_camera
|
||||||
@ -193,7 +36,7 @@ There is a known conflict between the `nvhost_vi` and `tegra_camera` modules. Bo
|
|||||||
lsmod | grep -E "video|tegra|camera"
|
lsmod | grep -E "video|tegra|camera"
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see output similar to:
|
Expected output:
|
||||||
```
|
```
|
||||||
tegra_camera 20484 0
|
tegra_camera 20484 0
|
||||||
soc_camera_platform 2106 1
|
soc_camera_platform 2106 1
|
||||||
@ -204,22 +47,83 @@ There is a known conflict between the `nvhost_vi` and `tegra_camera` modules. Bo
|
|||||||
```bash
|
```bash
|
||||||
ls -l /dev/video*
|
ls -l /dev/video*
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see `/dev/video0` or similar device nodes.
|
|
||||||
|
|
||||||
5. Verify the camera is working by checking its properties:
|
### Automatic Fix (Recommended)
|
||||||
|
|
||||||
|
For a permanent solution that works across reboots, create an init script:
|
||||||
|
|
||||||
|
1. Create the init script:
|
||||||
|
```bash
|
||||||
|
sudo tee /etc/init.d/camera-module-fix << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: camera-module-fix
|
||||||
|
# Required-Start: \$local_fs \$remote_fs
|
||||||
|
# Required-Stop: \$local_fs \$remote_fs
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Fix camera module loading
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
case "\$1" in
|
||||||
|
start)
|
||||||
|
echo "Unloading nvhost_vi module..."
|
||||||
|
rmmod nvhost_vi || true
|
||||||
|
echo "Loading tegra_camera module..."
|
||||||
|
modprobe tegra_camera || true
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: /etc/init.d/camera-module-fix {start|stop}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Make the script executable and enable it to run at boot time:
|
||||||
|
```bash
|
||||||
|
sudo chmod +x /etc/init.d/camera-module-fix
|
||||||
|
sudo update-rc.d camera-module-fix defaults
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run the script manually to apply changes immediately:
|
||||||
|
```bash
|
||||||
|
sudo /etc/init.d/camera-module-fix start
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing the Camera
|
||||||
|
|
||||||
|
1. Verify the camera is working by checking its properties:
|
||||||
```bash
|
```bash
|
||||||
v4l2-ctl --all --device /dev/video0
|
v4l2-ctl --all --device /dev/video0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Kernel Version Considerations
|
2. Test camera stream with GStreamer:
|
||||||
|
```bash
|
||||||
|
gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,format=NV12,framerate=30/1' ! nvvidconv ! nvoverlaysink
|
||||||
|
```
|
||||||
|
|
||||||
- The solution above was tested on kernel version `3.10.40-grinch-21.3.4`
|
## Troubleshooting
|
||||||
- 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
|
If the camera is still not detected:
|
||||||
|
|
||||||
- The AR0330 driver is built into the kernel (`CONFIG_VIDEO_AR0330=y`)
|
1. Check physical connections to CSI port
|
||||||
- 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`
|
2. Verify I2C detection (AR0330 should be on bus 2 at address 0x10 or 0x18):
|
||||||
- Even if the camera is not detected on I2C bus 2 (addresses 0x10 or 0x18), this module conflict resolution may still fix the issue
|
```bash
|
||||||
|
for i in {0..5}; do echo "=== i2c-$i ==="; sudo i2cdetect -y $i; done
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Check kernel logs for errors:
|
||||||
|
```bash
|
||||||
|
dmesg | grep -i "camera\|ar0330\|tegra\|vi"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- TK1-SOM Reference Guide
|
||||||
|
- AR0330 Datasheet
|
||||||
|
- L4T Documentation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user