IXUS 500 HS - ELPH 520 Porting Thread - DryOS Development - CHDK Forum supplierdeeply

IXUS 500 HS - ELPH 520 Porting Thread

  • 76 Replies
  • 32515 Views
*

Offline Wolle

  • *
  • 22
IXUS 500 HS - ELPH 520 Porting Thread
« on: 03 / February / 2014, 12:48:06 »
Advertisements
Just started porting the software for my camera. This is my first port so I might need some help from time to time.

At the moment I´m searching for the led addresses. I tried the script that pokes through the addresses from 0xC0220099 to 0xC0220100 without success. Has anybody a hint where or how I can find the adresses for my camera?
« Last Edit: 03 / February / 2014, 13:55:38 by Wolle »

*

Offline srsa_4c

  • ******
  • 4451
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #1 on: 03 / February / 2014, 16:22:30 »
Hi,

I only have hints. This is a DIGIC 5 camera, previously used methods for setting LEDs don't really work on these anymore.
Since you're already using a Canon Basic script, you could try the following:

There is an event procedure named LEDDrive . It is registered by the Driver.Create event procedure. LEDDrive has three arguments: the first one is the id of the LED (0,1,2,...), the second one is the LED's state (0=off, 1=on), the third is probably the brightness of the AF LED (0..255? just guessing). The maximum LED id is probably less than 16.
New cameras usually only have 2 LEDs (power, AF) that can be accessed by this event procedure.
Once you know the IDs of the two LEDs, try reading back the appropriate DIGIC register from the following list:
Code: [Select]
GPIO table, fw 100d

ff423aa0: c022c0ac
ff423aa4: c022c0b0
ff423aa8: c022c0b4
ff423aac: c022c0b8
ff423ab0: c022c0bc
ff423ab4: c022c0c0
ff423ab8: c022c0c4
ff423abc: c022c0c8
ff423ac0: c022c0cc  ; #8
ff423ac4: c022c0d0
ff423ac8: c022c0d4
ff423acc: c022c0d8
ff423ad0: c022c0dc
ff423ad4: c022c0e0
ff423ad8: c022c0e4
ff423adc: c022c0e8
ff423ae0: c022c0ec
ff423ae4: c022c0f0  ; #17
ff423ae8: c022c0f4
ff423aec: c022c0f8
ff423af0: c022c0fc
ff423af4: c022c100
ff423af8: c022c104
ff423afc: c022c108
ff423b00: c022c10c
ff423b04: c022c110
ff423b08: c022c114
ff423b0c: c022c118
ff423b10: c022c11c
ff423b14: c022c120
ff423b18: c022c124
ff423b1c: c022c128
ff423b20: c022c12c
ff423b24: c022c130
ff423b28: c022c134
ff423b2c: c022c138
ff423b30: c022c13c
ff423b34: c022c140
ff423b38: c022c144
ff423b3c: c022c148
ff423b40: c022c14c
ff423b44: c022c150
ff423b48: c022c154
ff423b4c: c022c158
ff423b50: c022c15c
ff423b54: c022c160
ff423b58: c022c164
ff423b5c: c022c168
ff423b60: c022c16c
ff423b64: c022c170
ff423b68: c022c174
ff423b6c: c022c178
ff423b70: c022c17c
ff423b74: c022c180
ff423b78: c022c184
ff423b7c: c022c188
ff423b80: c022c18c
ff423b84: c022c190
ff423b88: c022c194
ff423b8c: c022c198
ff423b90: c022c19c
ff423b94: c022c1a0
ff423b98: c022c1a4
ff423b9c: c022c1a8
ff423ba0: c022c1ac
ff423ba4: c022c1b0
ff423ba8: c022c1b4
ff423bac: c022c1b8
ff423bb0: c022c1bc
ff423bb4: c022c1c0
ff423bb8: c022c1c4
ff423bbc: c022c1c8
ff423bc0: c022c1cc
ff423bc4: c022c1d0
ff423bc8: c022c1d4
ff423bcc: c022c1d8
ff423bd0: c022c1dc
ff423bd4: c022c1e0
ff423bd8: c022c1e4
ff423bdc: c022c1e8
ff423be0: c022c01c
ff423be4: c022c024
ff423be8: c022c010
ff423bec: c022c014
ff423bf0: c022c004
ff423bf4: c022c008
ff423bf8: c022c020
ff423bfc: c022c00c
ff423c00: c022c018
ff423c04: c022c028
ff423c08: c022c060
ff423c0c: c022c064
ff423c10: c022c068
ff423c14: c022c06c
ff423c18: c022c070
ff423c1c: c022c074
ff423c20: c022c078
ff423c24: c022c1fc
ff423c28: c022c200
I have the suspicion that the two LEDs are tied to the marked two GPIO addresses (#8 and #17), so try reading back the 32bit value of 0xc022c0cc and 0xc022c0f0 ( you could use Peek32 which is registered by System.Create ) after you
- turned one of the LEDs on
- turned the LED off
If the values you're seeing are changing, you could post them here. I have an idea how to turn them on and off directly, but I can't try that myself.

Sorry for the long and perhaps confusing post.

*

Offline Wolle

  • *
  • 22
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #2 on: 03 / February / 2014, 16:53:02 »
Just added a page on my homepage where I will try to update all the intersting files.

http://www.codereactor.de/ixus500hs/index.html

Added 2014-02-03
    stubs_entry.S
    PRIMARY.BIN
    dump-ixus500hs_elph520hs-100e.txt

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #3 on: 03 / February / 2014, 17:02:06 »
Just added a page on my homepage where I will try to update all the intersting files.

http://www.codereactor.de/ixus500hs/index.html

Added 2014-02-03
    stubs_entry.S
    PRIMARY.BIN
    dump-ixus500hs_elph520hs-100e.txt

nafraf has done some initial work on the 1.00d verison here - http://subversion.assembla.com/svn/nafraf/chdk/

You might want to send him a PM and see how far along it is, and how much testing was done. It might be easier to re-use his work, than start from scratch.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


*

Offline Wolle

  • *
  • 22
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #4 on: 03 / February / 2014, 17:03:57 »
nafraf contacted me already through pm. Thanks for your hint.

*

Offline Wolle

  • *
  • 22
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #5 on: 03 / February / 2014, 17:10:49 »
Poked through the addresses from 0xC0220000 to 0xC022F000 without success. So I assume that i need two adresses to turn on the LED.

*

Offline srsa_4c

  • ******
  • 4451
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #6 on: 03 / February / 2014, 17:24:20 »
Poked through the addresses from 0xC0220000 to 0xC022F000 without success. So I assume that i need two adresses to turn on the LED.
I doubt that, even if some people have found it working.

The following routines are called from the LEDCon task (ixus500, 100d), I think that they are used to turn on and off an LED. Since I don't have access to a DIGIC 5 camera, I can't prove it myself. The magic values written to the GPIOs are 0x93d800 and 0x83dc00.

Code: [Select]
switch LED on

loc_ff12aba4: ; 2 refs
ff12aba4: push {r4, lr}
ff12aba8: mov r4, r0
ff12abac: ldrb r0, [r0]
ff12abb0: cmp r0, #0
ff12abb4: ldreq r0, [r4, #4]
ff12abb8: ldreq r1, [pc, #136] ; ff12ac48: (0093d800)
ff12abbc: bleq loc_ff024474
ff12abc0: mov r0, #0
ff12abc4: strb r0, [r4, #9]
ff12abc8: pop {r4, pc}

switch LED off

loc_ff12abcc: ; 3 refs
ff12abcc: push {r4, lr}
ff12abd0: mov r4, r0
ff12abd4: ldrb r0, [r0]
ff12abd8: cmp r0, #0
ff12abdc: ldreq r0, [r4, #4]
ff12abe0: ldreq r1, [pc, #100] ; ff12ac4c: (0083dc00)
ff12abe4: bleq loc_ff024474
ff12abe8: mov r0, #1
ff12abec: strb r0, [r4, #9]
ff12abf0: pop {r4, pc}

GPIO_poke

loc_ff024474: ; 126 refs
ff024474: ldr r2, [pc, #288] ; ff02459c: (ff423aa0)
ff024478: ldr r0, [r2, r0, lsl #2]
ff02447c: str r1, [r0]
ff024480: bx lr
I have posted the suspected LED addresses previously.

*

Offline Wolle

  • *
  • 22
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #7 on: 03 / February / 2014, 17:37:53 »
I didnt write asm code for a very long time so I dont really understand the code that you posted.
I tried the adresses that you posted with the following code without success:
Code: [Select]
  for c = 0x93d800 to 0x93d80F
    Poke8(c, 0x46)
    sprintf(msgstr,"LED address = %0X",c)
    LCDMsg_SetStr(a,msgstr)
BeepDrive(4)
    Wait(500)
  next


*

Offline srsa_4c

  • ******
  • 4451
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #8 on: 03 / February / 2014, 18:28:41 »
I didnt write asm code for a very long time so I dont really understand the code that you posted.
I'm posting code snippets for reference (so it won't be forgotten).
The LED addresses I suspect are 0xc022c0cc and 0xc022c0f0 (if not these, they should be on that previously posted list). I (again) suspect, that 0x93d800 is used to turn on an LED, and 0x83dc00 is used to turn it off. The AF LED may require another GPIO (or a PWM output) due to possible brightness adjustment, but the power LED is most probably a just simple LED.
There's Poke32 to write 32bit values.

Also note that the sx50hs port has the following code (platform/sx50hs/lib.c) to switch on/off an LED:

Code: [Select]
#define LED_PR 0xC022C200   

void debug_led(int state)
{
// using power LED, which defaults to on
// for debugging turn LED off if state is 1 and on for state = 0
// leaves LED on at end of debugging
    volatile long *p = (void*)LED_PR;
    *p = (*p & 0xFFFFFFCF) | ((state) ? 0x00 : 0x20);
}

*

Offline nafraf

  • *****
  • 1308
Re: IXUS 500 HS - ELPH 520 Porting Thread
« Reply #9 on: 04 / February / 2014, 06:33:07 »
Source code for ixus500 100e (under development - blind port).

- Loader implemented
- boot.c, capt_seq.c, movie_rec.c, filewrite.c implemented using code_gen.
- boot.c: power on switch address is missing.
- SD_READONLY was not detected  by finsig, It is missing.






 

Related Topics