Automatic shutdown at powerloss

Post here your applications done based on UPiS
Share your ideas about new possible applications

Re: Automatic shutdown at powerloss

Postby erik001 » Thu Jul 03, 2014 10:31 pm

Hi am new here.
I keep trying to make the script to work but i keep geting the following error message:

root@raspberrypi:/home/pi/upis# /home/pi/upis/upissd.sh
/home/pi/upis/upissd.sh: line 16: syntax error near unexpected token `)'
/home/pi/upis/upissd.sh: line 16: `    0x04)'

Can someone give me a solution

greets erik
erik001
 
Posts: 5
Joined: Thu Jul 03, 2014 10:19 pm

Re: Automatic shutdown at powerloss

Postby maestro » Fri Jul 04, 2014 7:51 am

Hello,

please run
bash -x /home/pi/upis/upissd.sh
and post the result.

Vit
maestro
 
Posts: 32
Joined: Tue Mar 11, 2014 7:07 pm

Re: Automatic shutdown at powerloss

Postby erik001 » Fri Jul 04, 2014 7:01 pm

hi when i run the command in your previous post,i get:

root@raspberrypi:/home/pi/upis#bash -x /home/pi/upis/upissd.sh
+ DELAY=40
+ COUNTER=0
/home/pi/upis/upissd.sh: line 16: syntax error near unexpected token `)'
/home/pi/upis/upissd.sh: line 16: ` 0x04)'
root@raspberrypi:/home/pi/upis#

how i made upissd.sh,i coppied the text from the script in this forum into leafpad.
i ran the command chmod 0777 /home/pi/upis/upissd.sh
maybe i did something wrong?

greets erik
erik001
 
Posts: 5
Joined: Thu Jul 03, 2014 10:19 pm

Re: Automatic shutdown at powerloss

Postby erik001 » Mon Jul 07, 2014 10:50 am

I think i found the problem,

I downloaded notepad++ on mu windows pc and copied the script text from the forum into notpad++,converted the file with notepad++ to unix format and then save it as upis_shutdown.py

I renamed the file shutdown.py to shutdown.sh and copied it to my raspberry upis folder.When i ran it now it display no error messages,and gave the right output when i unplugged the usb cable from the upis.
The only problem i have is that the after i cut the power and the raspberry goes into halt mode,The red led on the raspberry is on and the led bat on the upis is lid constant and the led sta blinks.
So when i turn on the power the raspberry does not boot,but stays in the halt mode.
The only way to boot the raspberry is by switching it on and of with the switch on the upis

Greets erik
erik001
 
Posts: 5
Joined: Thu Jul 03, 2014 10:19 pm

Re: Automatic shutdown at powerloss

Postby juiba » Thu Jul 10, 2014 10:51 pm

Hi,

I'm also having this same problem - when Raspberry has been shutdown the PWR led just keeps on. Thus re-powering UPiS does't bring Raspberry back up. Raspberry is halted properly, but UPiS doesn't cut the power. I also tried "poweroff" command without success. Do I have to tell UPiS to cut the power using @SDWN command directly to the device or is there some way for UPiS to understand automatically when system has been halted?

Thanks, Jussi
juiba
 
Posts: 24
Joined: Thu Jul 10, 2014 10:45 pm

Re: Automatic shutdown at powerloss

Postby Pimaster » Fri Jul 11, 2014 2:00 am

Hi,
We just fixing these part of the new firmware 1.09
use this intermediate version I'm attaching or wait until we fix all problems, this problem has been fixed here, however it is still not official release

https://app.box.com/s/wpgejq2evwhy8jymaotp

Warmest Regards
Pi Master
Warmest Regards
PiM
---
Designing with Mentor Graphics PADS - www.pads.com
Please read and follow the PiForum rules
http://www.forum.pimodules.com/viewtopic.php?f=13&t=196
---
Pimaster
Site Admin
 
Posts: 1581
Joined: Fri Sep 14, 2012 7:50 am

Re: Automatic shutdown at powerloss

Postby SteveMilner » Mon Jul 14, 2014 10:28 am

Trying to get fwshut.py working.

I seem to be missing some libraries

Code: Select all
pi@raspbmc:~/bin$ sudo python fwshut.py
Traceback (most recent call last):
  File "fwshut.py", line 2, in <module>
    import RPi.GPIO as GPIO
ImportError: No module named RPi.GPIO


How do I install RPi.GPIO?


I'm also trying to set the number of seconds before the UPiS waits after power loss before it shuts the system down with fwshut.py.

Hi,
there is already implemented PICo command which define the time you need to automatic shutdown when on battery powering

5 or 0x05 fssd_batime Byte Common R/W File Safe Shut Down Timer for Unconditional Automatic File Safe Shutdown when UPiS is in BAT PWR Mode (loose the cable power) in seconds in HEX format

Read: Anytime, Return actual fssd_batime value

Write: 0xff – Disable the timer, default value

Write: 0x01 – 0xfe time in seconds when UPiS+RPi shutdown after cable power will go out (EPR or USB)



When I try and read the value at 0x05 using this command
Code: Select all
pi@raspbmc:~$ sudo i2cget -y 1 0x05 0
Error: Read failed


I get the error above.

Code: Select all
pi@raspbmc:~$ sudo i2cget -y 1 0x6A 0
0x02


Works fine.

What do I need to do to read and write the 0x05 value

I am running 1.09 firmware.

Regards,
Stephen
SteveMilner
 
Posts: 14
Joined: Mon Jun 30, 2014 10:55 am

Re: Automatic shutdown at powerloss

Postby juiba » Mon Jul 14, 2014 4:25 pm

Hi,

Thanks for advice. I upgraded to 1.091 and system worked one or two times as expected. However after that it started acting strangely. When UPiS is powered on it starts to blink STA/STB light in red and powers Raspberry. However, after some seconds UPiS cuts power from Raspberry and starts to blink STA/STB light with green light. At the same time CHG light is switched off. Please see following video:

https://www.youtube.com/watch?v=X0EiKJ7AU-k

Best regards, Jussi
Last edited by juiba on Tue Jul 15, 2014 12:35 pm, edited 1 time in total.
juiba
 
Posts: 24
Joined: Thu Jul 10, 2014 10:45 pm

Re: Automatic shutdown at powerloss

Postby Pimaster » Mon Jul 14, 2014 4:59 pm

Hi,

Thank you for your video, it seems to be a small but, the fast blinking LED is new powering mode the CPR (Cable Powering Mode). We will work on it and return very fast, I'm probably not resetting one variable. Please keep the video I need it in order to regenerate this condition.

Will be back very soon.

Warmest Regards
Pi Master
Warmest Regards
PiM
---
Designing with Mentor Graphics PADS - www.pads.com
Please read and follow the PiForum rules
http://www.forum.pimodules.com/viewtopic.php?f=13&t=196
---
Pimaster
Site Admin
 
Posts: 1581
Joined: Fri Sep 14, 2012 7:50 am

Re: Automatic shutdown at powerloss

Postby juiba » Tue Jul 15, 2014 12:32 pm

Hi,

I did now @factory reset for UPiS and after that the system has worked smoothly 10+ times. I think that the problem might have been that I once powered Raspberry via its power source and UPiS shut it down, maybe some parameters were not reseted correctly. Or then python firmware upgrade script just didn't perform @factory reset correctly. I will let you know if I encounter issues again.

By the way, is it normal that when I unplug UPiS from the power source it keeps telling the following via COM port? Raspberry keeps running as it should until the script shuts it down after 300 seconds.

UPiS System Stared File Safe Shutdown Procedure

UPiS System Finished File Safe Shutdown Procedure

UPiS System Stared File Safe Shutdown Procedure

UPiS System Finished File Safe Shutdown Procedure

UPiS System Stared File Safe Shutdown Procedure

UPiS System Finished File Safe Shutdown Procedure

UPiS System Stared File Safe Shutdown Procedure

UPiS System Finished File Safe Shutdown Procedure

UPiS System Stared File Safe Shutdown Procedure

BR, Jussi
juiba
 
Posts: 24
Joined: Thu Jul 10, 2014 10:45 pm

PreviousNext

Return to UPiS Users Application

Who is online

Users browsing this forum: No registered users and 1 guest