CHDK - what is possible? - page 2 - General Discussion and Assistance - CHDK Forum
supplierdeeply

CHDK - what is possible?

  • 22 Replies
  • 2869 Views
Re: CHDK - what is possible?
« Reply #10 on: 23 / February / 2014, 14:02:17 »
Advertisements
Hi,

OK I have to make a decision regarding connecting microcontroller to CHDK using USB remote or PTP or both.
Not an easy task. The combination of PTP and USB seems to be a very interesting solution, but of course the one with the most effort.
I think I should spend some time to deal with PTP on microcontroller's side to get a better overview about what is to do. To make an Atmega dealing with USB seems to be a solvable task. So lets assume the Atmega has an USB port. And then? What is to do to communicate with the camera using PTP?

Do I have to send certain commands (something like strings) to the camera over USB and wait for an answer?

Sorry for those kinds of questions but PTP is brand new to me and I don't know where to start.

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

*

Offline reyalp

  • ******
  • 11924
Re: Difference PTP and remote USB?
« Reply #11 on: 23 / February / 2014, 16:00:35 »
Hi,

OK to not confuse anybody, I will stop this topic here and continue discussion in my original thread:

http://chdk.setepontos.com/index.php?topic=11257.0
At risk of confusing things further, I've merged the two threads.

Note if you want both PTP control and USB remote style sync, you may be interested in this:
http://chdk.setepontos.com/index.php?topic=10385.0 which uses the battery temp line for sync instead of USB power.
Don't forget what the H stands for.

Re: CHDK - what is possible?
« Reply #12 on: 23 / February / 2014, 16:02:44 »
What is to do to communicate with the camera using PTP?

Do I have to send certain commands (something like strings) to the camera over USB and wait for an answer?
If you are going to tackle something of this complexity for the first time, you might want to read through this thread and look at the source code linked from the first post : alternative ptp client and possibly this thread : CHDK PTP interface

Note if you want both PTP control and USB remote style sync, you may be interested in this:
http://chdk.setepontos.com/index.php?topic=10385.0 which uses the battery temp line for sync instead of USB power.
That's one of threads that references the original post I linked above  ;)
« Last Edit: 23 / February / 2014, 16:05:28 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK - what is possible?
« Reply #13 on: 24 / February / 2014, 02:47:38 »
Hi,

I think I will go with the USB remote solution first. PTP for this first project is too much overhead on the microcontroller side. If I am more experienced with 1st project I may can add PTP fucntions as well.
So I will study now how to pulse the USB signal and how to detekt those pulse patterns on CHDK side.
Does someone have expericence with this?
What is the better approach to code a byte and send it over USB to CHDK.
Should I use same pulse width and set USB to 5V for logic 1 and 0V for logic 0?
Or is there any benefit working with the pulse width e.g. 60ms for logic 1 and 30 ms for logic 0?

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


Re: CHDK - what is possible?
« Reply #14 on: 24 / February / 2014, 07:46:07 »
I think I will go with the USB remote solution first. PTP for this first project is too much overhead on the microcontroller side. If I am more experienced with 1st project I may can add PTP fucntions as well.
Answers to your questions depend on whether you have made a decision about implementing this with CHDK scripting ( uBASIC or Lua ) rather than trying to write native CHDK code in C?     

I would bet money that you can learn enough about Lua and do the script coding a whole lot easier than trying to put together a CHDK build environment and then learning enough about the CHDK structure to hack its code.    The code/built/load/test cycle time for code revisions vs script changes alone will be huge.

And this project as you describe it is perfectly able to be implemented with a Lua script on the camera side.  Yoou can always go back and code in C later.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK - what is possible?
« Reply #15 on: 24 / February / 2014, 10:04:11 »
Hi waterwingz,

yes I could do it with lua - you are right - but I am very interested in the things behind.
But of course I can use lua to do some first tests and later on switch to C for final implementation.
A while ago I already did some changes on C code on the stereoscopic CHDK version SDM.
So I am familiar with the structure already.

Btw. is there any differnence in execution time if I use lua or C?

And I still need some help on:

Quote
What is the better approach to code a byte and send it over USB to CHDK.
Should I use same pulse width and set USB to 5V for logic 1 and 0V for logic 0?
Or is there any benefit working with the pulse width e.g. 60ms for logic 1 and 30 ms for logic 0?

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

Re: CHDK - what is possible?
« Reply #16 on: 24 / February / 2014, 10:20:39 »
Btw. is there any differnence in execution time if I use lua or C?
Yes - in theory the C code will run faster as it's not interpretted.  But for this application, thing like the amount of time a task gets to run and how frequently it runs will dominate any difference in actual code execution speed.   So it really does not matter much IMHO.

Quote
What is the better approach to code a byte and send it over USB to CHDK.
Should I use same pulse width and set USB to 5V for logic 1 and 0V for logic 0?
Or is there any benefit working with the pulse width e.g. 60ms for logic 1 and 30 ms for logic 0?
Either can be made to work.  On newer cameras where task execution timing is not always consistent & repeatable,  I'd suggest the 60 mSec=1,  30 msec=0 approach will be easier to make robust.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK - what is possible?
« Reply #17 on: 25 / February / 2014, 02:21:28 »
Thanks waterwingz,

I will give it a try.
But first I will finsish installing my development environment and CHDK and then I will test the sync.
I expect my cathode ray monitor in around 10 days.

So I will come back if I made some tests.

See you...
2 x IXUS 860IS 100c
2 x Powershot S110 103a


Re: CHDK - what is possible?
« Reply #18 on: 26 / February / 2014, 04:19:05 »
Hi,

I used to work with the Eclipse CDT development environment.
Can I use Eclipse CDT to develop and compile the CHDK sources?

Or is it recommended to use the CHDK-shell for compiling?

Or should I use Eclipse CDT for editing and CHDK-shell for compiling?

Thanks for any guidance...
2 x IXUS 860IS 100c
2 x Powershot S110 103a

Re: CHDK - what is possible?
« Reply #19 on: 26 / February / 2014, 10:16:45 »
Can I use Eclipse CDT to develop and compile the CHDK sources?
Probably - but you will have to setup and configure it for yourself.

Quote
Or is it recommended to use the CHDK-shell for compiling?
Yes

Quote
Or should I use Eclipse CDT for editing and CHDK-shell for compiling?
You can do that too.   CHDK-Shell installs a build environment / tool chain that you can use from the command line.  That should be all you need for configuring Eclipse.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics