Powershot N Porting Thread - page 17 - DryOS Development - CHDK Forum supplierdeeply

Powershot N Porting Thread

  • 212 Replies
  • 64335 Views
*

Offline srsa_4c

  • ******
  • 4426
Re: Powershot N Porting Thread
« Reply #160 on: 13 / September / 2014, 10:32:51 »
Advertisements
So, the internal charger appears to be software controlled. 1.7 ... 4 mA is much better than 80mA, so USB remote is not out of question.
I also appear to have something wrong in the boot.c code.  Powershot N power management is likely different than other cameras - it won't start in (or go onto) shooting mode if USB power is connected.  The camera starts normally (without CHDK enabled) while the USB charger is plugged in.  When attempting to autoboot (SD card door open) with the charger connected, the boot strap LED flash sequence occurs but CHDK does not start.   Trying a firmware update in this mode also fails to start.
This might be something in the usual startup mode detection fw routine(s)?

Quote
Also, the USB charge light on the camera never comes on when the N is plugged into my Linux box.  I have the USB configured to ignore the N so that chdkptp can grab it.  Perhaps the camera notices that and won't go into high current charging mode.
It may depend on a software handshake. Will it charge after using chdkptp or gphoto?

Re: Powershot N Porting Thread
« Reply #161 on: 13 / September / 2014, 11:18:31 »
So, the internal charger appears to be software controlled. 1.7 ... 4 mA is much better than 80mA, so USB remote is not out of question.
While software control seems likely,  it might also be a "smart" charging chip.  It seems strange that  baumandr saw 80 mA when he measured it - I assume he had somehow enabled charging mode.

@baumandr: was the yellow "charging" led above the USB port illuminated during your test?

Quote
This might be something in the usual startup mode detection fw routine(s)?
That's my assumption too.

It seems to have another quirk that sometimes, when you first press the <ALT> button (the wifi button) it will switch from playback to shooting mode rather than enter <ALT>.  A second press of the button enters <ALT>.   And in playing with the charging mode, it sometimes will not function as an <ALT> button at all - bringing up the wifi screen even though it has been very quickly pressed.   I guess I need to go back and study the code where we normally inserted the "powerup correctly" hack in boot.c

Edit : another data point.  You can actually start the camera (CHDK loaded or not) by pressing the wifi button.  In non-CHDK mode, this takes you directly to the wifi "searching for access points" screen.  With CHDK loaded, it causes you to start up in playback mode.

Quote
It may depend on a software handshake.
That would make the little wall charger a "really smart" charger if so.   Although it might have both a hardware & software handshake mechanism - the charger triggers the hardware mechanism and the PC port the software one.  For example :  http://blog.curioussystem.com/2010/08/the-dirty-truth-about-usb-device-charging/ But I was not able to make shorting the D+ to D- trick put the camera into charging mode.  I'll try a 200 ohm resistor next.

Quote
Will it charge after using chdkptp or gphoto?
No.  But if I take it to one of my windows machines and plug it in,   Win7 recognizes the camera and the charging LED turns on.   So some sort of hand shake is happening.  The charger for the camera is pretty well sealed up - not sure I want to grind it open to trace the circuit that way.
« Last Edit: 13 / September / 2014, 12:41:22 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Powershot N Porting Thread
« Reply #162 on: 13 / September / 2014, 13:55:52 »
Update on my previous post :

I modified my USB remote cable with a 200 ohm resistor between D+ and D- as follows :

Using the cable this way results in the camera going into battery charge mode (yellow LED on) and drawing 400 to 500 ma when USB+V is varied from 4.2 to 5.0 V.

If I disconnect the resistor once charging has started,  the cameras stay in charging mode.  Cycle the power off & on with the resistor disconnected and the camera does not re-enter charging mode.  Reconnect the 200 ohm resistor with the power already applied does not cause the camera to start charging again.  Conclusion :  when USB-V+ is asserted, the camera checks for a low impedence path between D+ and D-.  Charging only starts if that low impedance condition is seen when the power is applied to the USB port.   So a standard CHDK USB remote battery powered switch should work with the Powershot N.

Update :   the 200 ohm resistor is not needed.  A "dead short" between D+ and D- will work as well.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Powershot N Porting Thread
« Reply #163 on: 13 / September / 2014, 14:26:16 »
I measured 10 Ohms between D+ and D- in original charger of the "N", not in the cable ore the plug, this is normal USB data cable. This could be the reason to Trigger charging. I did not measure real charging current of original charger.

If camera is off and if I put +5V to USB connector with open D+ an D- always charging led is on and after about one second current goes from 80 mA ! to about 5 or 4 mA.

If camera is on and remote function is activated and I put +5V on USB connector then also 80mA is drained an camera is focusing. But now there is no Change to 4 mA after one second. Also LED stays on. 80 mA is drained until Signal is changing from high to low and camera shoots. Then led goes off. There is also no timeout of remote function. (setting

If I reduce +5V slowly to 4,2 V current decreases continously from 80 mA to about 5 mA, then low state is recognized and Shooting is triggerd.

PWM mode would be ok because i did not recognize that there are Special remote cable wich translate pulse with from 1.5 MS used by rc servo Output to 150 ms to deal with chdk´s get_usb_power function...

Always there is no differnce if Camera is fully chared or half discharged.

Regards, Andreas.


« Last Edit: 13 / September / 2014, 14:32:30 by baumandr »


Re: Powershot N Porting Thread
« Reply #164 on: 13 / September / 2014, 14:34:32 »
I measured 10 Ohms between D+ and D- in original charger of the "N", not in the cable ore the plug, this is normal USB data cable. This could be the reason to Trigger charging. I did not measure real charging current of original charger.
Agreed - the Canon charger has D+ and D- shorted with a 10 ohm resistor.  I modified my cable to simulate the same thing using a conventional 5V power supply.

Quote
If camera is off and if I put +5V to USB connector with open D+ an D- always charging led is on and after about one second current goes from 80 mA ! to about 5 or 4 mA. If camera is on and remote is activated and I put +5V on USB connector then also 80mA is drained an camera is focusing.
I see the same thing - 5 mA if D+ and D- are not connected.  And 80 mA if they are connected but CHDK has USB remote enabled.  What this tells me is that the camera goes into high current charging mode under software control and so when CHDK is in Remote Enabled state, the USB 5V present signal is blocked by CHDK and the Canon software does not see that the remote is connected and thus never enters high current charging mode.

Quote
PWM mode would be ok because i did not recognize that there are Special remote cable wich translate pulse with from 1.5 MS used by rc servo Output to 150 ms to deal with chdk´s get_usb_power function...
You should not need that if you enable the precision timer mode as I mentioned in a previous post.

Update : again, the big message here is that as long as the D+ and D- are not connected together,  or the camera is not plugged into a PC,  then standard USB remote devices (including PWM stuff from RC servos) should work normally.

« Last Edit: 13 / September / 2014, 14:54:58 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

CHDK doesn't work with High-Speed Video?
« Reply #165 on: 26 / September / 2014, 09:24:21 »
The PowerShot N does 240FPS at 320x240 or 120FPS at 640x480 by itself, but hangs when tried under CHDK. First the LCD freezes, then goes black. I even had a microSD card apparently get scribbled on during that.

I'm assuming the problem is either memory use or, more likely, callbacks invoked during capture. I (and my students) can guess at the patches needed, but has anybody else encountered this problem?  Anything known about how to fix it?

Re: Powershot N Porting Thread
« Reply #166 on: 26 / September / 2014, 09:44:30 »
The PowerShot N does 240FPS at 320x240 or 120FPS at 640x480 by itself, but hangs when tried under CHDK. First the LCD freezes, then goes black. I even had a microSD card apparently get scribbled on during that.

I'm assuming the problem is either memory use or, more likely, callbacks invoked during capture. I (and my students) can guess at the patches needed, but has anybody else encountered this problem?  Anything known about how to fix it?
As the person who did the port, this is the first I've heard of this so it's likely this is the first time it has has been reported. But it's not exactly a popular camera for CHDK so that is not too surprising.  And I don't use video so there has not been a lot of testing.

When you do these tests, do you have any of the CHDK video options enabled? Do you have any CHDK shooting options enabled? Or does it crash with just a fresh CHDK load?

If you want to post a patch, that will save me looking into this. Otherwise, I'll take a look this weekend.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4426
Re: Powershot N Porting Thread
« Reply #167 on: 26 / September / 2014, 10:07:17 »
Hint.

This will surely crash (movie_rec.c):

"loc_FF23B18C:\n"
"    LDR     R1, [R4, #0xCC] \n" -> function pointer loaded to R1
"    LDR     R0, =video_compression_rate \n" // added
"    BL      set_quality \n"                 // added
"    BL      mute_on_zoom \n"                // added
"    BLX     R1 \n" -> will try to execute the function, but R1 is trashed at this point

Rearranging the lines may help (add the 3 lines before LDR R1, ...), but I don't know whether this is the right spot to adjust compression.


Re: Powershot N Porting Thread
« Reply #168 on: 26 / September / 2014, 10:21:17 »
Hint.

This will surely crash (movie_rec.c):

"loc_FF23B18C:\n"
"    LDR     R1, [R4, #0xCC] \n" -> function pointer loaded to R1
"    LDR     R0, =video_compression_rate \n" // added
"    BL      set_quality \n"                 // added
"    BL      mute_on_zoom \n"                // added
"    BLX     R1 \n" -> will try to execute the function, but R1 is trashed at this point

Rearranging the lines may help (add the 3 lines before LDR R1, ...), but I don't know whether this is the right spot to adjust compression.
Doh! Thanks for that - travelling with no access to source or the camera right now. 

Like I said - not much testing and the video code is basically a C&P from another port.   Ill test this weekend and go through the video modes more thoroughly

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline nafraf

  • *****
  • 1308
Re: Powershot N Porting Thread
« Reply #169 on: 26 / September / 2014, 15:06:18 »
Attached patch should solve the crash (it just move calls to CHDK functions one instruction later).
The next problem is to check if video quality control works, that feature has not worked on other DryOS R52 cameras.

 

Related Topics