2x 5MP OCam

Moderators: mdrjr, odroid

2x 5MP OCam

Unread postby Hessam2013 » Sun May 14, 2017 2:06 pm

Hi,
I searched forum with no success, simply put, I connect 2 5Mp Ocams to two usb3 ports on XU4
And want to take pictures from both simultaneously, each round takes 5 seconds, I've read and am aware of limited usb3 bandwidth on XU4, upgraded OCam firmware to latest and used all buffer staff related to modprobe,
Now the problem, very often the cams stop functioning properly and opencv responds with timeouts, this happens even in low resolutions,
Any help will be appreciated
Regards,
Hessam
Hessam2013
 
Posts: 3
Joined: Sat Mar 25, 2017 1:05 am
languages_spoken: english
ODROIDs: Xu4

Re: 2x 5MP OCam

Unread postby odroid » Mon May 15, 2017 9:34 am

Issue below commands and test again.
Code: Select all
echo 5 > /proc/irq/143/smp_affinity_list
echo 6 > /proc/irq/144/smp_affinity_list

It will assign the USB 3.0 handlers to faster A15 cores.

BTW, which Kernel version and OS image do you use?
User avatar
odroid
Site Admin
 
Posts: 25044
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: 2x 5MP OCam

Unread postby kasimir » Thu May 18, 2017 4:45 pm

Hi!
I think, I do have the same or a very similar issue over here. I would like to use two oCam5CRO connected to the USB3 connectors of an XU4, taking just simple images (640x480). I am using the example code opencv-basic_5CRO from the git repo. As long as I connect only one of the two cameras to the XU4 at the same time, both cameras are just working fine. So, this shouldn't be an issue with the camera. But when I connect both cameras at the same time, just on of the cameras is working, the other camera device opens but I get timeouts, I tried this a couple of times, rebooting, used another XU4 ... the issue stays the same.

Code: Select all
odroid@droid1:~/$ ./oCam_0/build/bin/oCam_0
Cam #0 is opend!
!
!
[getting images]
!
!


Code: Select all
odroid@droid1:~/$ ./oCam_0/build/bin/oCam_0
Cam #0 is opend!
select timeout


In the example code I am just changing the cam numbers 0 or 1
Code: Select all
const int default_cam_number = 0;


current OS is

Code: Select all
odroid@droid1:~/$ uname -a
Linux visdroid1 3.10.103-124 #1 SMP PREEMPT Tue Oct 11 11:51:06 UTC 2016 armv7l armv7l armv7l GNU/Linux
odroid@droid1:~/$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l


With your changes assigning USB3 handlers to A15 cores, I don't get any images at all, so getting timeouts from both cameras.

Can you reproduce this issue with your example code and using two cameras?
And if it's working on your side can you please give me more information on your setup?

Thank you for your help!
kasimir
 
Posts: 3
Joined: Mon Jan 23, 2017 6:37 pm
languages_spoken: english,german

Re: 2x 5MP OCam

Unread postby WITHROBOT » Sat May 20, 2017 6:18 pm

We suspect this problem has something to do with read( ) function after open( ) in VideoCapture Class of OpenCV under the latest Ubuntu kernel 4.9 on XU4.

We recommend to try the attached sample code in which we used Video for Linux to access and capture the image from the oCam-5CRO-U cameras without using the above mentioned functions.
Attachments
opencv-basic_5CRO_V4L.zip
(20.13 KiB) Downloaded 34 times
WITHROBOT
 
Posts: 105
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2

Re: 2x 5MP OCam

Unread postby kasimir » Tue May 23, 2017 11:11 pm

I installed the latest Ubuntu image with kernel 4.9 and tried your sample code. Generally, it seems to work, I can read images from both cameras connected to the XU4 at the same time. Thank you very much for your help!

From time to time the camera reading is failing, especially with the first calls, and I'm getting:
Code: Select all
error number: 11
Cannot get image from camera: Resource temporarily unavailable
error number: 0
Cannot get image from camera: Success

Waiting for the next images then takes a couple of seconds.
Is there a way to make reading more reliable?
Or can i prevent this behavior somehow?
kasimir
 
Posts: 3
Joined: Mon Jan 23, 2017 6:37 pm
languages_spoken: english,german

Re: 2x 5MP OCam

Unread postby WITHROBOT » Wed May 24, 2017 12:15 pm

Thank you for your report.

We will look into this and will update you.
WITHROBOT
 
Posts: 105
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2

Re: 2x 5MP OCam

Unread postby WITHROBOT » Wed May 31, 2017 11:34 am

Another possible cause is the connection problem.

Please refer the following and make sure you have a good connection on both of USB ports.
viewtopic.php?f=95&t=15302#p99467
WITHROBOT
 
Posts: 105
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2

Re: 2x 5MP OCam

Unread postby kasimir » Fri Aug 04, 2017 5:27 pm

With the latest firmware (oCam-5CRO-U_R1707_170629.img) on the oCams, this "error 11", which was like a reset of the camera from time to time, disappeared. Both cameras are just running smoothly now.
Thank you for fixing this issue.
kasimir
 
Posts: 3
Joined: Mon Jan 23, 2017 6:37 pm
languages_spoken: english,german

Re: 2x 5MP OCam

Unread postby WITHROBOT » Mon Aug 07, 2017 11:27 am

We are very glad to hear this feedback.
Thank you.
WITHROBOT
 
Posts: 105
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2


Return to oCAM USB 3.0 Camera

Who is online

Users browsing this forum: No registered users and 3 guests