Hi all,
This is very preliminary, but I have inelegant but reliable communication working between a (Windows XP) PC and an A620, using the USB power line to receive data from the PC and the blue led to transmit. I have hooked this up to the Lua interpreter in the camera and so far can execute lua functions which don't call lua_yield(). My longer term aim is to achieve inter-camera communication for the purpose of synchronizing settings between 2 cameras for stereo photography.
The serial I/O uses the kbd_process task at 10ms intervals, so the max rate is one transaction of 7 bits down and 7 bits up per 10ms. Each transaction actually sends and receives 14 bits since there are 7 bits of error detection and house-keeping info as well as the 7 bit payload. Each transaction takes about 2 ms total for the combined up and down transfer and uses a non-standard serial protocol suited to software polling and wait loops. When the camera is in camera mode, about 10% of the low level transactions fail due to an interrupt that appears to take as long as 1.5ms. However, a simple error handling protocol solves that issue, and communication seems reliable even when zooming and shooting. In Play mode even the low-level protocol is quite reliable.
A rudimentary command line program on the PC sends and receives characters by wiggling the COM port DTR line and reading the DSR line.
For hardware I use a photodiode from an old mouse driving a transistor, powered from the PC's COM port.
One problem which I don't understand is that the communication fails if the camera is in camera mode and the LCD display is off (or shut). It works fine in Play mode with the LCD shut. I suspect that the power to the blue led is reduced in some way when the LCD if off in camera mode.
If other people are interested in this, my code would need some tidying up. I am not totally clear about the proper organization of the CHDK source. Currently, most of my code is in chdk\platform\generic\kbd.c, because I used the platform specific (get_mmio() & USB_MASK) style code heavily. This could be moved into core if I added a fast function to get the USB state. The lua interpreter is in chdk\core\kbd.c. I build CHDK on Windows using Cygwin and binutils-2.18. By the way, I am a Windows programmer and don't know that much about gcc etc.
As usual, I have very little time to work on this. However, any advice or suggestions are welcome.
Regards,
Kit