the OP's original intent was to be able to do this while shooting stereo underwater.
Seems a legitimate application.
Comms speed required is another matter.
That was sort of the original intent, I had hoped to maybe do some underwater stereo-photography with the D20 rig. But I never got around to building a waterproof remote system, and now that summer's over, I probably won't be working on that until it starts to get warm again in November (that may sound confusing for those not in the southern hemisphere)
TBH the only reason I really bought a second D20 was because I got it cheap and I already had one anyway (as a camping camera that can get wet). Same with the SX40 (not the getting wet part though)
High-speed comms may be personally satisfying or a software challenge but what do you really need ?
If the aim is to ensure both cameras are in exactly the same mode, that is understandable but plenty of SDM and CHDK users manage without it (including me).
It does not take long to compare the settings and then leave them set.
Yeah I guess they don't really need to be that fast. Probably the largest ammount of data would be 64 bits for the SX40 (which has 32 bits of focus) and maybe 48 for the S110. Maybe 32, or maybe even less if I don't send focus.
With the S110's ring dial and also the thumb-dial on the back, it makes sense to keep it in manual mode all the time. And even with the D20 rig, I usually find myself changing the ISO settings and EV compensation alot. So having these values synchronised between the cameras will make shooting much more efficient. These settings are probably more important than the focus, which I might not send to the slave if I can't get the speed fast enough.
Anyway, I tried the following code:
void set_led_on()
{
*((volatile int *) AF_LED_ADDRESS) = LED_ON;
_SetHPTimerAfterTimeout(0,wait_until_this_time,set_led_off,set_led_off,0);
wait_until_this_time += 512;
}
void set_led_off()
{
*((volatile int *) AF_LED_ADDRESS) = LED_OFF;
if (wait_until_this_time < 1000000)
{
_SetHPTimerAfterTimeout(0,wait_until_this_time,set_led_on,set_led_on,0);
wait_until_this_time += 512;
}
else
{
wait_until_this_time = 256;
start_LED_flasher = 1;
}
}
void __attribute__((optimize("O0"))) LED_flasher()
{
while (*(int*)0xc0242014 > 16)// wait till it's at the start
{ }
_SetHPTimerAfterNow(wait_until_this_time,set_led_on,set_led_on,0);
wait_until_this_time += 256;
}
And that gives a very clean 1kHz output from the LED (shooting mode):
But the only problem is that if wait_until_this_time is incremented any less than 512 each time, the camera will only flash the LED briefly then crash. Regardless of whether it's in playback or shooting mode. Any idea of why it would be doing this?
Also, if I can't get the precision faster than 512 us is there any chance I could call my own interrupts (maybe with a native call or even an assembly command with a pointer to the function or something)? And there wouldn't be much chance of it harming the camera would there?