ASSERT!! FocusLensController.c Line 203 - General Discussion and Assistance - CHDK Forum

ASSERT!! FocusLensController.c Line 203

  • 12 Replies
  • 4103 Views
ASSERT!! FocusLensController.c Line 203
« on: 12 / January / 2021, 20:27:05 »
Advertisements
Hi all - CHDK is great; I'm trying to use it to setup a VERY long-term timelapse (10 years).

I'm controlling an A640 (I fully expect it to need replacing before the 10 years are up) with CHDKPTP on a Raspberry Pi and running a640-100b-1.5.1-5694-full in the camera.

The actual scripting happens on the Pi in Python - the Python script sends LUA commands to the camera; for example:

Code: [Select]
command(rf'./chdkptp.sh -c -e"luar return set_zoom({int(zoom * MAX_ZOOM + 0.5)})")
(my Python 'command' function uses subprocess.run to pass the command to Linux).

This works great, except that I've been pulling my hair out trying to figure out why the camera suddenly started crashing as soon as I issue 'remoteshoot' to CHDKPTP.

Eventually I found out about ROMLOG.LOG - I found this:

Code: [Select]
ASSERT!! FocusLensController.c Line 203
Occured Time  2021:01:13 00:14:43
TCB: 00272E38
Task: tCaptSeqTa
SP: 0x00272CE4
StackDump:
0x00000000
0x31323032
0x3A31303A
0x30203331
0x34313A30
0x0033343A
0xFFEA4528
0xFFEB2E00
0x00000001
0x00272D50
0x00001026
0x00000000
0x00000000
0x00000000
0xFFC03D1C
0x00000001
0xFFEA47B4
0xFFC11E18
0x002E55BC
0x00001026
0x00000000
0x00272D50
0x0000A468
0x00000000
0x00000000
0xFFEB3264
0x00272D50
0x00000C80
0x00000000
0x00001026
0x0000A45C
0x00007FFF
ShootConDump:
01 02 ff ff ff ff ff ff ff ff
CameraConDump:
08 0b 02 0e 0a 01 ff ff ff ff
00008560: DSIC:0xc,0

00008560: Window:EffectiveLockPhysicalScreen

00008560: Window:IneffectiveLockPhysicalScreen

00008570: LogicalEvent:0x3135:adr:0x0,Para:0

00008570: _ManagePTMProperty

00008570: DSID:0x20

00008580: DSID:0x2a

00008580: DSID:0x2b

00008580: DSID:0x25

00008580: DSIC:0xb4,0

00008580: DSIC:0xb1,0

00008590: DSID:0x20

00008590: DSID:0x2a

00008590: DSID:0x2b

00008590: SS:CaptureModeChange

00008590: SS:EvfMode = 0

00008590: SS:CaptMode = 0x8004

00008600: SS:CaptModeCustom = 0x8004

00008600: SS:CompleteCaptureModeChange

00008600: _DecideCaptureMode

00008600: _StartStill

00008610: SS:UsingRaw[0]

00008610: DSID:0x27

00008610: DSID:0x24

00008610: DSID:0x25

00008620: DSID:0x86

00008620: DSID:0xa5

00008620: DSIC:0xb4,0

00008620: DSIC:0xb1,0

00008620: DSID:0xa4

00008620: DSID:0x24

00008620: DSID:0x25

00008630: DSID:0x24

00008630: DSID:0x25

00008640: DSID:0x25

00008640: DSIC:0xb4,0

00008640: DSIC:0xb1,0

00008640: DSIC:0xb2,0

00008640: DSIC:0x41,6

00008690: Window:IneffectiveLockPhysicalScreen

00008690: _MuteOffStitch

00008690: TerminateDeliverToZoomController

00008690: DSID:0x20

00008700: DSID:0x2a

00008700: DSID:0x2b

00008700: OPTICAL_ZOOM_MIN_POS

00008700: UnpressZoomLever

00008700: SS:StartFinder

00008700: SS:EvfMode = 0

00008700: SS:StartFinder

00008750: DispSwCon_TurnOnDisplayDevice

00008750: DispSwCon_TurnOnDisplayDevice

00008750: LogicalEvent:0x313d:adr:0x0,Para:0

00008760: _EntryStartRecMode

00008760: CaptModeChanger_CheckRTCRrepared

00008760: DispSwCon_MuteOffPhysicalScreen

00008760: MuteOffPhysicalScreen

00008760: DSID:0x11

00008760: _DecideModeDial

00008760: LogiEvnt_NotPowerType:0x0984:adr:0x0,Para:0

00008760: LogiEvnt_NotPowerType:0x0982:adr:0x0,Para:0

00008820: Window:IneffectiveLockPhysicalScreen

00011470: Window:IneffectiveLockPhysicalScreen

00012810: Window:IneffectiveLockPhysicalScreen

00012900: Window:IneffectiveLockPhysicalScreen

00014040: Window:IneffectiveLockPhysicalScreen

00015360: Window:IneffectiveLockPhysicalScreen

00015650: Window:IneffectiveLockPhysicalScreen

00018720: PressSwOne

00018720: SS:UsingRaw[0]

00018720: DSID:0x27

00018720: ShtCon_Activate

00018730: ShtCon_PrepareCapture

00018730: LockChangeFinder

00018730: DSIC:0x61,0

00018730: DSIC:0xe,0

00018730: Window:EffectiveLockPhysicalScreen

00018730: Window:IneffectiveLockPhysicalScreen

00018730: LogicalEvent:0x3135:adr:0x0,Para:0

00018740: DSIC:0xe,0

00018740: SS:PrepareCapture

00018760: ClearEventComp

00018780: Window:IneffectiveLockPhysicalScreen

00018880: Window:IneffectiveLockPhysicalScreen

00019850: PressSwTwo

I tried to look at FocusLensController.c line 203, hoping to get a clue re what's going wrong, but I've downloaded release-1_5.zip, and I can't find any such file FocusLensController.c in there. (Am I looking in the wrong place?)

It turns out that the last thing I do before 'remoteshoot' is to set focus to infinity, by doing this (my Python script generates these commands):

Code: [Select]
./chdkptp.sh -c -e"luar return set_prop(12, 1)
./chdkptp.sh -c -e"luar return set_focus(65535)

Something about that crashes the camera.

Advice??

(Oh, FWIW, this is not related to the gphoto2 volume monitor conflict with CHDKPTP; I do a "killall" in my shell script to turn that off.)




*

Offline reyalp

  • ******
  • 14128
Re: ASSERT!! FocusLensController.c Line 203
« Reply #1 on: 13 / January / 2021, 02:26:32 »
Eventually I found out about ROMLOG.LOG - I found this:

Code: [Select]
ASSERT!! FocusLensController.c Line 203
Occured Time  2021:01:13 00:14:43
TCB: 00272E38
Task: tCaptSeqTa
...

I tried to look at FocusLensController.c line 203, hoping to get a clue re what's going wrong, but I've downloaded release-1_5.zip, and I can't find any such file FocusLensController.c in there. (Am I looking in the wrong place?)
Yes, that's a Canon firmware assert, and refers to their source file which we obviously don't have. You can use a disassembler to find the relevant firmware code, but it probably won't help much.

Quote
Code: [Select]
./chdkptp.sh -c -e"luar return set_prop(12, 1)
./chdkptp.sh -c -e"luar return set_focus(65535)

Something about that crashes the camera.
Generally, setting the propcase isn't sufficient to actually set the focus mode. I'd suggest using set_mf(1) instead.

According the A640 platform_camera.h, focus override should work in MF and AF lock, but not in AF. My guess is setting the propcase makes CHDK think it was in MF, but then try to apply the override when it's still actually in AF, triggering the crash.

Also just as a general note, most CHDK script overrides are only applied for the duration of the script. That means if you use
Quote
luar set_tv(...)
luar shoot()
You won't actually get the tv value you set, because each luar command is a separate script. So usually it's better to put everything in one call like
Code: [Select]
luar set_tv(...) shoot()
or use the cli shoot command instead.

For your specific case with set_focus, this shouldn't matter because in MF mode set_focus takes effect immediately instead of being applied in the next half shoot.
Don't forget what the H stands for.

Re: ASSERT!! FocusLensController.c Line 203
« Reply #2 on: 13 / January / 2021, 11:56:05 »
Yes, that's a Canon firmware assert, and refers to their source file which we obviously don't have. You can use a disassembler to find the relevant firmware code, but it probably won't help much.

That explains it. Thanks; at least I can stop looking.

Quote
Quote
Code: [Select]
./chdkptp.sh -c -e"luar return set_prop(12, 1)
./chdkptp.sh -c -e"luar return set_focus(65535)

Something about that crashes the camera.

Generally, setting the propcase isn't sufficient to actually set the focus mode. I'd suggest using set_mf(1) instead.

According the A640 platform_camera.h, focus override should work in MF and AF lock, but not in AF. My guess is setting the propcase makes CHDK think it was in MF, but then try to apply the override when it's still actually in AF, triggering the crash.

I'll try set_mf(1).

Here's an odd thing - I tried it on a 2nd A640 (I buy them used on eBay cheap...) that I'm keeping in reserve for when the first one wears out. That one doesn't crash with the same script.

Yet the first one seems to work fine otherwise.

By the way:

* Anybody know how many shutter actuations an A640 is supposed to last?

* I'm planning to reboot the camera periodically, thinking that the firmware wasn't designed to run 24/7 for years (maybe there are small memory leaks, etc.). Any advice on how often is wise? (Each reboot runs the lens motors, so I'd like to reboot as rarely as I can.)

*

Offline reyalp

  • ******
  • 14128
Re: ASSERT!! FocusLensController.c Line 203
« Reply #3 on: 13 / January / 2021, 12:53:11 »
Here's an odd thing - I tried it on a 2nd A640 (I buy them used on eBay cheap...) that I'm keeping in reserve for when the first one wears out. That one doesn't crash with the same script.
Possibly different canon settings, like shooting mode or focus related menu settings?

We have also seen bit rot in old cameras like this, but given that the crash is in focus override in a situation that isn't expected to work, I'd say this is a less likely scenario. You could upload a firmware dump if you want, or run the firmware CRC module (misc -> tools -> Checksum ROM) a few times.
Quote
Anybody know how many shutter actuations an A640 is supposed to last?
I don't known how long they're *supposed* to last, but anecdotally, many of these cameras last hundreds of thousands of shots. As noted above, there can be other age related failures.

Quote
* I'm planning to reboot the camera periodically, thinking that the firmware wasn't designed to run 24/7 for years (maybe there are small memory leaks, etc.). Any advice on how often is wise? (Each reboot runs the lens motors, so I'd like to reboot as rarely as I can.)
I'd suggest every couple weeks at a minimum. The camera tick counter will wrap negative after 2^31 milliseconds.
Don't forget what the H stands for.

Re: ASSERT!! FocusLensController.c Line 203
« Reply #4 on: 13 / January / 2021, 14:39:12 »
Generally, setting the propcase isn't sufficient to actually set the focus mode. I'd suggest using set_mf(1) instead.

That fixed it! Thanks!!

(You might want to mention that in the propcase docs...)

Re: ASSERT!! FocusLensController.c Line 203
« Reply #5 on: 13 / January / 2021, 22:40:32 »
You might want to mention that in the propcase docs...
It's a wiki.  Please feel free to add appropriate comments or clarifications.  TIA.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline RaduP

  • *****
  • 926
Re: ASSERT!! FocusLensController.c Line 203
« Reply #6 on: 18 / February / 2021, 16:04:34 »
Just curious, why not just use the high res (12mp) camera that comes with the Pi? It has a higher resolution than the A640, and you won't have to retract/extend the lens each time you start it up.

Re: ASSERT!! FocusLensController.c Line 203
« Reply #7 on: 18 / February / 2021, 17:19:15 »
Just curious, why not just use the high res (12mp) camera that comes with the Pi? It has a higher resolution than the A640, and you won't have to retract/extend the lens each time you start it up.

The A640 is a better camera, that's all. C-mount lenses tend not to be terribly sharp and usually have a lot of geometric distortion. The A640 has a variable aperture diaphragm that can be controlled by software.

(Altho at the moment I'm considering replacing the A640 with a Canon G1X - that has a 1.5" sensor for vastly better noise performance.)

*

Offline RaduP

  • *****
  • 926
Re: ASSERT!! FocusLensController.c Line 203
« Reply #8 on: 18 / February / 2021, 17:22:20 »
You can 3d print (or buy) adapters to Canon EF-EFS. Of course, the crop factor is huge, like x5.5 or so, but the lenses can be controlled by some sort of SPI, so you can control the focus and aperture.

And from playing with my sensor (though not very much) the quality is really nice. A640 is a very old camera, there has been a lot of progress in the sensor technology since then.

Re: ASSERT!! FocusLensController.c Line 203
« Reply #9 on: 18 / February / 2021, 17:31:14 »
You can 3d print (or buy) adapters to Canon EF-EFS. Of course, the crop factor is huge, like x5.5 or so, but the lenses can be controlled by some sort of SPI, so you can control the focus and aperture.

And from playing with my sensor (though not very much) the quality is really nice. A640 is a very old camera, there has been a lot of progress in the sensor technology since then.

I don't doubt you're right. I have a couple of the Pi hirez cameras, and they're really nice. But I use them for video stuff.

Talking to an EF/EF-S lens sounds complicated - do you know if somebody's figured out how and offered a Python library for it? Probably a simpler solution would be an old manual-focus prime. But, while it's easy to find adapters to put C-mount lenses on modern cameras, it's usually hard to find adapters the other way around (if you know a source for an adapter to put M43 lenses on a C-mount camera, let me know - I really need that for another project; I may have to hire somebody to make it.)

But I already had a couple of A640s sitting around - this is a hobby project. I bought a couple of spares on eBay for $30 each. They're cheaper than the naked Pi camera! And the output is quite good (even today...).

 

Related Topics


SimplePortal © 2008-2014, SimplePortal