Apalis tk1 with OV5640 camera

We have the Toradex CSI Camera Module 5MP OV5640 plugged into an Ixora Carrier Board V1.1A, with ubuntu 14.04 and jetpack installed on apalis tk1.
We followed the instruction here
but we keep stuck at the line: modprobe tegra_camera, it returns “the device or resource is busy”
Does anyone familiar with this problem?

Yes, the issue is that Ubuntu by default already loads an alternate camera stack resulting in the following error:

root@tegra-ubuntu:~# modprobe tegra_camera
[   51.914899] Error: Driver 'vi' is already registered, aborting...
modprobe: ERROR: could not insert 'tegra_camera': Device or resource busy

The loaded modules may be queried as follows:

root@tegra-ubuntu:~# lsmod
Module                  Size  Used by
ov5640                  7636  0
videobuf2_dma_contig    10124  0
rfcomm                 32943  0
bnep                    9791  2
bluetooth             267907  10 bnep,rfcomm
apalis_tk1_k20          9273  0
nvhost_vi               2937  0

Just un-load resp. module before proceeding:

root@tegra-ubuntu:~# rmmod nvhost_vi

Now the V4L2 stack should load fine (ignore the errors resulting from alternate sensors being probed):

root@tegra-ubuntu:~# modprobe tegra_camera
[   89.125245] imx135_v4l2 2-0010: Failed to get regulator vana
[   89.147032] ar0330_v4l2 2-0018: ar0330_regulator_get vdig ERR: -517
[   89.156832] ar0330_v4l2 2-0018: ar0330_regulator_get vana ERR: -517
[   89.163239] ar0330_v4l2 2-0018: ar0330_regulator_get vif ERR: -517
[   89.171770] [ar0330]: failed to read sensor id
[   89.176600] [ar0330]: fail to read out sensor ID.
[   89.420536] i2c_wr:write reg error:reg=4,val=0
[   89.426763] i2c_wr:write reg error:reg=8502,val=0
[   89.433410] tc358743_write_edid:write reg error:reg=8c00,val=8
[   89.441338] tc358743_probe: Fail to write EDID to tc35874!
[   89.446979] i2c_wr:write reg error:reg=8544,val=0
[   89.952154] i2c_wr:write reg error:reg=8544,val=10
[   89.964104] i2c_wr:write reg error:reg=4,val=0
[   89.971885] i2c_wr:write reg error:reg=8502,val=0
[   89.977119] tc358743_write_edid:write reg error:reg=8c00,val=8
[   89.983311] tc358743_probe: Fail to write EDID to tc35874!
[   89.989304] i2c_wr:write reg error:reg=8544,val=0
[   90.495049] i2c_wr:write reg error:reg=8544,val=10
[   90.570741] ar0261_v4l2 2-0036: ar0261_regulator_get vdig ERR: -517
[   90.577444] ar0261_v4l2 2-0036: ar0261_regulator_get vana ERR: -517
[   90.583823] ar0261_v4l2 2-0036: ar0261_regulator_get vif ERR: -517
[   90.590044] ar0261_v4l2 2-0036: ar0261_regulator_get avdd_af1_cam ERR: -517 
[   90.598673] [ar0261]: failed to read sensor id
[   90.603567] [ar0261]: fail to read out sensor ID.

And all should work as expected:

root@tegra-ubuntu:~# gst-launch-0.10 v4l2src queue-size=1 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=640,height=480' ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
WARNING: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not get parameters on device '/dev/video0'
Additional debug info:
v4l2src_calls.c(235): gst_v4l2src_set_capture (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: Inappropriate ioctl for device
Setting pipeline to PLAYING ...
New clock: GstSystemClock

I did follow the instruction you gave, it works the first time, but for second time “lsmode” return this

Module                  Size  Used by
ar0261_v4l2             7989  0 
soc_camera_platform     2124  1 
adv7280                 4178  1 
tc358743                6755  0 
ov5640                  7636  0 
ap1302                  4680  0 
ar0330_v4l2             7365  0 
imx135_v4l2            12475  0 
tegra_camera           23209  0 
videobuf2_dma_contig    10356  1 tegra_camera
joydev                  8235  0 
bnep                    9919  2 
rfcomm                 32999  0 
bluetooth             268603  10 bnep,rfcomm
apalis_tk1_k20          9273  0 
rfkill                 11327  3 bluetooth

and then

root@tegra-ubuntu:/home/ubuntu# gst-launch-0.10 v4l2src queue-size=1 ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=640,height=480' ! xvimagesink
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format
Additional debug info:
gstbasesrc.c(2830): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Check your filtered caps, if any
Setting pipeline to NULL ...
Freeing pipeline ...

doesn’t work, what could be the trouble?

What exact hardware and software versions of things are you talking about? I recommend using BSP 2.7b5 or 2.8b1 as there were quite some camera fixed done lately.