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

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

  • 704 Replies
  • 195144 Views
*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #260 on: 04 / December / 2012, 20:00:37 »
Advertisements
Quote
So, instead of zooming there might be an easier way to disable lens distortion correction. I have not investigated this yet.
Oh my! // that would be really great.  That means for a hardware dummy all I'd have to handle is ZOOM MOTOR (encoder) activity only for unstow ... very simplified if indeed possible.

Quote
I would expect E18, as it appears in your firminfo.
Perhaps you are correct // it did flash by so it could have said E18.

Quote
I'm trying to "attack" these monsters with various methods, but there still isn't any useful progress.
Your effort here is intense I note and to spare you, I feel that a better HW solution is needed.  What we know from your current error override incarnation and yesterday's 555 dummy is that with IRIS (and IS) we were able to prove viability of the combined solution.  That in itself is an *excellent* result.  For FOCUS, I am looking at the tiny ATmega328 (Sparkfun Mini Arduino Pro).  It has 3 timers and interrupt pin configurability:
http://www.sparkfun.com/tutorials/244
With that I should be able to give FOCUS both unstow and stow simulation (the infamous jiggle), and resolve the fail condition on ->PLAY|PDN.   If that works, then IRIS and ZOOM unstow/stow can be handled with the same chip.  So what I am thinking is that for now I can direct my attention to the dummy solution overall, and perhaps you might consider the support functions, such as FAKE FULL ZOOM (there's another we'll need that is very useful but not essential).  If you are interested, I can give you a full description of what I know about barrel correction.  That way I feel, by diverging our efforts, we can be more effective in not attempting to duplicate goals.

Quote
What happens when you shut down the camera from REC mode? Can the camera start normally after it?
This is a *very* good question and it did actually occur to me earlier today, so we are definitely synergistic in this endeavor and on the same page.  Since I've been getting the new microcontroller hardware today, I will get about to both tests a bit later, or early tomorrow.
« Last Edit: 05 / December / 2012, 00:39:46 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #261 on: 06 / December / 2012, 15:56:00 »
UPDATE

Here's what we have at present.  IRIS only needs the 555 unstow dummy to work on its own.  It turns out that by adding the FOCUS 555 unstow dummy, all works on initial PUP.  However we now know that on REC->PLAY a new error is generated (causes shutdown) and it is not overridden on the next PUP by same code that works for IRIS.  The result is the camera exercises a very different revival timing which locks out both the IRIS 555 and the FOCUS 555 solutions, because now the dummies don't match the new revivial timings.  In fact, when this more serious error happens, the IRIS gets jiggled on unstow.  Hence *all* the lens components have to be reinstalled to revive the camera.

It does not make much sense to track down and suppress the new FOCUS error in FW, as more will be expected especially with complicated ZOOM.  Chipping away at ol' block in FW can lead to more difficulties that in may solve initially, especially with the new evidence on hand.

So ideally we'd like to go back to the first issue "try" CHDK FW that only suppresses the IS error, and generate clean uniformly-repeatable unstow/stow dummies for all lens components.  For that endeavor which is about to begin, all the new microcontroller hardware is now in. 

https://www.sparkfun.com/products/11098?

I have zero experience with these Arduino type devices.  Nonetheless, it appears there are enough I/O lines to do the entire job with one chip.  The minimum is:
  >  2 interrupts PI power
  >  2 interrupts ZOOM motor activity & direction
  >  5 outputs:  (1 @ FOCUS & IRIS, 3 ZOOM)

A question about interrupts for anyone who might know ...

 Q1) Although the chip has at least 5 interrupt vectors available, does the Arduino environment support them all?
 Q2) According to the spec sheet, nested interrupts are possible.  Does the Arduino environment support programming nested interrupts ?

ref Atmel
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Boards/ATMega32U4.pdf

@srsa_4c
I did some tests and found this:  With IRIS and FOCUS 555-dummied and working in REC mode, if I unplug AC adapter, the camera has to be component-revived, just as it did when REC->PLAY (and immediate error and shutdown).  That means there must be a general "bad flag" that is SET in the RTC register on normal unstow so if there is a power failure, then the revival that happens is incompatible with the dummy timing (ie also incompatible with a good stow on all components), as above.  All this begs for a strong HW uC solution.
« Last Edit: 06 / December / 2012, 15:58:08 by SticK »

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #262 on: 06 / December / 2012, 20:30:42 »
@SticK
After some tests it appears that the distortion correction for jpegs can be disabled (downside: this currently requires hooking another task which means a few kBytes less free RAM).

Can you try what happens if you
1) shut down the camera normally with attached hw
2) disconnect a few hw parts (focus, iris) or the respective dummies
3) try to start the cam in play mode
In case you've already tried this, then you don't need to repeat it unnecessarily.

Sadly I can't help with the Arduino.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #263 on: 06 / December / 2012, 22:39:03 »
Quote
downside: this currently requires hooking another task which means a few kBytes less free RAM
A few KB less won't be of major impact for the important benefit your solution would bring if you can get it to work.

Quote
Can you try what happens if you
1) shut down the camera normally with attached hw
2) disconnect a few hw parts (focus, iris) or the respective dummies
3) try to start the cam in play mode
I've tried a few varieties of these and anytime you get major failure that your override solution doesn't cover, all lens components have to be reconnected to revive the camera.  It looks bleak overall, so allow me to try the uC solution, and if I run into any brick wall, maybe only then I will ask your help.

Quote
Sadly I can't help with the Arduino.
I got the Arduino-micro working already blinking LEDs ... it's a great little device // but // we'll only know if it has promise if I can be assured we have interrupt capability.   By tomorrow we should know.  If that works, then I will code for IRIS unstow/stow as concept test.  If IRIS works, the rest should go OK.  The final challenge will be the ZOOM motor.
« Last Edit: 07 / December / 2012, 01:11:30 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #264 on: 08 / December / 2012, 00:00:14 »
BABY STEP with MICROCONTROLLER IRIS DUMMY

Some good news.  With the Sparkfun Pro Micro 3.3V I've uncovered that it has 5 interrupt breakout pins and all appear to be supported in the Arduino IDE.  So far I've tested one of them with a complete bidirectional unstow/stow dummy FW, and it works exactly as needed.   For interest's sake here is the Arduino code, not yet optimized for speed.

Code: [Select]
const int IRIS_pin       =  8;  // Yellow LED internal pin for now
const int yellow_LED_pin = 17;  // Yellow LED internal pin for now
const int PI_POWER_pin   =  7;  // PI_POWER input pin
const int PI_POWER_INT   =  4;  // pin 7 is internally tied to INTERRUPT #4
int        PI_POWER_state =  0; // 0 -> 6, 6 = 0, modulo 6 state machine

  void
setup()
  {
  pinMode(PI_POWER_pin, INPUT);
  pinMode(IRIS_pin, OUTPUT);
  pinMode(yellow_LED_pin, OUTPUT);
  attachInterrupt(PI_POWER_INT, change_state, CHANGE);
  WriteIRIS(LOW);
  }

const int mode_reset = 0;
const int mode_run = 1;

  void
change_state()
  {
  PI_POWER_state += 1;
  switch (PI_POWER_state)
    {
    case 1:
      IRIS_unstowing(mode_reset);
    break;
    default:
      if (PI_POWER_state == 6)
          PI_POWER_state = 0;
    }
  }

const int IRIS_unstow_timeout_ms = 763;

  int
IRIS_unstowing(int mode)
  {
  static long start_ms = 0;
  switch (mode)
    {
    case mode_reset:
      start_ms = millis();
    break;
    case mode_run:
      unsigned long current_ms = millis();
      if(current_ms - start_ms < IRIS_unstow_timeout_ms)
          return HIGH;
      break;
    }
  return LOW;
  }

  void
WriteIRIS(int val)
  {
  digitalWrite(IRIS_pin, val);
  digitalWrite(yellow_LED_pin, val == HIGH ? LOW : HIGH);
  }

  void
dispatch_IRIS()
  {
  int val = digitalRead(PI_POWER_pin);
  bool result = false;
  switch (PI_POWER_state)
    {
    case 1:
    case 2:
    case 3:
      result = IRIS_unstowing(mode_run);
      WriteIRIS(val & result);
    break;
    default:
      WriteIRIS(val);
    }
  }

  void
loop()
  {
  dispatch_IRIS();
  }

Next development will be FOCUS with its peculiar stow jiggle.  Hopefully at 8 MIPS this uC will be able handle all lens components.  If all this works, it will be a very elegant and compact solution.

@srsa_4c
I am currently using DISKBOOT_s90_101a_no_startup_lens_check_disableisdriveerror_try1.  Because now we are tackling both unstow and stow in uC FW, I would like to step back and run DISKBOOT_s90_101a_disableisdriveerror-only version, which I don't think I have.  In other words, for the uC solution to be acceptable, it has to pass clean camera FW w/o error overrides (except IS of course).

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #265 on: 08 / December / 2012, 13:16:16 »
I would like to step back and run DISKBOOT_s90_101a_disableisdriveerror-only version, which I don't think I have.  In other words, for the uC solution to be acceptable, it has to pass clean camera FW w/o error overrides (except IS of course).
I have removed the RTC check related hack from this build: https://subversion.assembla.com/svn/chdk-s1.bin/files/DISKBOOT_s90_101a_disableisdriveerror.ZIP

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #266 on: 08 / December / 2012, 14:03:00 »
@srsa_4c
Thank you. 

Major step forward: I just got FOCUS microcontroller dummy code working, and it's perfect.   All timings are with +/- 1 ms of the original hardware, including FOCUS stow "jiggle." 

The solution is entirely interrupt-driven.  Pristine activity, tiny footprint so far, and of course PLAY->REC->PLAY and REC->PDN->PUP->PLAY->REC all work perfectly.  This is looking very good // really first (dim) light at the end of a long dark tunnel:  IS, IRIS & FOCUS are now completely disconnected and the camera takes shots as usual.  Thus there is only ZOOM left and the PI solution will be trivial.  There appears to be tons of CPU power left to possibly solve the ZOOM MOTOR on the same microcontroller chip.
« Last Edit: 08 / December / 2012, 14:32:19 by SticK »

*

Offline ahull

  • *****
  • 634
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #267 on: 08 / December / 2012, 16:00:46 »
 :D Sounds like you are nearly there. I'm looking forward to seeing some of the results when you point it at some stars.

Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #268 on: 08 / December / 2012, 17:04:06 »
I'm looking forward to seeing some of the results when you point it at some stars.

He will be pointing in the opposite direction at 'specimens' that may contain the very earliest form of 'life' ... whatever that is.

Of course, we are all 'star children'   :)

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #269 on: 08 / December / 2012, 18:54:35 »
Folks, thanks for your kind encouragement and support, and most of all srsa // it's all very welcome  :).  We're hoping to uncover some photosynthetic microfossils that go back to the early beginnings (Archean ocean) of the Earth.

More news ... I just got ZOOM unstow/stow working :D, so now the only thing left moving on the entire camera is the ZOOM MOTOR shaft (and the SHUTTER of course).  I could take a pic but I'd rather wait until all the mecha is completely gone.  The ZOOM MOTOR encoder dummy will be quite a challenge // it won't be easy at all ???.

@ahull
I should add I think it was you who suggested a microcontroller a while back // got my mojo worhin' but took a bit of time to materialize!
« Last Edit: 08 / December / 2012, 18:57:38 by SticK »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal