supplierdeeply

Turning the camera on or off using USB and CHDK? Gphoto2 Webcam Remote Capture

  • 25 Replies
  • 15778 Views
Advertisements
That's quite possible but ... 

I'm pretty familiar with USB charging standards.  For the most part,  they are implemented on the charger end with simple resistor networks.  The ones for Apple devices require several resistors but other devices (Samsung, Blackberry) only require the D+ & D- lines to be either shorted or connected with a low ohm resistor (200 ohms).



However, in the case of the Powershot N (as I stated), my tests indicate that the decision about whether to start when USB power is applied or not is controlled by the camera firmware rather than a seperate charge controller chip.  CHDK loads and runs (briefly) before something in the firmware decides there is nothing intelligent connected to the D+ & D- pins.  This is different that detecting some resistor combination (which my PC USB port does not have BTW).  I suppose it's possible that the firmware gets a USB status from a small charger chip but my conclusion remains the same - getting around this requires modifying the boot.c code rather than hardware.

My conclusions only ... it would not be the first time I have been wrong.


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Paco

  • **
  • 77
However, in the case of the Powershot N (as I stated), my tests indicate that the decision about whether to start when USB power is applied or not is controlled by the camera firmware rather than a seperate charge controller chip.  CHDK loads and runs (briefly) before something in the firmware decides there is nothing intelligent connected to the D+ & D- pins.  This is different that detecting some resistor combination (which my PC USB port does not have BTW).  I suppose it's possible that the firmware gets a USB status from a small charger chip but my conclusion remains the same - getting around this requires modifying the boot.c code rather than hardware.

My conclusions only ... it would not be the first time I have been wrong.

I don't know how you are concluding that enumeration is taking place in firmware but it doesn't matter how the voltages are supplied or whether enumeration takes place in hardware or in firmware. All that's important is supplying the correct data voltages. What do you mean by "nothing intelligent connected to the D+ & D- pins"? What intelligence does a computer's USB port supply when it is idly connected to a device like this, other than fixed voltages? Did you measure them and then try applying the voltages you measured to the appropriate data lines? That's all you need to do.

The PowerShot N also wakes up on USB connection.
Time for some more experiments.

@ H-H, The question is: Does, the Canon PowerShot N, use this pin? [Mini-USB ID Pin 4]

@ wbloos,  Is the USB ID pin used by Canon?,  by wbloos, see here:-
http://chdk.setepontos.com/index.php?topic=10281.msg102153#msg102153

@ ahull  "...Sadly there is a lot more to this than meets the eye..."

@ W-W And also see here:-
http://en.wikipedia.org/wiki/USB and the "...USB 1.x/2.0 Mini/Micro PinOuts..."

Connector Types #1; "...To reliably enable a charge-only feature, modern USB accessory peripherals now include charging cables that provide power connections to the host port
    but no data connections, and both home and vehicle charging docks are available that supply power from a converter device and do not include a host device and data pins, allowing any capable USB device to charge or operate from a standard USB cable..."

Mini and Micro Connectors #2; "...(Mini-B connectors are still supported but not OTG (On The Go, i.e. mobile) compliant)..."

USB On-The-Go connectors #3; "...To enable type-AB receptacles to distinguish which end of a cable is plugged in, mini and micro plugs have an "ID" pin in addition to the four contacts found in standard-size USB connectors. This ID pin is connected to GND in type-A plugs, and left unconnected in type-B plugs.
                             Typically, a pull-up resistor in the device is used to detect the presence or absence of an ID connection..."

Mobile Device Charger Standards #4; "...In China...This was the first standard to use the convention of shorting D+ and D-..."

EU Smartphone Power Supply Standard #5; "... The EU's common EPS specification (EN 62684:2010) references the USB Battery Charging standard and is similar to the GSMA/OMTP and Chinese charging solutions..."

H-H

I don't know how you are concluding that enumeration is taking place in firmware but it doesn't matter how the voltages are supplied or whether enumeration takes place in hardware or in firmware.
Actually, it matters a lot.  See below.

Quote
All that's important is supplying the correct data voltages. What do you mean by "nothing intelligent connected to the D+ & D- pins"? What intelligence does a computer's USB port supply when it is idly connected to a device like this, other than fixed voltages? Did you measure them and then try applying the voltages you measured to the appropriate data lines? That's all you need to do.
I think you are missing my point here. 

I'm not really interested in how the camera performs when connected for charging with its various "data voltages".  And I don't care too much about what happens when it's connect to a PC.   What is interesting here is how to get the camera to startup,  in the field, with no PC, by simply supplying it with 5V on the USB connector.   

So far, I've shown that with just 5V and GND connected (data lines floating),  the camera starts, CHDK loads and takes control, and then the camera turns off when CHDK returns control to the Canon firmware.   So what is needed is a change to the CHDK boot code that prevents that from happening.

I' can do some experimenting with resistors to fix the D+ & D- floating state but I'm not holding my breath.  I really don't think the camera is expecting specific voltages from a random port on a clone PC.

I'll also 'scope the data lines when the camera starts with a PC connected and see if the USB enumeration is happening.

« Last Edit: 30 / September / 2014, 19:53:51 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline Paco

  • **
  • 77
So you still haven't measured the D+/D- voltages your computer is supplying? What happens when you connect the camera to your PC? Does a dialog pop up? If so, then there is some kind of data exchange going on. This does happen with my A530 when in 'play' mode but not in 'shoot' mode. If not, then that is a good case for simple voltage detection going on. I just remembered that you said that this camera's battery is charged via the USB port so all the more reason to believe it is just looking for voltages since that is the rule rather than the exception for USB charging. Apparently this camera has no fall-back default charging level if no voltages are present on data lines.
« Last Edit: 01 / October / 2014, 13:01:32 by Paco »

So you still haven't measured the D+/D- voltages your computer is supplying?
Some test results :

1) Measuring resistances & voltages of the USB jack on the "battery charger" (wall wart) supplied with the camera shows +5V & ground where expected and a 0 ohms direct short between the D+ and D- lines.  The data lines are not connected in any way to the +5 or ground (infinite ohms on the meter).  So my diagram showing "high current" charging enabled by shorting D+ & D- appears to be correct.

2) Measurements of the USB cable connections between PC and camera show +5 V and ground as expected.  D+ and D- sit at 0 volts relative to each other and relative to ground.  Basically in a high impedance mode except when data exchanges happen (but those are too quick to see on my DVM).   

3) If I cut the D+ & D- wires and connect the camera to the power pack or PC,  it starts and then shuts down with the "battery charging" lamp dark (i.e not charging even though +5V is present).  If I repeat the sequence with the D+ & D- lines shorted,  the camera starts, shuts down, and the battery charging" light illuminates (i.e. it's charging).  If I then open the D+ & D- short,  the "battery charging" light stays illuminated ( i.e. still charging).

4) The only way to get the camera to start by plugging in a USB cable is to have a PC connected to the other end that recognizes the camera and does a USB enumeration on it.

Quote
What happens when you connect the camera to your PC? Does a dialog pop up? If so, then there is some kind of data exchange going on.
Nothing happens.  But then it's a Linux machine so I was not expecting anything to happen.

Quote
If not, then that is a good case for simple voltage detection going on.
I theorized earlier that the camera "wakes up" when 5V is applied and it stays awake if it gets enumerated by the PC's USB driver. I think I've now shown that to be the case.

Quote
I just remembered that you said that this camera's battery is charged via the USB port so all the more reason to believe it is just looking for voltages since that is the rule rather than the exception for USB charging. Apparently this camera has no fall-back default charging level if no voltages are present on data lines.
This turns out not to be what happens.  The camera is not just simply looking for voltages (see above). The decision to stay started and/or enter charging mode is controlled entirely by the Canon firmware - there is no separate USB power control / charger chip at work here.

So, like I've said, getting the camera to power up in the field without a PC is going to require a hack to the boot.c code.  Resistors on the data lines are not going to do it.
« Last Edit: 01 / October / 2014, 23:08:11 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics