Unit turns on when using GPS logger on S100 - General Discussion and Assistance - CHDK Forum  

Unit turns on when using GPS logger on S100

  • 18 Replies
  • 8597 Views
Unit turns on when using GPS logger on S100
« on: 09 / May / 2015, 03:37:10 »
Advertisements
Hi,

Checked with both the stable and development branches..
I now mainly use the S100 as a GPS logger for my G7 X.  When turning on the GPS logger feature in the main camera menu, every so many minutes the camera itself will turn on in playback mode and stay there until I turn it off again - and this repeats.
I've tried turning the GPS features off in CHDK, but it still does it.
Is this a known limitation of CHDK with that function, or some kind of bug?

For the time being I use a separate card when I want to use it as a GPS logger, which is more often than not these days.  (I really wish the G7X had GPS instead of Wi-Fi.)

Also - hint, hint..  CHDK for G7X! =)

Many Thanks.

*

Offline srsa_4c

  • ******
  • 4451
Re: Unit turns on when using GPS logger on S100
« Reply #1 on: 09 / May / 2015, 06:33:08 »
When turning on the GPS logger feature in the main camera menu, every so many minutes the camera itself will turn on in playback mode and stay there until I turn it off again - and this repeats.
(...)
Is this a known limitation of CHDK with that function, or some kind of bug?
Apparently, the camera uses the main processor (DIGIC) in connection with the GPS logger and this specific condition was not considered by the developer making the port. CHDK only supports 2 operating modes when executing its startup sequence: record (aka shooting) mode and playback mode.
This GPS related startup would need to be detected somehow, preventing CHDK from putting the cam in playback mode.
Until that happens, perhaps you could use a countdown script (set to automatic start) that shuts down the camera if no buttons are pressed for (for example) 10 seconds. Or, you can use the firmware update method to start CHDK manually.

Quote
Also - hint, hint..  CHDK for G7X! =)
Here's the standard response. There aren't a lot of people interested in making new ports these days...
There's one thing you could do to check if porting is even possible: try dumping the camera's firmware: http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper

Re: Unit turns on when using GPS logger on S100
« Reply #2 on: 09 / May / 2015, 07:58:56 »
I now mainly use the S100 as a GPS logger for my G7 X.  When turning on the GPS logger feature in the main camera menu, every so many minutes the camera itself will turn on in playback mode and stay there until I turn it off again - and this repeats.
Have you tried disabling the S100 built-in logging and using the CHDK version of it?  I had not noticed this issue with my S100 but all my testing was with CHDK logging.

For the time being I use a separate card when I want to use it as a GPS logger, which is more often than not these days. 
Would it not be simpler to just set the card lock switch to the locked position when you want to use CHDK and the unlocked position when you want to use the camera as a GPS logger.

Apparently, the camera uses the main processor (DIGIC) in connection with the GPS logger and this specific condition was not considered by the developer making the port. CHDK only supports 2 operating modes when executing its startup sequence: record (aka shooting) mode and playback mode.
I can take a look at this on my S100.    I assume that what is happening here involves the camera's built-in GPS tracking function needing to periodically wake up the DIGIC so that it can dump tracking coordinates to the SD card?

I guess there are three options.
  • detecting that the camera has been started without the playback or on/off button being pressed
  • detecting some other flag that indicates a GPS power up
  • turning the camera off automatically if no buttons are pressed after a fixed delay.

In the first two cases,  we would also need to figure out how to get through boot.c without going into playback mode.  I suppose this might require a change to the loader instead.

In the third case,  a small hack to spytask would do it but would be camera specific.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Unit turns on when using GPS logger on S100
« Reply #3 on: 09 / May / 2015, 08:24:05 »
I can take a look at this on my S100.    I assume that what is happening here involves the camera's built-in GPS tracking function needing to periodically wake up the DIGIC so that it can dump tracking coordinates to the SD card?
I would guess so. My sx280 also has GPS logger, but I never let it run for more than 1-2 hours - the DIGIC doesn't seem to be awake during that time.

Quote
I guess there are three options.
  • detecting that the camera has been started without the playback or on/off button being pressed
  • detecting some other flag that indicates a GPS power up
  • turning the camera off automatically if no buttons are pressed after a fixed delay.

In the first two cases,  we would also need to figure out how to get through boot.c without going into playback mode.
The first place to look at would be
https://www.assembla.com/code/chdk/subversion/nodes/4153/trunk/platform/s100/sub/100d/boot.c#ln343
Try logging the parameters passed to sub_FF024AF4 and see if there's a difference between playback and GPS-log mode. If that doesn't help detecting that unusual mode, try dumping RAM (0x1900-MEMISOSTART) and check for differences...


Re: Unit turns on when using GPS logger on S100
« Reply #4 on: 09 / May / 2015, 08:29:46 »
The first place to look at would be
https://www.assembla.com/code/chdk/subversion/nodes/4153/trunk/platform/s100/sub/100d/boot.c#ln343
Try logging the parameters passed to sub_FF024AF4 and see if there's a difference between playback and GPS-log mode

Another option might be to look at line 141 :
Code: [Select]
*(int*)(0x26E0+0x4) = (*(int*)0xC022F48C)&4 ? 0x200000 : 0x100000;where we try to detect a "held" On/Off button.  It would make the S100 a special case but requiring either the On/Off button or Playback button be held down might allow the code to be turned back off if it wasn't.    It might even be possible that there is another 'interesing' bit related to GPS startup there?

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Unit turns on when using GPS logger on S100
« Reply #5 on: 09 / May / 2015, 08:35:41 »
Another option might be to look at line 141 :
Code: [Select]
*(int*)(0x26E0+0x4) = (*(int*)0xC022F48C)&4 ? 0x200000 : 0x100000;where we try to detect a "held" On/Off button.  It would make the S100 a special case but requiring either the On/Off button or Playback button be held down might allow the code to be turned back off if it wasn't.    It might even be possible that there is another 'interesing' bit related to GPS startup there?
We're talking about the same thing, this line of code is a replacement for sub_FF024AF4. Hopefully the 'GPS start' signal doesn't go away like the button press does...

edit:
this part of fw is suspicious due to its context (Dcdc_Rtc_Set_Timer_Reg):
Code: [Select]
sub_ff022bd8:
ff022bd8: e59f0030 ldr r0, [pc, #48] ; ff022c10: (00001bf4)
ff022bdc: e5901000 ldr r1, [r0]
ff022be0: e3510000 cmp r1, #0
ff022be4: 03a00000 moveq r0, #0
ff022be8: 012fff1e bxeq lr
ff022bec: e5900004 ldr r0, [r0, #4]
ff022bf0: e3500001 cmp r0, #1
ff022bf4: 13a00002 movne r0, #2
ff022bf8: e12fff1e bx lr
loc_ff022bfc:
ff022bfc: ea0000f5 b loc_ff022fd8 ; <Dcdc_Rtc_Set_Timer_Reg_FW>
ff022c00: e3a02000 mov r2, #0
ff022c04: e1a01002 mov r1, r2
ff022c08: e1a00002 mov r0, r2
ff022c0c: ea0000f1 b loc_ff022fd8 ; <Dcdc_Rtc_Set_Timer_Reg_FW>
sub_ff022bd8 provides one of the parameters for sub_FF024AF4...
« Last Edit: 09 / May / 2015, 08:43:54 by srsa_4c »

Re: Unit turns on when using GPS logger on S100
« Reply #6 on: 09 / May / 2015, 12:10:13 »
Hopefully the 'GPS start' signal doesn't go away like the button press does...
Well,  the easiest fix isn't going to work.  I stored the value in *0xC022F48C during boot.c and dumped to the screen via spytask.

The value is identical whether the camera is started via the "GPS wakeup" or the "Play" button (or via On/Off quick press).

I also confirmed that if you don't set the *(0x26E4) value to either 0x200000 or 0x100000 then the camera will try to start and then shut down.



Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Unit turns on when using GPS logger on S100
« Reply #7 on: 09 / May / 2015, 12:51:00 »
I stored the value in *0xC022F48C during boot.c and dumped to the screen via spytask.
That's the MMIO address of the ON/OFF button's GPIO pin, it's surely not related to the GPS.
If you take a look at sub_FF024AF4 you'll notice that it can set 4 bits of *(0x26e4). We'll need one of the other two bits for signalling 'GPS log' startup mode (this is still only speculation), and we'll likely need to prevent CHDK from starting in that case.
I would read and display the value returned by sub_ff022bd8 (note that I'm using 100d addresses for my posts because that's what I have disassembled).


Re: Unit turns on when using GPS logger on S100
« Reply #8 on: 09 / May / 2015, 12:56:17 »
I stored the value in *0xC022F48C during boot.c and dumped to the screen via spytask.
That's the MMIO address of the ON/OFF button's GPIO pin, it's surely not related to the GPS.
Yes - I knew that.  I was sort of hoping the GPS chip would be connected via a GPIO pin too.  Hence my comment about not getting lucky with the easy way.

Quote
If you take a look at sub_FF024AF4 you'll notice that it can set 4 bits of *(0x26e4). We'll need one of the other two bits for signalling 'GPS log' startup mode (this is still only speculation), and we'll likely need to prevent CHDK from starting in that case.
I'll take a look.  If we can figure out which bit means GPS start and what sets it then I think that just not setting the play or shooting mode bits in that case will do what we need.

Quote
I would read and display the value returned by sub_ff022bd8 (note that I'm using 100d addresses for my posts because that's what I have disassembled).
I have a 102a fwiw but will adjust knowing you are using the 100d.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Unit turns on when using GPS logger on S100
« Reply #9 on: 09 / May / 2015, 13:44:51 »
Update :  not good news

I commented out the line of code that reads the mmio's and I also restored the call to sub_FF024AF4.   This loses the ability to start the camera in shooting mode by holding down the On/Off buttton of course but we don't need that for our testing here.

Then I added a bit of code right after the call to sub_FF024AF4 that copies the value from 0x26e4 to my temporary variable (the one that spytask() displays for me).

Now if I boot by pressing just the playback or on/off buttons the value in 0x26e4 is 0x00400000 on return from that subroutine.

Unfortunately,  that's also the value when the camera wakes up due to the GPS chip.

So I'm wondering is we lose something during the fake firmware update reboot?

Update :  I guess I could just try forcing the other two bits in 0x26e4 ( 0x00800000 & 0x0400000) and see what happens.

« Last Edit: 09 / May / 2015, 13:47:47 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics