USB charging observations - General Discussion and Assistance - CHDK Forum supplierdeeply

USB charging observations

  • 0 Replies
  • 1725 Views
*

Offline reyalp

  • ******
  • 14118
USB charging observations
« on: 21 / December / 2019, 01:17:24 »
Advertisements
Some notes about USB charging on SX730, which may apply to other recent Canon cameras with USB charge support:

The camera behaves differently depending whether it thinks it's connected to a USB host, a supported charger or an unsupported charger.

For a host, it boots normally when the cable is connected.  The screen turns on, CHDK runs. Like other PowerShots, the screen goes black if it receives PTP GetObjectHandles. Pressing play or power appears to power the camera off completely.
This mode is triggered on connecting to a powered on computer, or a powered hub with no computer attached (with some exceptions described later)

In this mode, the camera initially does not charge. get_vbatt shows around 4.47 fluctuating slightly. This is significantly higher than I'd expect charge voltage for a lithium ion battery to be, but I believe it's not going to the battery. After leaving it connected in this state for 30 minutes and unplugging, the battery voltage was the same as it was before connecting, and the battery was also not on fire.

When the camera receives PTP GetObjectHandles, the screen goes black and the green activity LED blinks periodically. get_vbatt() shows around 4.15, which would be reasonable charging voltage, and after leaving this way for a while, battery SOC is increased. PTP communication works normally, but like other powershots, switching to rec is impossible.


For supported chargers, the activity LED lights solid orange, and no other activity is seen. Pressing play or power in this state boots the camera, and pressing again returns to solid orange LED.

All the generic micro-usb chargers I tried (for phones and bluetooth headsets) entered charging mode.

For unsupported chargers, such as an Apple USB charger and an always-powered charging port on an Acer laptop, the camera appears not to respond at all.

I verified by blinking in loader that the main core starts and loads diskboot in both the supported and unsupported case. However, a CHDK startup script that tries to write to a file doesn't record anything, and a blinker task started with spytask only blinks a couple times, so I believe it shuts down soon after it decides it's on a charger.

If power or play is clicked when in charging mode, the camera boots into playback mode, shows a charging icon, and battery voltage shows ~4.15. The Canon firmware does not allow you to switch to rec in this state, but CHDK set_record() does.

When I put a ~10s blink in loader and connected to a USB charger, the orange LED flashed once and the camera booted to the normal firmware rather than going to charge mode. A ~1s blink went to charge mode.

The camera does not boot on USB power if no battery is present. If a battery is inserted while USB is connected, the camera boots immediately.


Implications for CHDK:
The fact that GetObjectHandles is required to enter PC charging means that chdkptp users will generally not get charging, unless they specifically issue !con:ptp_get_object_handles(). It also means you can't charge while using live view and remote shoot.

Powering on from USB means that if you have USB remote enabled, just applying USB could cause the camera to boot, switch to rec and shoot.

Since diskboot is loaded in the charger case, it should be possible to hook into the logic that decides charger or host. This could be useful to allow charging on USB without sending GetObjectHandles, or to boot on power that isn't actually connected to a USB. I noticed the function that decides which key was used to start (sx730 100d fc589910, sx710 101a fc0cf0ee) has some additional code compared to sx710, which I suspect is related.


Miscellaneous notes and oddities:
On sx730 "UsbcTask" is created in fc0e54a6 (from task_Startup) and references "USBChrg.c"
levents 0x1167-0x1169 are posted from this task.
0x1167 shows the "charge" icon
0x1168 shows "full"
0x1169 shows neither

It would be nice to know how the camera distinguishes between the different cases. I assume the different electrical configurations of hubs vs typical USB chargers can be found on the internet. I also noticed in the ixus220 debugging that MMIOs differ for an unconnected hub, a charger or a full host connection, even on non-USB charging cams.

Connecting to a Kensington K33980AM powered USB 3 hub, the camera boots, but is not detected
by the host computer and does not charge. The hub description claims "Charging ports are compliant with USB BC 1.2 standard" and apple stuff.

Plugging directly into an original raspberry pi (notorious for low USB power) the camera does not power on. However, if the camera is turned on manually, USB communication works as expected.

Linux shows bMaxPower 500ma and bus powered, where cameras without USB charging are 2ma and self powered.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal