Using the other i2c bus hangs raspistill
source link: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=46299&p=367237
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Posts: 27 Joined: Thu May 23, 2013 11:48 am
Using the other i2c bus hangs raspistill
The shell script can run for hours with no problem if I do not access the RTC clock http://www.adafruit.com/products/264. raspistill hangs if I run the command "hwclock -r" a few times. The camera LED is on.
raspistill also hangs if I run python scripts to access a Pi Plate http://www.adafruit.com/products/1115 or a TMP102 https://www.sparkfun.com/products/9418
I have been using one pi model A and one model B with two different power sources.
One 2A power supply connected to a USB hub. The pi is powered from the hub to the mikrousb port. TP1-TP2 is 4.9V. Also tested with a 12v car battery and LM2596
No keyboard and screen is connected, I login via ssh to them.
I did a fresh install of 2013-05-25-wheezy-raspbian on a second SD-card. No difference.
The script that I use to test raspistill
Code: Select all
while /bin/true ; do
date
raspistill -n -t 100 -e jpg -o - > /dev/null
sleep 1
done
Raspberry Pi Engineer & Forum Moderator
Posts: 27553 Joined: Sat Jul 30, 2011 7:41 pm
Re: Using the other i2c bus hangs raspistill
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Posts: 27 Joined: Thu May 23, 2013 11:48 am
Re: Using the other i2c bus hangs raspistill
A new test.jamesh wrote:Perhaps not related to the issue but you probably need to have a bigger delay between each invocation of raspistill - I doubt it can run up, capture then shutdown that fast and keep itself clean. I'd also use a longer -t value as well, I don't think 100 is enough for the exposure to have stabilised.
I run this command in one terminal window
Code: Select all
for x in 1 2 3 4 5 6 7 8 9 ; do hwclock -r ; done
Code: Select all
raspistill -n -t 3000 -e jpg -o image.jpg
Code: Select all
root@pi4:~# strace -p 3546
Process 3546 attached - interrupt to quit
futex(0xb6f01390, FUTEX_WAIT_PRIVATE, 0, NULL
Raspberry Pi Engineer & Forum Moderator
Posts: 27553 Joined: Sat Jul 30, 2011 7:41 pm
Re: Using the other i2c bus hangs raspistill
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Raspberry Pi Engineer & Forum Moderator
Posts: 27553 Joined: Sat Jul 30, 2011 7:41 pm
Re: Using the other i2c bus hangs raspistill
My own thoughts are perhaps that the Arm side driver has no idea the I2C is being used by the GPU, so happily does a reset since its thinks its the only user. No idea how to test that though.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Raspberry Pi Engineer & Forum Moderator
Posts: 27553 Joined: Sat Jul 30, 2011 7:41 pm
Re: Using the other i2c bus hangs raspistill
Anyone know if the source to hwclock is available anywhere? That might be the culprit.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Posts: 2487 Joined: Tue Aug 02, 2011 7:27 am Contact: Website
Re: Using the other i2c bus hangs raspistill
I will have to look into this but I can't do that right now as I have a few other more important issues to resolve.
I CAN say that all the I2C channel are hardware-independent. That is: the chip has three totally individual instantiated I2C blocks.
AFAIK the source of the I2C clock is the system bus clock, not the general clock manager.
Posts: 18 Joined: Thu May 16, 2013 3:53 pm
Re: Using the other i2c bus hangs raspistill
Good news. Finally, I can work around this problems (at least in my case).
Just unbind i2c bus 0 from linux i2c driver.
Code: Select all
sudo -s
echo bcm2708_i2c.0 > /sys/bus/platform/drivers/bcm2708_i2c/unbind
Now, I can mad pulling I2C and Camera simultaneously.
IMHO, conflict between Camera Driver (I2C-0 from GPU) and I2C linux kernel.
Raspberry Pi Engineer & Forum Moderator
Posts: 5673 Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
Re: Using the other i2c bus hangs raspistill
Basically there is a common I2C interrupt between the channels, and both I2C bus' handlers get called.
Because GPU is talking to camera on the "other" I2C bus, the arm eventually sees the "DONE" bit from a transaction and thinks it ought to respond.
This response results in either a panic when a null message pointer is dereferenced, or if it gets past that, then the resulting I2C responses will likely upset the camera.
I think @tasanakorn's unbind solution is actually the techically correct one.
I've also got a patch that makes I2C driver ignore interrupts if it has no outstanding messages, which also seems to fix it.
If anyone has an I2C device and ability to rebuild kernel, can you test this patch:
http://pastebin.com/z7G6tnHy
Firstly, does it break your current I2C usage?
Secondly does it continue to work when camera is active?
Posts: 27 Joined: Thu May 23, 2013 11:48 am
Re: Using the other i2c bus hangs raspistill
Without the patch, I could run raspistill and pi plate for maximum 5 minutes. I am running a test with raspistill, Pi plate and tmp102 at the moment. Still running after 40 minutes.
Added: I aborted the test after 8 hours. The patch is OK for me.
Raspberry Pi Engineer & Forum Moderator
Posts: 5673 Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
Re: Using the other i2c bus hangs raspistill
rayjoh wrote:Added: I aborted the test after 8 hours. The patch is OK for me.
Thanks for report. I'll add the patch to kernel source.
Posts: 1 Joined: Wed Aug 14, 2013 10:48 pm
Re: Using the other i2c bus hangs raspistill
Thanks.
Raspberry Pi Engineer & Forum Moderator
Posts: 27553 Joined: Sat Jul 30, 2011 7:41 pm
Re: Using the other i2c bus hangs raspistill
johntucker wrote:I to have this problem. I would like to know which of the two solutions in this chain is best. I would rather not have to rebuild the kernel so the unbind seems better but a better explanation would be helpful.
Thanks.
You could try rpi-update - that may pull in the fix.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Posts: 58 Joined: Tue Apr 24, 2012 10:00 am Location: Australia
Re: Using the other i2c bus hangs raspistill
Since it's not explicitly stated here yet: Don't use other devices on i2c-0 while you're using the camera - it won't always work... The CSI has a control channel (CCI) which is on i2c-0.
On the newer revision boards this is much harder to do by accident since the i2c-0 pins got moved to P5.
Display posts from previous:Sort by
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK