tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Camera module freezes RPi (reproducable)

Sun Jun 30, 2013 2:41 pm

Hello,

first of all, thanks for all the great work spent on both the RPi board an the camera module. Both items are phenomenal!

Working with the camera, I encountered a problem:
If the raspistill command is called in a high frequency, chances are good that the whole RPi board freezes after a while (some hours). In this state, it cannot be reached through the network, plus it seems that it doesn't execute any user code, anymore.
If I try to login through the local (HDMI out) console, I can enter the user name but nothing happens after this.

I have created a small script which reproducable triggers the problem after some hours:

Code: Select all

#!/bin/sh
sudo umount /stress_ramdisk >/dev/null 2>&1
sudo rm -rf /stress_ramdisk >/dev/null 2>&1
sudo mkdir -p /stress_ramdisk
sudo mount -t tmpfs -o size=50m tmpfs /stress_ramdisk
sudo chmod 0777 /stress_ramdisk
        
while [ True ]
do
    raspistill -w 1296 -h 972 -q 65 -t 0 -o "/stress_ramdisk/test.jpg"
done
Save the above text to a text file (e.g. stresstest.sh) and call it using "sudo sh stresstest.sh &".

I am almost 100% sure that you will run into the same trouble as described above.

I have tested this script on both a 256 MB RPi and a 512 MB RPi - same results.
I have ensured that the power supply provides a "rock solid" supply, too.

I would be very thankful if someone could try the above script e.g. overnight and check if the RPi is still "alive".
Please note that there is no damage caused to the board; a simple power cycle brings everything up again, fine!

Does have anyone an idea what causes the described problem?

Many thanks in advance!

erikcf
Posts: 19
Joined: Thu May 23, 2013 4:17 am

Re: Camera module freezes RPi (reproducable)

Thu Jul 04, 2013 10:05 pm

Are you accessing it over wifi? If so, which chipset is it based on? I know of some people who have seen issues with Ralink-based ones making the Pi freeze up (myself included).

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Sun Jul 07, 2013 10:11 am

erikcf wrote:Are you accessing it over wifi? If so, which chipset is it based on? I know of some people who have seen issues with Ralink-based ones making the Pi freeze up (myself included).
I do not use WiFi at all in this scenario. I am using a LAN connection.
Please also note, that I alread tried different RPi and cam boards and different power supplies. In my latest test I powered the system through a very good lab power supply and I can see (on the oscilloscope) no voltage drops on the RPi side.

Did anyone try the shown test script in the meanwhile?

coolcow
Posts: 4
Joined: Mon Jul 22, 2013 1:41 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 1:47 pm

omg thanks, i am not alone with this problem !

Same issue. I tried this with wifi AND with ethernet. When raspistill is running (with -t 9999...), the pi isn't reachable over the network anymore after a couple of hours.

I will run your script this night, but i am pretty sure the "freeze" will happen again.

Already found a workaround?

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 4:08 pm

Hey coolcow!

I am very happy about your reply. I really began to believe that I am the only person facing this problem - even though I have reproduced this issue using three different RPis and three different cam modules...

No, I have not found a solution for this problem, yet... :-(

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24130
Joined: Sat Jul 30, 2011 7:41 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 4:23 pm

-t 0 I think may prove unreliable, so best to put a value of over 500 in there. That may help. Also, put a delay between each invocation of raspistill to see if that helps. That's may be a workaround. I'm sure there is an issue in their somewhere, but it will be really difficult to find, so I am loath to put any effort in until lots of other more important stuff is fixed.

As for the other comment, I presume you are using timelapse mode? What is the interval? (-tl) Try at least 1000ms to see if that fixes the problem.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 5:12 pm

No, I am not using time lapse mode as I am using the produced images for some webcam application.
Because of that, I want to get the images as fast as possible from the cam.
I will try a different approach by using time lapse mode onto a RAM disk and fetching away the newly produced images.
I will let you know if time lapse mode works stable, here.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24130
Joined: Sat Jul 30, 2011 7:41 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 5:14 pm

tiptop wrote:No, I am not using time lapse mode as I am using the produced images for some webcam application.
Because of that, I want to get the images as fast as possible from the cam.
I will try a different approach by using time lapse mode onto a RAM disk and fetching away the newly produced images.
I will let you know if time lapse mode works stable, here.
Using the app in tl mode will always be faster - running the app each time involves a LOT of camera start up and shutdown time. tl mode never shuts the camera down, but uses much more power.

It's still slower than I would hope though - nee to investigate that at some point.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

coolcow
Posts: 4
Joined: Mon Jul 22, 2013 1:41 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 5:56 pm

Thx for the very fast reaction ! :)

Here are some infos:

I can reproduce the freeze on 2 rpis (Raspberry Pi Type B Single Board Computer 512MB) with 2 cameras (Raspberry Pi HD Video Camera module).
Both power supplies are: Micro-USB 5V 1200mA.

I am running the Raspbian Wheezy image from raspberrypi.org (2013-05-25-wheezy-raspbian.zip) on a 8GB SD-Card.
The only system changes i made: I added "RAMTMP=yes" to "/etc/default/tmpfs"

How i launch the raspitstill command:
raspistill -t 9999999 -tl 1000 -o /tmp/test.jpg -w 1280 -h 960 &

On the one rpi i use a AWUS036NEH Wifi-Adapter (rt2800usb). On the other rpi i use only ethernet (no usb devices connected).
On both rpis, the system freezes after a couple of hours (i have to reboot with a dis-/re-connect of the power supply).


I hope this informations are useful... :geek:

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24130
Joined: Sat Jul 30, 2011 7:41 pm

Re: Camera module freezes RPi (reproducable)

Mon Jul 22, 2013 7:15 pm

Hmm. I generally run timelapse stuff overnight for testing and have not had the same problem.

I'm thinking a race condition in the camera code on the GPU - we have fixed many of these on a customer project, but I think quite a few fixes won't have made it to the Raspi code base yet.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

coolcow
Posts: 4
Joined: Mon Jul 22, 2013 1:41 pm

Re: Camera module freezes RPi (reproducable)

Wed Jul 24, 2013 1:16 pm

OK, i can reproduce the freeze with tiptop's stresstest script. The rpi freezes when connected over ethernet (without any usb devices) and either when using the AWUS036NEH wifi adapter (without ethernet connected or other usb devices).

But...

Something is realy strange =>
I orderer an EDIMAX EW-7811UN wifi dongle, and tested it on the rpi. Raspistill is now beeing working for over 12 hours !!! This is 3-4 times longer then before. :shock:

PS: Maybe, the freezes with the AWUS036NEH is related to this issue => http://www.raspberrypi.org/phpBB3/viewt ... 66&t=40201

Questionario
Posts: 40
Joined: Tue Jun 04, 2013 6:22 am

Re: Camera module freezes RPi (reproducable)

Fri Jul 26, 2013 8:28 am

I had a similar problem...
I seem to have gotten rid of it by not using any kind of overclocking (I tried even the lowest OC setting and had these freezes)

worth a shot so check if you have any overclocking activated and deactivate it and try again...

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Wed Aug 07, 2013 7:53 am

jamesh wrote:Hmm. I generally run timelapse stuff overnight for testing and have not had the same problem.
I'm thinking a race condition in the camera code on the GPU - we have fixed many of these on a customer project, but I think quite a few fixes won't have made it to the Raspi code base yet.
Ok, I have done some long-time tests now:
I rewrote my code to fetch away the pictures generated using time lapse mode. In this mode, the system works stable without any problems even for over a week!
The "fetch away mechanism" is a bit uncool, but works. The maximum duration of 2147483647 milliseconds for time lapse mode (which equals less than 25 days) is much more uncool, though... ;)
I would suggest to change raspistill in the next release to accept -1 as input as well which would mean "endless duration".

Even though time lapse mode works for now, there definitely is a problem in the camera setup, somewhere. Looking at my stress tests, I guess there is a probability of around 1:60000 that the raspistill command freezes the RPi when setting up the camera. My stress test scenario is a possibility to reproduce this problem within some hours...

Nevertheless I am happy and thankful to have a uncool but working workaround for the moment!

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Wed Aug 07, 2013 7:55 am

Questionario wrote:I had a similar problem...
I seem to have gotten rid of it by not using any kind of overclocking (I tried even the lowest OC setting and had these freezes)

worth a shot so check if you have any overclocking activated and deactivate it and try again...
There is no overclocking activated, at all! All the tested RPi boards are running a fresh version of wheezy with latest updates.

tiptop
Posts: 7
Joined: Sun Jun 30, 2013 2:25 pm

Re: Camera module freezes RPi (reproducable)

Wed Aug 07, 2013 7:58 am

coolcow wrote:OK, i can reproduce the freeze with tiptop's stresstest script. The rpi freezes when connected over ethernet (without any usb devices) and either when using the AWUS036NEH wifi adapter (without ethernet connected or other usb devices).
But... [...]
Many thanks for testing my stresstest script! I am "happy" to hear that you can reproduce in the same setup (ethernet connection without any USB devices attached)!
I guess it is just a matter of probability when the EDIMAX WiFi setup freezes as well.

Markus1
Posts: 1
Joined: Tue Aug 20, 2013 2:59 pm

Re: Camera module freezes RPi (reproducable)

Tue Aug 20, 2013 3:36 pm

Hello,

I can confirm having same freezes every 1-2 days with the python motion detection script from this topic:
http://www.raspberrypi.org/phpBB3/viewt ... 90#p394590
Only Ethernet connection and no USB devices.

Regards
Markus

Return to “Camera board”