CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD - page 33 - Creative Uses of CHDK - CHDK Forum

CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD

  • 704 Replies
  • 171225 Views
*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #320 on: 19 / December / 2012, 10:49:23 »
Advertisements
FINAL MCU WIRING MODIFICATION & CODE with SLEEP

Sleep mode (STANDBY) drops the MCU chip temperature rise from a huge 7C in the previous implementation to just 0.2C.  By keeping clocks stopped and chip cool, we eliminate possible sources of noise during normal shooting and give a bit more headroom for lower Vcc operation (eg battery operation).  To make sleep mode work, the thin ORG wire (MOTION_POWER) had to be moved from pin 7 to pin 2 (Fig 1).  That's because pin 7 is tied to INT4, and it turned out that INT4 on the ATmega32u4 is the only interrupt that does not have wake up detection.  That threw me for a loop trying to figure why the (simple) code wouldn't work!

// USAGE:  After uploading the program, it will disable the USB and you lose your COM in the IDE.
//         To reload your modified code from the IDE, press UPLOAD, then wait for the progress bar
//         to go beyond the half-way point, then press the MCU reset pin RST twice in rapid succession.
//         To disable sleep to have continuous COM port access for debugging and determining time
//         constants, comment out the sleep_mode() call at end. Once you've got your code working,
//         uncomment the call.  Always wait 10 seconds after PUP for the LEDs to blink once before you
//         go ->REC in CHDKPTP, otherwise you will get a LENS ERROR.  If so, RST, wait 10 seconds, and
//         try again.

Code: [Select]
const int IRIS_pin       =  8; // [iris PI-1] right breakout top (YEL wire)
const int FOCUS_pin      =  9; // [FOCUS PI-2] left breakout (BLU wire)
const int ZOOM_pin       =  5; // [ZOOM PI-4] left breakout (WHT wire)
const int MOTION_POWER_pin   =  2;  // [iris PI-3] right breakout top (ORG wire) -- MOTION_POWER input pin  -- this pin is internally tied to INTERRUPT #1

const int ENCFR_pin       = 14;    // [ZOOM ENCODER PIs FRONT-R] right breakout botttom (YEL wire) -- Encoder front PI
const int ENCBK_pin       = 16;    // [ZOOM ENCODER PIs  BACK-R] right breakout botttom (BLU wire) -- Enooder back PI
const int ENC_POWER_pin  =  3;  // [ZOOM ENCODER PIs COMM] right breakout botttom (ORG wire) -- ENC_POWER input pin  -- this pin is internally tied to INTERRUPT #0
The solution is fully specified with MECHA pinouts here: http://chdk.setepontos.com/index.php?action=dlattach;topic=8801.0;attach=7357.  Orientation of the breakouts in Fig 1 is the same as the photo.  Input pins 3 and 4 are tied to GND with a 3.9K resistor.  All the output pins are level-shifted as: OUT -> 1K -> 2K -> GND, with the 1K-2K node going to the camera mainboard.  This implementation runs on a Chinese 4.6VDC AC adapter for this camera (-ve camera GND), but should work down to 3.7V using the Canon battery (not tested).  I put a 1000uF 6V cap about 5 inches from the camera and tapped the MCU PS there.  The MCU module has to be well-grounded (gray wire) to the camera case. 

TIPS:  The USB connector is precariously mounted held only by copper pads and can easily come off.  Before use, I glued the connector using JB Weld epoxy available at auto parts shops.  JB Weld is non-conductive, tolerant of mixing ratio, and makes a very strong bond after cure for 1/2 hour at +45C.  Best is to get a good bond from the connector bottom to the board edge.  For added safety when using the USB cable, hold the board by pinching it firmly over the connector.
« Last Edit: 21 / December / 2012, 14:40:42 by SticK »

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #321 on: 20 / December / 2012, 13:32:03 »
1.  It would be useful to get at the numerical JPG quality parameter.  For example:
        set_quality(0.9)
reyalp told me that it exists for video but not for stills.  Reason:  the S90 has 2 settings in the Canon menu: "medium" and "fine."  With CHDK override I can set to "superfine."  However, even "superfine" quality is poor on this camera (3MB for a 10Mpx).  A good superfine 10Mpx should be around 5-6MB, as on my SX110.  I think Canon degraded the S90 to give users the illusion of faster shooting by making files smaller.
The SX110 and the S90 use the same 3 predefined quantizer tables for JPEG compression (there is a routine which selects one of them depending on the requested "quality" setting (normal, fine, superfine). There are probably other ways to influence compression "strength", but since I know very little about these techniques, I can't tell how that's done.
Quote
2.  Could it be possible for you to make the camera go into M manual mode on ->REC?  Reason: with the mode switch disconnected, camera goes to AUTO on ->REC and I have to change the value with the pulldown each time.
...
edit:
I think #2 could be possible just to add a bit of Lua code into the REC button in CHDKPTP if you feel hard-coding it into FW may put normal functionality at risk.  Adding Lua code to REC might be another, or safer, alternative.  What do you think?
I'd choose the Lua way first. That would enable you to easily select another mode if you need that for some reason.
Quote
Also, for DISKBOOT.BIN, please compile for both cameras.  Example .......
>> DISKBOOT_s90_101a_no_startup_lens_check_disableisdriveerror_nodistcorr
>> DISKBOOT_s90_100c_no_startup_lens_check_disableisdriveerror_nodistcorr
OK, I'll port the changes to the other fw revisions. Don't forget that using a no_startup_lens_check version could be potentially dangerous on cameras with unmodified lens mechanics, as noted earlier.
Quote
Does Canon call barrel "dist"?
Yes, "dist", "distortion", and the module is called "dister". The word "barrel" does not appear in the firmware. I'd guess that the related part of the DIGIC is more universal, and it can do more image distortion effects (there's a fisheye image effect in new compacts for example).
Quote
  If not, can you name the files using "nobarrelcorr" please, since it is more accurate?
OK, but I believe this is quite a minor annoyance?
« Last Edit: 20 / December / 2012, 13:34:27 by srsa_4c »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #322 on: 20 / December / 2012, 15:35:52 »
Quote
There are probably other ways to influence compression "strength", but since I know very little about these techniques, I can't tell how that's done.
OK, thanks for checking into it -- back burner then.

Quote
I'd choose the Lua way first. That would enable you to easily select another mode if you need that for some reason.
I had a bit more thought about this idea.  I think it would more coherent to put all the changes in place if possible, and not distribute some functionality say over CHDKPTP code and other over FW.  PTP design is strictly for M mode.  What I think is this: if you manage to set M mode when on ->REC in S90-special DISKBOOT.BIN, and if someone wants to actually use another mode, it's mater of either using the mode pulldown in the CHDKPTP GUI , or write a Lua snippet to attach to his REC button.  I'd go for the FW version of M, if you deem it relatively easy and relatively safe.  I would say same would be good for poke(0x5338,0).  So I think you can manage both of these, that would be very close to end ... in fact, nothing more is needed that I can see right now.

Quote
Don't forget that using a no_startup_lens_check version could be potentially dangerous on cameras with unmodified lens mechanics, as noted earlier.
Yes, that's OK because this special FW is only meant to be loaded on a completely butchered camera anyway ;).

Quote
Yes, "dist", "distortion", and the module is called "dister"
No problem, please leave your naming convention to be in agreement with Canon semantics.

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #323 on: 21 / December / 2012, 14:43:22 »
I created a proper patch for all 3 revisions.
The binaries:
https://subversion.assembla.com/svn/chdk-s1.bin/files/s90-100c-1.1.0_disableisdriveerror_nodistcorr_no_startup_lens_check_manualmode.zip
https://subversion.assembla.com/svn/chdk-s1.bin/files/s90-101a-1.1.0_disableisdriveerror_nodistcorr_no_startup_lens_check_manualmode.zip

I have put the additional code into the existing code that executes "2 seconds after rec mode". Hopefully it works as intended. CHDKPTP's mode dropdown will probably not notice the change.


*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #324 on: 21 / December / 2012, 14:52:13 »
@srsa_4c
Thanks // sounds good ... before I go ahead, do these have liveview distcorr disabled too, ie poke(0x5338,0)?  I didn't notice anything specific in the filename and it would be useful.

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #325 on: 21 / December / 2012, 15:09:23 »
Thanks // sounds good ... before I go ahead, do these have liveview distcorr disabled too, ie poke(0x5338,0)?
Yes, it's now included in "nodistcorr".

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #326 on: 21 / December / 2012, 15:23:23 »
@srsa_4c
Great // I will give your solutions a first shot this evening and report back, followed by a thorough work-over during the weekend.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #327 on: 22 / December / 2012, 00:43:36 »
@srsa_4c
New diskboot.bin for S90_101a:  new nodistcorr and poke(0x5338,0).

There's a problem.  It shows up as:
  >> PUP->PLAY  after a minute in PLAY "E32" appears on the LCD but camera continues running.
  >> If I go ->REC, M mode and viewfinder discorr is OK.   But if I shoot, the camera "freezes" in that there is no AF light and no action.
  >> If I don't shoot and try to go ->PLAY, there is no effect // the camera still keeps going in REC mode (liveview).

There is no assert.  It is as though IS error override got affected, but I don't think that is the case??

Code: [Select]
Canon PowerShot S90
P-ID:31E1  NT D
Firmware Ver GM1.01A
Oct 28 2009   15:47:24

Adj Ver.005.001             
Mecha Firm Ver.  2.02

2012.12.22 00:24:15  E32 ISDriveError
2012.12.22 00:15:05  E32 ISDriveError
2012.12.19 02:02:55  E18 ZoomLensError
2012.12.19 02:02:37  E18 ZoomLensError
2012.12.19 00:52:32  E18 ZoomLensError
2012.12.19 00:37:47  E18 ZoomLensError
2012.12.19 00:35:37  E18 ZoomLensError
2012.12.19 00:22:33  E18 ZoomLensError
2012.12.19 00:20:35  E18 ZoomLensError
2012.12.19 00:10:17  E18 ZoomLensError

edit:
I've never changed the modules/ subdirectory and never had any problem.  Should I change it to the one in your ZIP?
« Last Edit: 22 / December / 2012, 00:55:44 by SticK »


*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #328 on: 22 / December / 2012, 07:07:05 »
New diskboot.bin for S90_101a:  new nodistcorr and poke(0x5338,0).
There's a problem.  It shows up as:
  >> PUP->PLAY  after a minute in PLAY "E32" appears on the LCD but camera continues running.
Can you confirm that this doesn't happen with the previous working binary?
Quote
  >> If I go ->REC, M mode and viewfinder discorr is OK.   But if I shoot, the camera "freezes" in that there is no AF light and no action.
  >> If I don't shoot and try to go ->PLAY, there is no effect // the camera still keeps going in REC mode (liveview).
Perhaps there must be some delay after issuing DisableISDriveError. The current code tries to switch mode to M right after disabling the IS error. All these overrides are activated 2 seconds after a play -> rec transition.
Quote
I've never changed the modules/ subdirectory and never had any problem.  Should I change it to the one in your ZIP?
All recent binaries are a modified CHDK 1.1 releases, no need to replace the modules.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #329 on: 22 / December / 2012, 07:18:38 »
Quote
Can you confirm that this doesn't happen with the previous working binary?
Yes, I did go back to DISKBOOT_s90_101a_disableisdriveerror_nodistcorr_no_startup_lens_check (that's filenodistcorr) and everything is back to normal.  In fact I did it all twice to make sure I was not mixing up versions and the results were consistent.

Quote
Perhaps there must be some delay after issuing DisableISDriveError. The current code tries to switch mode to M right after disabling the IS error. All these overrides are activated 2 seconds after a play -> rec transition.
That's what I am thinking, especially that PLAY is strangely affected w/o even going to ->REC.  It must be related to manualmode.  Could we try a version with liveviewnodistcorr and filenodistcorr only (ie w/o manualmode), to isolate the problem and also to provide a fallback version?

 

Related Topics