HDMI power and alternative remote inputs ( was Re: G7 X porting thread) - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

HDMI power and alternative remote inputs ( was Re: G7 X porting thread)

  • 79 Replies
  • 37016 Views
Re: Re: G7 X porting thread
« Reply #10 on: 07 / June / 2018, 14:57:19 »
Advertisements
I think i am now a single step further.
I have redirected the UART to a file and used the function HdmiRegDump.
I dumped the HDMI register with Pin1=+5V and Pin1=open:

Pin1 open:
Code: [Select]
     00  01  02  03  04  05  06  07  08  09  0A  0B  0C  0D  0E  0F
    ---------------------------------------------------------------
00 | 00  00  00  00  00  00  00  00  00  00  41  0E  BC  18  01  13 
10 | 25  37  00  00  00  00  00  00  46  62  04  A8  00  00  1C  84 
20 | 1C  BF  04  A8  1E  70  02  1E  00  00  04  A8  08  12  1B  AC 
30 | 00  00  00  00  00  00  00  00  00  00  00  80  00  00  00  00 
40 | 00  50  90  7E  79  70  00  00  00  00  80  00  00  00  00  00 
50 | 00  00  02  0D  00  00  00  00  00  00  00  00  00  00  00  00 
60 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
70 | 01  0A  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
80 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
90 | 00  00  00  00  04  80  80  00  03  02  00  18  38  61  00  00 
A0 | 00  3C  A0  A0  08  04  00  00  00  00  00  40  00  00  40  14 
B0 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
C0 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  4A 
D0 | 00  FF  80  80  80  00  01  00  00  00  00  00  00  00  82  01 
E0 | 80  78  00  00  6C  80  BC  00  08  00  52  46  00  00  00  00 
F0 | 95  04  FF  00  00  75  28  00  80  10  7D  AA  1C  00  B0  00 

Pin1=+5V:
Code: [Select]
     00  01  02  03  04  05  06  07  08  09  0A  0B  0C  0D  0E  0F
    ---------------------------------------------------------------
00 | 00  00  00  00  00  00  00  00  00  00  81  2E  B8  18  01  13 
10 | 25  37  00  00  00  00  00  00  46  62  04  A8  00  00  1C  84 
20 | 1C  BF  04  A8  1E  70  02  1E  00  00  04  A8  08  12  1B  AC 
30 | 00  00  00  00  00  00  00  00  00  00  00  80  00  00  00  00 
40 | 00  10  D0  7E  79  70  00  00  00  00  80  40  00  00  00  00 
50 | 00  00  02  0D  00  00  00  00  00  00  00  00  00  00  00  00 
60 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
70 | 01  0A  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
80 | 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00 
90 | 00  00  00  00  5C  80  00  00  03  02  00  18  38  61  00  00 
A0 | 00  3C  A0  A0  08  04  00  00  00  00  00  40  00  00  40  14 
B0 | 00  00  00  00  00  00  00  00  00  00  60  00  00  00  00  00 
C0 | 00  00  00  00  00  00  00  00  42  03  00  00  00  00  00  4A 
D0 | 00  FF  80  80  80  00  01  00  00  00  00  00  00  00  82  01 
E0 | 80  78  00  00  6C  80  BC  00  08  00  52  46  00  00  00  00 
F0 | 95  04  FF  00  00  75  28  00  80  10  7D  AA  1C  00  B0  00 

There is a difference in last two words in first line, but until now i was not able to find the address to read this values from.
G7X - CHDK 100d

*

Offline reyalp

  • ******
  • 14118
Re: Re: G7 X porting thread
« Reply #11 on: 07 / June / 2018, 16:13:42 »
There is a difference in last two words in first line, but until now i was not able to find the address to read this values from.
Looks like 0x000def04 is the base address when the values are read, so dumping memory from there might be informative.

I also noticed there's an eventproc HdmiChange5VShortState
Don't forget what the H stands for.

Re: Re: G7 X porting thread
« Reply #12 on: 07 / June / 2018, 17:06:01 »
I tried to read this memory range with:
peek(0x000def04,4)..peek(0x000def0c,4) but it always returns 0

G7X - CHDK 100d

*

Offline srsa_4c

  • ******
  • 4451
Re: Re: G7 X porting thread
« Reply #13 on: 07 / June / 2018, 17:32:26 »
FWIW, HdmiRegDump has a parameter which could be a register number (whatever that is, its interpretation might depend on the HDMI interface chip), and I see signs of i2c communication inside.


*

Offline reyalp

  • ******
  • 14118
Re: Re: G7 X porting thread
« Reply #14 on: 07 / June / 2018, 17:46:16 »
I tried to read this memory range with:
peek(0x000def04,4)..peek(0x000def0c,4) but it always returns 0
Judging by the position in the output posted earlier, it would be a lot further. I would dump e.g. 1k starting at 0x000def04 and look at in in a hex editor

You can use the ram dump tool in the debug menu, or chdkptp rmem if you are able to have hdmi and usb connected at the same time.
Don't forget what the H stands for.

Re: Re: G7 X porting thread
« Reply #15 on: 08 / June / 2018, 02:24:35 »
I a able to connect both hdmi and usb.
Using rmem i got a dump with two fingings:
-i cannot locate the values from HdmiRegDump in it,
-but there is one memory location which is changing (0/1) depending on HDMI Pin 1 5V/open

so, 0xdf058 contains 1 if Pin 1 is open and 0 if Pin 1 is at 5V.

Code: [Select]
0x000def04 1024
   def04: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def14: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def24: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def34: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def44: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def54: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def64: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def74: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def84: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   def94: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   defa4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   defb4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   defc4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   defd4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   defe4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   deff4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df004: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df014: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df024: 00 00 00 00 14 00 00 00 09 0c 00 c0 00 00 00 00 | ................
   df034: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df044: 02 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 | ................
   df054: ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df064: 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 | ................
   df074: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df084: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df094: 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 | ................
   df0a4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df0b4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df0c4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df0d4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df0e4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df0f4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df104: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df114: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df124: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df134: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df144: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df154: 00 00 00 00 93 1e 1c fc 00 00 00 00 00 00 00 00 | ................
   df164: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df174: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df184: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df194: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df1a4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df1b4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df1c4: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 | ................
   df1d4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df1e4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df1f4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df204: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df214: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 | ................
   df224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df234: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df244: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df254: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df264: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df274: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df284: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df294: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2a4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2b4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2c4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2d4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2e4: 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
   df2f4: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................
G7X - CHDK 100d

Re: Re: G7 X porting thread
« Reply #16 on: 08 / June / 2018, 08:24:54 »
this HDMI Hotplug detect is also mapped to physw_status[2] bit 0x20 (cleared when +5V on Pin1)
G7X - CHDK 100d

Re: Re: G7 X porting thread
« Reply #17 on: 09 / June / 2018, 06:16:45 »
hi,

finaly i got everything running.
I have implemented everything into the chdk source tree based on HEAD revision r5041.
I created a new possibility that platforms can support "multichannel remote"
there was already a implementation using Battery ADC as second remote channel for two cameras (ixus120_sd940 and sx200is) but this was implemented also in generic code. i have now also ported this two cameras to support multichannel remote.
the multichannel remote approach has the advantage that
 - if using a remote channel != USB, USB can be used in parallel
 - no platform dependend code in generic files.
 - easy to extend for additional platforms


platforms that wants to support multichannel remote must #define CAM_REMOTE_MULTICHANNEL and implement the functions:

Code: [Select]
int get_pf_remote_channelnames(char *channelnames[])
fill the channelnames string array with the names for remote channels the platform supports and return the number of supported remote channels. this will be used for osd

Code: [Select]
int get_remote_bit(int channel):
return the remote bit status of selected channel. channel corresponds to the index that is used to fill the channelnames array

Code: [Select]
void set_pf_remote_override(int remote_enable, int channel)
on some platforms it is maybe not wanted that the canon firmware receives the status of the remote bit. in that case the platform can implement an override

Code: [Select]
void pf_notify_modeswitch(int prepost, int mode, int remote_enable, int remote_channel)
call platform dependend code before and after rec/play modeswitch. the platform can then decide (depending on the input parameters) if there is something to do here. (i.e enable the hdmi power)


please find attached a patch based on SVN Head revision r5041.
Could you please take a look at it?
i want also ask if you can maybe consider to integrate it in your SVN codebase?


only one thing is missing:
currently turning on the hdmi power has to be done manually in a script.
it would be nice if that could be done automatically in shooting_set_playrec_mode().
for that i have prepared pf_notify_modeswitch() (described above)
but there is currently no eventproc defined. i have just the address (call_func_ptr(0xfc0c3389)). so this implementation is currently empty on all three platforms supporting multichannel remote (g7x, ixus120_sd940 and sx200is)
G7X - CHDK 100d


*

Offline srsa_4c

  • ******
  • 4451
Re: Re: G7 X porting thread
« Reply #18 on: 09 / June / 2018, 16:49:11 »
This will likely be copied to a separate thread.
please find attached a patch based on SVN Head revision r5041.
Some (not exhaustive) notes.
- The HDMI power related function will likely need to be called after every play -> rec transition on a camera that disables HDMI power in rec mode.
- It might be beneficial to mask the HDMI hotplug bit (if it is even possible), so that the camera won't do unnecessary work when that bit is toggled.
- The shooting_set_playrec_mode() modification is probably not needed. It's already possible to use USB remote and USB connection simultaneously (usb_force_active from a script).
- If a conf entry becomes camera dependent, it needs to be handled in core/conf.c clear_values().

Re: Re: G7 X porting thread
« Reply #19 on: 10 / June / 2018, 11:39:59 »
Hi srsa_4c,
Thank you for your notes.
- The HDMI power related function will likely need to be called after every play -> rec transition on a camera that disables HDMI power in rec mode.
yes, you are right. the code for that is already prepared in the patch. from shooting_set_playrec_mode() the camera specific function pf_notify_modeswitch() is called. Here the HDMI power can be enabled. (depending on mode, and if HDMI is used as remote input)

- It might be beneficial to mask the HDMI hotplug bit (if it is even possible), so that the camera won't do unnecessary work when that bit is toggled.
yes, you are right. also this is already prepared in the camera specific function set_pf_remote_override(). it is called from kbd_common.c

- If a conf entry becomes camera dependent, it needs to be handled in core/conf.c clear_values().
there are no additional camera dependend conf entries.

The reason for adding this camera specific functions (for cameras that support multichannel remote) was that i not want to introduce new camera specific code in the generic code parts. And it is easily to extend without touching common code.
G7X - CHDK 100d

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal