How to keep camera from leaving rec mode when PTP drops?

  • 13 Replies
  • 2922 Views
How to keep camera from leaving rec mode when PTP drops?
« on: 20 / February / 2017, 22:41:57 »
Advertisements
I am having an issue with my CHDK project where my cameras occasionally drop their PTP due to noise on the USB bus. This is actually not a problem except that the camera switches out of rec mode in this case and stops taking pictures (it is triggered through the 3rd battery terminal). What I need is for the camera to always stay in rec mode regardless of what happens.


This is the event shell log from where the camera detects something, disconnects from USB and then goes into play mode:
Code: [Select]

00310870: UI:LogicalEvent:0x1162:adr:0,Para:0
00310870: UI:USBDisconnect
00310880: PTPRspnd.ShutDownPTPFrameworkClient
00310880: ShowCameraLog
00310890: UI:ShtCon_Shut 
00310890: UI:DSIC:4,0   
00310890: SS:AFUL
00310890: SS:AFUL*
00310890: UI:DSIC:1c,0   
00310890: UI:ScreenLock
00310890: UI:ScreenUnLock
00310890: UI:ScreenLock 
00310890: UI:Reduce ScreenUnLock
00310890: UI:ScreenLock
00310890: UI:Reduce ScreenUnLock
00310890: SS:   Raw[1]
00310900: SS:   Raw[1]
00310900: SS:   Raw[1]
00310900: UI:ScreenLock
00310900: UI:ScreenUnLock
00310900: UI:_StopBlinkSelfTimerLamp
00310900: UI:AC:RecOff
00310900: UI:ShutdownRecMode
00310900: UI:UI_StrobeCon_Stop
00310900: SS:ISChg
00310900: UI:ScreenLock
00310900: UI:Reduce ScreenUnLock
00310900: UI:ExitRecModeBeforeStopEVF
00310900: UI:LogicalEvent:0x3007:adr:0,Para:0
00310900: UI:ShutdownMovieController
00310900: UIFS_ChangeShootState
00310900: UI:MovieState:0x0
00310900: UI:ShtCon_Shut   
00310900: UI:_StopBlinkSelfTimerLamp
00310910: UI:CC_ShtdwnRec
00310910: UI:DispSwCon_MuteOnPhysicalScreen
00310920: UI:Window MuteOn
00310920: UI:MuteOnPhysicalScreen
00310920: UI:DispSwCon_TurnOffBackLight
00310920: UI:TurnOffBackLight
00310930: UI:AC:ShtDwnRec
00310930: SS:#Rec


I am playing with the "usb_force_active" command but the situation where the USB cable is disconnected is different:
Code: [Select]

00857120: UI:Button:0x000010B4:DisconnectUSBCable
00857120: UI:USBDisconnect
00857120: PTPRspnd.ShutDownPTPFrameworkClient
00861650: ShowCameraLog


Do any chdk hackers know how I could force the cams to stay in rec even when PTP drops? I am already running custom firmware so I can hack things in there if needed.

Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #1 on: 20 / February / 2017, 23:05:02 »
While I don't know anything about your setup, the first place I would suggest looking is at your power supplies rather than USB bus noise.  If I'm right about that, stopping the camera from leaving rec mode will only reveal other issues.

So if you are sure you have good single point grounding, with no ground loops, and adequate surge power capacity, and good shielding - then maybe a firmware hack will help.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #2 on: 20 / February / 2017, 23:30:53 »
At this point I have done what I can with the noise reduction I believe. There is a lot of other electronics, motors, etc running in the vicinity, so it is a "complex" noise environment. I have probed all the power supplies pretty extensively and am under the impression that the noise levels are reasonable there. Always potential to get "fooled", so I am still digging, but stopping the camera from leaving rec would at least hold me over.

*

Offline srsa_4c

  • ******
  • 3530
Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #3 on: 21 / February / 2017, 12:20:32 »
I am playing with the "usb_force_active" command but the situation where the USB cable is disconnected is different:
Code: [Select]
00857120: UI:Button:0x000010B4:DisconnectUSBCable
00857120: UI:USBDisconnect
00857120: PTPRspnd.ShutDownPTPFrameworkClient
00861650: ShowCameraLog
UI:Button events come from the PhySw task. The source should be one of the physw_status bits, AFAIK. Try logging the physw_status words (for example, before _kbd_p2_f() is called in the port's kbd.c). That might tell if more than one bit is affected by the USB state.


Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #4 on: 25 / February / 2017, 22:16:51 »
I have switched around how I am working with the cameras and now what I do is:
  • I configure the camera over PTP, then disable the USB PTP interface before I start shooting (by using the =usb_force_active command which I added a "force disable" option to).
  • Shoot photos (usually for 20-30mins at 20 shots/min) - triggered through the battery third terminal
  • Reenable USB PTP - this is through a custom "abort" mode in the trigger code (usb_sync.c) which turns the usb interface back on through usb_force_active.
The above is "Working". My theory is that if I disable the USB interface it won't be susceptical to bumping the camera back into play mode during my shoot sequence. The issue is that I am still getting partial photosets - the cameras are stopping taking photos for some reason. The timing of this is quite random. Sometimes it doesn't happen and we get all 400 odd photos, sometimes it does and we get some random fewer number.


Anyone have any ideas? I assumed it was PTP dropping/reconnecting that was popping the camera into play mode, but with USB disabled it seems like this shouldn't happen anymore...

Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #5 on: 25 / February / 2017, 22:52:07 »
<snip>
Shoot photos (usually for 20-30mins at 20 shots/min)
<snip>
The issue is that I am still getting partial photosets - the cameras are stopping taking photos for some reason. The timing of this is quite random. Sometimes it doesn't happen and we get all 400 odd photos, sometimes it does and we get some random fewer number.
<snip>
Anyone have any ideas?
Hmmmm ... 20 shots/min is one every three seconds.  That starts to get close to the maximum rate for most PowerShots to do a full focus/set_exposure/shoot/save_image sequence.  Especially in anything other than bright daylight.

Do you sometimes miss just one shot somewhere randomly in the sequence, or does the camera "drop out" for many shots randomly in the sequence,  or does it just stop shooting for good and all your missing shots are at the end of the session?

Shooting like that, you might be hitting one of those limits where an SD card is at its "wear leveling" point.  We did a lot of work looking at that two years ago - you can pick up the thread here
Ported :   A1200    SD940   G10    Powershot N    G16

Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #6 on: 26 / February / 2017, 11:13:16 »
Every time it stops shooting in the middle and never comes back. We don't miss random shots. Once this 'event' happens if the USB PTP interface is enabled it stops responding. In my current configuration I turn USB off, then reenable it through a custom function on the camera. This works in the cases where the camera got all the photos, but if it stopped shooting in the middle it never comes back and has to be power cycled. It is hard to know what is happening on the cameras since the ones in this device have no screen hooked up.


I have confirmed that the cameras are in fact turning themselves off. So I need to figure out why. It does not appear that there is a ROMLOG being generated. Is there a good way to determine what the "last shutdown reason" is through PTP?




*

Offline reyalp

  • ******
  • 11082
Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #7 on: 26 / February / 2017, 13:40:24 »
I have confirmed that the cameras are in fact turning themselves off. So I need to figure out why. It does not appear that there is a ROMLOG being generated. Is there a good way to determine what the "last shutdown reason" is through PTP?
In general, unexpected shutdowns like this are the camera crashing.

The only record would be a romlog. You are certain that there is no romlog created? You have to download it to the SD card using the CHDK menu (or eventprocs). The timestamp in the romlog should tell you if it was from the your crash. If your camera clock isn't set correctly, be sure to account for that.
Don't forget what the H stands for.


Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #8 on: 26 / February / 2017, 15:07:44 »
I have confirmed that the cameras are in fact turning themselves off. So I need to figure out why. It does not appear that there is a ROMLOG being generated. Is there a good way to determine what the "last shutdown reason" is through PTP?
In general, unexpected shutdowns like this are the camera crashing.

The only record would be a romlog. You are certain that there is no romlog created? You have to download it to the SD card using the CHDK menu (or eventprocs). The timestamp in the romlog should tell you if it was from the your crash. If your camera clock isn't set correctly, be sure to account for that.


I tried looking at the ROMLOG but the crashes that are stored are from previous incidents, so no new romlog's are being created. I previously had issues with the "third battery terminal" trigger causing a shutdown, but I had thought these were fixed. I may need to look at this again. The only way I knew how to detect this fault was by seeing the message appear on the screen (something like "battery over temperature, shutting down").

Re: How to keep camera from leaving rec mode when PTP drops?
« Reply #9 on: 01 / March / 2017, 20:34:07 »
I added a camera with a screen as well as a gopro to log. It appears I am getting the dreaded "CHANGE THE BATTERY PACK" right before the camera shuts down.


Does this typically mean that the input voltage is low? These cameras are powered off a fixed power supply in this installation. Should be right at 4.2v.

 

Related Topics