User avatar
Mettauk
Posts: 260
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Disable camera led on Pi3

Wed Mar 02, 2016 10:37 am

Apparently due to gpio changes on the Pi3 b disable_camera_led=1 no longer works.

Any ideas of anther way anyone?
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

gordon77
Posts: 6241
Joined: Sun Aug 05, 2012 3:12 pm

Re: Disable camera led on Pi3

Wed Mar 02, 2016 10:52 am

Agreed. It's says it can't find the camera if you set it in /boot/config.txt.

Back to black insulation tape on the led ? ;)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Wed Mar 02, 2016 11:54 am

disable_camera_led=1 on some clone camera boards fails - they used the LED line for other purposes. Sorry, can't fix that one, and it just shows that reverse engineering is prone to mistakes.

It should work fine on a Pi3 - it just signals the driver to only toggle one of the GPIOs (which one is configured in the firmware dt-blob) instead of both.
https://github.com/raspberrypi/firmware ... t-blob.dts hasn't been updated as yet, but there appears to have been some changes made and the two camera GPIOs are on a GPIO expander.
It will mean that using PiCamera's led function will fail as it doesn't know about the Pi3. I'm not even sure if it is possible to get to those GPIOs from Linux - I'll find out as I want to for getting raw access to the camera.

There's an outside chance that the two GPIOs specified in the blob are swapped. That would also explain why it can't find the camera if disable_camera_led is set.
I'll email Pi Towers, but also try to have a look tonight (I haven't actually powered my Pi3 up as yet!).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Wed Mar 02, 2016 10:28 pm

It was an easy one. The config had swapped the two GPIOs, so I saw a brief camera LED flash when doing "vcgencmd get_camera" even though I'd set disable_camera_led=1.
A rebuild of the dt-blob.bin swapping the two lines and it works again even with disable_camera_led=1.

For a couple of reasons that I won't go into I can't release that patched file - sorry. I'll pass the patch across to Pi Towers and it should be available via sudo rpi-update fairly quickly.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

gordon77
Posts: 6241
Joined: Sun Aug 05, 2012 3:12 pm

Re: Disable camera led on Pi3

Wed Mar 02, 2016 10:38 pm

Cheers :D

Schuppenzot
Posts: 19
Joined: Mon May 12, 2014 8:21 pm

Re: Disable camera led on Pi3

Mon Mar 07, 2016 6:22 pm

Is there any update on this matter?

Is it possible yet to tackle the issue with a update/upgrade? Or maybe one could share a manual workaround?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Mon Mar 07, 2016 6:44 pm

Schuppenzot wrote:Is there any update on this matter?

Is it possible yet to tackle the issue with a update/upgrade? Or maybe one could share a manual workaround?
It's fixed (https://github.com/Hexxeh/rpi-firmware/ ... af71bb84be), but you'll need to do a "sudo rpi-update" to get the cutting edge kernel/firmware, so don't do it on a critical system.
I don't know when the next Raspbian release will be.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Schuppenzot
Posts: 19
Joined: Mon May 12, 2014 8:21 pm

Re: Disable camera led on Pi3

Mon Mar 07, 2016 8:49 pm

Thanks. I'm not a fan anymore of cutting edge. I'll wait for the next release as I don't know what will happen if I update the files manually.

Thanks for the info!

l_k3
Posts: 7
Joined: Tue Mar 01, 2016 11:05 pm

Re: Disable camera led on Pi3

Thu Mar 10, 2016 10:25 am

Thanks for fixing!

abatardi
Posts: 1
Joined: Mon May 23, 2016 4:51 pm

Re: Disable camera led on Pi3

Mon May 23, 2016 4:53 pm

It seems this works now, but the method to disable the LED on demand via python doesn't appear to be working:

Code: Select all

import picamera

with picamera.PiCamera() as camera:
    # Turn the camera's LED off
    camera.led = False
    # Take a picture while the LED remains off
    camera.capture('foo.jpg')
Has anyone gotten this functionality to work? I have an application that requires being able to turn on/off the LED on demand in this way.

Thanks!

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Tue Oct 11, 2016 10:43 pm

6by9 wrote:It was an easy one. The config had swapped the two GPIOs, so I saw a brief camera LED flash when doing "vcgencmd get_camera" even though I'd set disable_camera_led=1.
.
Where in the RPi source code (drivers, etc.) is this the LED signal toggled? I am trying to find where the signal for camera board power and the signal for camera board LED are changed. You wrote somewhere (I forgot were) that disable_cameral_led1=1 causes the driver to not bother the signal for LED. Which driver is this?

Much Thanks.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Wed Oct 12, 2016 6:26 am

RareHare wrote:Where in the RPi source code (drivers, etc.) is this the LED signal toggled? I am trying to find where the signal for camera board power and the signal for camera board LED are changed. You wrote somewhere (I forgot were) that disable_cameral_led1=1 causes the driver to not bother the signal for LED. Which driver is this?
As with all the camera control code (and codecs, and most of the other multimedia functions), it's in the closed source GPU firmware.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Fri Oct 14, 2016 4:53 am

6by9 wrote: As with all the camera control code (and codecs, and most of the other multimedia functions), it's in the closed source GPU firmware.
I ask because I am particularly interested in the order in which this firmware asserts the two GPIO signals that emanate from the GPIO expander chip toward the camera board. There are essentially two possibilities for order of assertion when the camera is about to "do something":
  1. Assert GPIO for power, then assert GPIO for LED.
  2. Assert GPIO for LED, then assert GPIO for power.
In both cases, I am hoping that the programmer who wrote the code, adhered to a LIFO model regarding order-of-assertion/de-assertion. That is, de-assertion of the lines occurs in the reverse order of their assertion.

Also, I hate to be greedy, but if someone were to provide a quick-and-dirty overview of the architecture of the various camera-related software components within Linux, it would relieve me of fiddling-around and guessing.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Fri Oct 14, 2016 7:59 pm

RareHare wrote:
6by9 wrote: As with all the camera control code (and codecs, and most of the other multimedia functions), it's in the closed source GPU firmware.
I ask because I am particularly interested in the order in which this firmware asserts the two GPIO signals that emanate from the GPIO expander chip toward the camera board. There are essentially two possibilities for order of assertion when the camera is about to "do something":
  1. Assert GPIO for power, then assert GPIO for LED.
  2. Assert GPIO for LED, then assert GPIO for power.
In both cases, I am hoping that the programmer who wrote the code, adhered to a LIFO model regarding order-of-assertion/de-assertion. That is, de-assertion of the lines occurs in the reverse order of their assertion.
And it matters because?
The GPIO for the LED only drives an LED (except on badly cloned V1 boards). It doesn't touch the sensor, hence why you can disable it.
I too had expected the LIFO model, but it appears not. As above, it doesn't matter, and I'm not intending to fix it.
RareHare wrote:Also, I hate to be greedy, but if someone were to provide a quick-and-dirty overview of the architecture of the various camera-related software components within Linux, it would relieve me of fiddling-around and guessing.
If you're looking for generic Linux, then V4L2 is the interface you're wanting.
Pi has additional functionality exposed via the MMAL API. Look at the raspicam source.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Sat Oct 15, 2016 12:27 am

6by9 wrote: And it matters because?
I have a proprietary chip that sits on top of both wires while the camera is in use (strange, I know), and it turns out that LIFO assertion of the wires would assist my design greatly. I guess it is one of those situations where it does not matter to most, but to some, its wonderful, kinda like dung for a dung beetle. [I am the beetle in this case.]
6by9 wrote: The GPIO for the LED only drives an LED (except on badly cloned V1 boards). It doesn't touch the sensor, hence why you can disable it.
I too had expected the LIFO model, but it appears not. As above, it doesn't matter, and I'm not intending to fix it.
Do you know if the assertions are "all over the place", of it is at least contained only at the beginning and end of a camera session? Also, I have seen many of your posts, and I know you are an expert, but I always thought that you were not the person who actually wrote the code. Are you?
6by9 wrote: If you're looking for generic Linux, then V4L2 is the interface you're wanting.
Pi has additional functionality exposed via the MMAL API. Look at the raspicam source.
Thanks for the link. It helps a lot.

I was also hoping for something like a module stack that shows what components are involved. Something like:

raspistill/raspivid
...
... (What modules are here?)
...
kernel

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Sat Oct 15, 2016 10:11 am

RareHare wrote:
6by9 wrote: The GPIO for the LED only drives an LED (except on badly cloned V1 boards). It doesn't touch the sensor, hence why you can disable it.
I too had expected the LIFO model, but it appears not. As above, it doesn't matter, and I'm not intending to fix it.
Do you know if the assertions are "all over the place", of it is at least contained only at the beginning and end of a camera session?
Assuming the sensor is performing correctly and doesn't have to be reset, then it asserts the LED line (normally used for LDO reg control) then the shutdown line as it opens the driver. On close it deasserts the LED line, then the shutdown line. So the lines should remain stable through the session. On reset it just does a power cycle using the same steps.
RareHare wrote: Also, I have seen many of your posts, and I know you are an expert, but I always thought that you were not the person who actually wrote the code. Are you?
I worked for Broadcom for 7 years in the team that generally provided the OpenMax/MMAL integration layers. If you looked at a very simplified stack, it is along the lines of:

Code: Select all

App
MMAL / IL
Imaging pipeline -> imaging algorithm control
Sensor driver
So whilst not my area of responsibility, over that time I did a fair amount of tinkering within most of that lot, as I was the one making the requests of "can we do ABC for this use case?". Sensor drivers were almost always project specific, and often copy/paste/edit of the last one done, therefore this lack of LIFO appears to have propagated across multiple sensor drivers. Seeing as one shipped in a phone I'm a little surprised that there wasn't a complaint about shutdown still being asserted after power off, but we're talking usecs - ho hum.
Seeing as Broadcom made us all redundant, there's me and one other from the above teams providing support for all of that lot, plus video_encode and image_encode. And that's on a voluntary basis (I have a full time job elsewhere). Even though it would only be a 4 line change which should have zero effect, it's not a priority.
RareHare wrote:I was also hoping for something like a module stack that shows what components are involved. Something like:

raspistill/raspivid
...
... (What modules are here?)
...
kernel
raspistill/vid
userland/interface/mmal/core
userland/interface/mmal/vc
userland/interface/vchiq
kernel vchiq driver
GPU.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Sat Oct 15, 2016 10:49 pm

6by9 wrote: Seeing as Broadcom made us all redundant, there's me and one other from the above teams providing support for all of that lot, plus video_encode and image_encode. And that's on a voluntary basis (I have a full time job elsewhere). Even though it would only be a 4 line change which should have zero effect, it's not a priority.

raspistill/vid
userland/interface/mmal/core
userland/interface/mmal/vc
userland/interface/vchiq
kernel vchiq driver
GPU.
This helps a lot. Thanks. I am going to read-up on these after I get back from dinner.

I realize that it appears that the order-of-assertion does not matter, but I must re-invoke my dung beetle analogy: People generally think of beetle dung as undesirable, or neutral, at best. The beetle, however, begs to differ. I need that dung! :) Of course, I would be willing to roll it around myself [make changes to driver source code].
6by9 wrote:Assuming the sensor is performing correctly and doesn't have to be reset, then it asserts the LED line (normally used for LDO reg control) then the shutdown line as it opens the driver. On close it deasserts the LED line, then the shutdown line. So the lines should remain stable through the session. On reset it just does a power cycle using the same steps.
I was under the impression from one of jbeale's posts that the wire for power-control is not the wire that is used for the LED.

Using an RPI3 with 8MP module, when I checked with a scope, according to this schematic for flex cable between RPi and camera module, it appeared that CAM_GPIO was, indeed, being used for power-control, and that CAM_CLK was for the LED, the latter being verified by using disable_camera_led=1 and controlling the GPIO line manually. I also saw what you said before in this thread and other threads that the driver software will force a reset if it loses communication with camera module. I verified this by dropping CAM_GPIO (power) manually, and noticing that it was brought back up immediately.

In any case, that slight change, where LIFO model is followed, and power is done first, then LED, at the beginning, reverse at the end, would help quite a bit.

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Tue Oct 18, 2016 8:30 pm

6by9 wrote: Seeing as Broadcom made us all redundant, there's me and one other from the above teams providing support for all of that lot, plus video_encode and image_encode. And that's on a voluntary basis (I have a full time job elsewhere). Even though it would only be a 4 line change which should have zero effect, it's not a priority.
RareHare wrote:I was also hoping for something like a module stack that shows what components are involved. Something
I forgot to ask explicitly:

Is there source code where I can make the changes myself to the (driver?) so that the lines are asserted/de-asserted in LIFO order?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12375
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Disable camera led on Pi3

Wed Oct 19, 2016 7:35 pm

RareHare wrote:I forgot to ask explicitly:

Is there source code where I can make the changes myself to the (driver?) so that the lines are asserted/de-asserted in LIFO order?
You've already had that answered - viewtopic.php?f=43&t=138290#p1051363
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

RareHare
Posts: 89
Joined: Thu Jun 20, 2013 7:17 pm

Re: Disable camera led on Pi3

Wed Oct 19, 2016 11:17 pm

6by9 wrote:
RareHare wrote:I forgot to ask explicitly:

Is there source code where I can make the changes myself to the (driver?) so that the lines are asserted/de-asserted in LIFO order?
You've already had that answered - viewtopic.php?f=43&t=138290#p1051363
I see. And, as I understand it, you, and perhaps 1 other person, are the only two people who have the ability to "fix" the code as I would want it?

Return to “Camera board”