Synchronising two S110's via the AF lamp - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

Synchronising two S110's via the AF lamp

  • 54 Replies
  • 16522 Views
Re: Synchronising two S110's via the AF lamp
« Reply #10 on: 31 / March / 2014, 01:49:53 »
Advertisements
Well it seems to work with the following line commented out
*(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period

And syncs quite nicely, with an average error of about 0.1ms, no greater than 0.3ms. As it is with the other cameras, so I'd say this problem is solved.

Should I expect any weird behavior if that address isn't set back to normal after each shot? It appears to work fine though. Was that line really even necessary, or just as a precaution? Also, I think the previous problem with the CHDK folder on the SD card being corrupted was due to the SD card itself, as it would sometimes become corrupted even with normal shooting.


I did have another idea, of perhaps using the WiFi LED to communicate, as a photodiode next to the lens ring may get in the way. Couldn't find an address for it in that stubs_entry.s file, any idea of how I could go about finding the address for it?

Re: Synchronising two S110's via the AF lamp
« Reply #11 on: 31 / March / 2014, 08:19:27 »
Well it seems to work with the following line commented out
*(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period
Did you leave this line in ?
 *(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register
It's writing to the same address.

Quote
And syncs quite nicely, with an average error of about 0.1ms, no greater than 0.3ms. As it is with the other cameras, so I'd say this problem is solved.
How did you measure this?  And what does it look like without the precision sync patch when measured the same way?

Quote
Should I expect any weird behavior if that address isn't set back to normal after each shot? 
It appears to work fine though. Was that line really even necessary, or just as a precaution?
Yes - from what I understand about how this works,  you will have changed the video sync timing.  But you are probably not pointed at the right register.  It is definitely needed.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Synchronising two S110's via the AF lamp
« Reply #12 on: 31 / March / 2014, 10:14:31 »
Did you leave this line in ?
 *(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register
It's writing to the same address.
Yep, everything is still there except the line that's commented out.

Code: [Select]
void _wait_until_remote_button_is_released(void)
{
int tick;

if ( ( conf.remote_enable ) // menu : USB remote enabled - bracket everything in this function
&& ( conf.synch_enable  ) // menu : Sync enabled - tells us to wait for USB to disconnect
&& ( usb_sync_wait      ) ) // only sync when USB remote is active - don't trap normal shooting
{
usb_remote_status_led(1); // indicate to user we are waiting for remote button to release - this happens every time the camera takes a picture
tick = get_tick_count(); // timestamp so we don't hang here forever if something goes wrong

int std_period = _EngDrvRead(GPIO_VSYNC_MAX);
        int sync_time = std_period * 3;         // schedule the end of extended period at t = t(synch pulse) + sync_time

do { }  while( get_usb_bit() &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));

        int cur_cnt = *(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff; // get the counter state at the time of sync
        int sync_period = sync_time - (std_period - cur_cnt);
        if (std_period - cur_cnt < 10)
        {
            // too close to overflow, wait for the next period
            sync_period -= std_period;
            while ((*(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff) >= cur_cnt) {};
        }
        *(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register
        *(volatile int*)(GPIO_VSYNC_UPDATE) = 1;
        while (*(volatile int*)(GPIO_VSYNC_UPDATE)) {}; // wait until the new value is applied
        //now we are at the beginning of extended period
//        *(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period
        *(volatile int*)(GPIO_VSYNC_UPDATE) = 1;
        msleep(40);

        sync_counter++ ;
        usb_sync_wait = 0 ;
        usb_remote_status_led(0);       // alert the user that we are all done


}

}

Quote
How did you measure this?  And what does it look like without the precision sync patch when measured the same way?
Same as last time, with the analog oscilloscope. Without the precision sync patch, around half were within a millisecond or two or three, and the rest may have been 10 to 20 ms out of sync. Probably more sometimes, I didn't do that many trials. But with the (modified) precision patch, sync was quite good, about as good as it is on my other cameras. I did quite a few trials with it enabled.

Quote
Yes - from what I understand about how this works,  you will have changed the video sync timing.  But you are probably not pointed at the right register.  It is definitely needed.
As far as I'm concerned, if it works, it works. But it would be interesting to know why it doesn't seem to cause any problems. Tomorrow I'll probably give it a more rigorous test in different lighting conditions just to make sure though.
Also, as the value at this address (on both the S110 and SX40) goes back to zero after the shot, shoudn't everything return to normal anyway?

BTW, I just remembered that there is already another thread about using the precision sync on the S110. mr.burns, if you're reading this, did you end up trying the precision sync code with the S110 yet?

Re: Synchronising two S110's via the AF lamp
« Reply #13 on: 31 / March / 2014, 10:56:43 »
Quote from: Recyclojunk64 link=topic=11376.msg111780#msg111780
did you end up trying the precision sync code with the S110 yet?

A friend of mine has just tested it.

38% of shots are 1/40,000 second or less.
100% of shots are 1/1400 second or less.
Median value is 1/23,000 second.

These are typical results for recent cameras.


Re: Synchronising two S110's via the AF lamp
« Reply #14 on: 31 / March / 2014, 11:06:44 »
Quote
A friend of mine has just tested it.

38% of shots are 1/40,000 second or less.
100% of shots are 1/1400 second or less.
Median value is 1/23,000 second.

These are typical results for recent cameras.
So is the problem just isolated to me and my two S110's then? Or did they also have the same problem and have to have that line removed? I have firmware version 101b FWIW.

Re: Synchronising two S110's via the AF lamp
« Reply #15 on: 31 / March / 2014, 12:35:03 »

So is the problem just isolated to me and my two S110's then?

No.

He was testing an SDM build that he had just asked me to port for someone and got the same error message that you did.
Minutes later I saw your earlier post.


David

Re: Synchronising two S110's via the AF lamp
« Reply #16 on: 31 / March / 2014, 13:53:07 »
Also, as the value at this address (on both the S110 and SX40) goes back to zero after the shot,
Well that may explain why you needed to comment out the line where you did.  If GPIO_VSYNC_MAX is "write only" then when the code tries to read it and gets zero, the variable std_period is set to 0.  The line you commented out tries to restore GPIO_VSYNC_MAX with the value it saved in std_period,  but as that value is incorrectly zero it wipes out the GPIO_VSYNC_MAX register. 

It would be interesting to know the value from this line ;
Code: [Select]
int std_period = _EngDrvRead(GPIO_VSYNC_MAX);
Also,  I think that what is getting mixed up by deleting the line that you did may only affect the HDMI output from the camera?   And in some cases,  you may not be adjusting the sync period enough to matter.  Just a guess here on my part.

 
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Synchronising two S110's via the AF lamp
« Reply #17 on: 01 / April / 2014, 04:02:59 »
Hi,

Quote
BTW, I just remembered that there is already another thread about using the precision sync on the S110. mr.burns, if you're reading this, did you end up trying the precision sync code with the S110 yet?

Yes I read this now  ;).

Since several week I want to do the synchronization test with my pair of S110, but unfortunately I did not have enough time to do up to now. Hopefully I can do it on coming weekend.
I want to do a detailed test as normally done for SDM by using a CRT monitor.

What build should I use to do the synch testing?

Should I test with and without precision sync?
Since I am not that familiar with the CHDK code how do I enable / disable precision sync for my S110?



2 x IXUS 860IS 100c
2 x Powershot S110 103a


Re: Synchronising two S110's via the AF lamp
« Reply #18 on: 01 / April / 2014, 05:19:10 »
how do I enable / disable precision sync for my S110?

In platform_camera.h add '#define CAM_REMOTE_USES_PRECISION_SYNC   1'

Re: Synchronising two S110's via the AF lamp
« Reply #19 on: 01 / April / 2014, 05:34:25 »
Hi Microfunguy,

thanks for reply, which release should I take?

From stable one or development trunk?
(A link would be great)

2 x IXUS 860IS 100c
2 x Powershot S110 103a

 

Related Topics