Fast boot (sub second) of pi zero w - howto ?


17 posts
by johnjones » Sat Jun 17, 2017 6:55 am
Hi

I am working on a project for a charity and would like to use a pi zero w, However the project needs the device to capture a image in 1-2 seconds from power on.

Please would you post details if you have achieved an linux environment with the pi zero w ( BCM2835 ).

I realise that the default firmware config would not allow this. has anyone had any success with sub second boot ?
(I find it hard to believe the videocore designers did not envisage a device to turn on and be functional in under 2 seconds what about all those ipTV's ? )

Please limit your posts to positive experiences or mentioning people who would be able to achieve it.
I hope this thread can be a positive engineering resource for those that need tight well engineered results !

Regards

John Jones
Posts: 8
Joined: Sat Jun 03, 2017 5:09 am
by klricks » Sat Jun 17, 2017 7:04 am
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click web icon on right side --->
Posts: 4433
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by johnjones » Sat Jun 17, 2017 8:04 am
Thats not very positive or useful so I was wondering if anyone had any positive experience in booting under a second and capturing an image here

Again I find it hard to believe the designers of a videocore device did not think of bringup in under a second

John
Posts: 8
Joined: Sat Jun 03, 2017 5:09 am
by rpdom » Sat Jun 17, 2017 8:13 am
johnjones wrote:Again I find it hard to believe the designers of a videocore device did not think of bringup in under a second

Why do you find it hard to believe? The VC was designed for use in mobile phones. How long does your mobile take to start up from cold?
User avatar
Posts: 10852
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by johnjones » Sat Jun 17, 2017 8:37 am
I presumed they actually engineered it for IP television and the mobile phone / ipod was simply a way to earn money, either way it seems odd that the system has to spend so long initialising...

Again has anyone had any positive experience ?
Posts: 8
Joined: Sat Jun 03, 2017 5:09 am
by mahjongg » Sat Jun 17, 2017 10:07 am
most IP tv's do not really turn off, I don't think that any device with the complexity of a real OS can turn on and be ready in seconds, even if they have all their software in permanent storage (ROM) it will take much more than a few seconds to initialise all devices that must be initialised.

in contrast, the PI has nor permanent built in storage at all (except for a tiny bit of boot code) and has to load *everything* from sd-card.

In short, no!
sub seconds boots are impossible.

On the other hand, energy wise, there is no real reason to shut down at all.

The fastest demo I can recall having seen booted to a simple game in something like 5 seconds, and all that had to do in these 5 seconds was to load a single piece of a few hundred kilobyte of bare metal code, no OS involved, and nothing to initialise.
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands
by dwelch67 » Sat Jun 17, 2017 1:32 pm
the closest you could come to this is probably what some laptops do and that is they have an arm (non-x86) keep the dram and other things alive, they hibernate basically by taking a snapshot of the system and keeping the snapshot in ram powered on, then can bring up the main cpu which is relatively fast, then restore state then run.

set top boxes, your car stereo, ip enabled tvs, etc these things dont completely turn off. Things take a while to come up, dram init, getting on the network, wired or wireless, all these things take time, you cannot create/replace the laws of physics just because you wish to.

If you want something to boot fast you have to design it from the ground up, that doesnt guarantee you can meet any time you want, and most of the time it is an illusion to the user, the thing is partially on all the time and only the display is off, or the processor is put in a sleep mode if it is a major power consumer, etc. (like your phone or set top box, off means simply turn off the video). You cannot take any arbitrary system and change its design after it is in production and out in the wild. You can certainly re-write the GPU boot code and make the pi boot faster, you are more than welcome to do that, how fast can you boot? Well you let us know when you get there. You would need to do without video, usb, and dram at a minimum to really get the speed improvement, and I dont think there is enough if any on chip ram to do anything useful, but will see let us know what you find. You certainly wont be running linux BTW.

You want something that can take a picture in a second, first off why would you use a pi, second you are going to be leaving something if not everything on. Perhaps shop around through the myriad of camera modules, and take a microcontroller on it (which most certainly can boot within a second, and can come out of low power mode even faster than boting), combine the two, done.
Posts: 722
Joined: Sat May 26, 2012 5:32 pm
by dwelch67 » Sat Jun 17, 2017 1:36 pm
and yes, if you take a pi and write your code for the GPU instead of the arm, treat it like a microcontroller, yes you could boot and take a picture that fast depending on the camera, you might have to leave the camera module on all the time, depends on what you find. depending on what you learn about the gpu you might have it be a very short program that starts the arm immediately, assuming you can find some ram you can get the arm up that fast as well, but in either case the camera may be slow, and you need enough ram, or better get a camera module with ram on it. You could replace the gpu bootloader, so that it takes the picture first into the ram of the camera module, then does a normal boot however long that takes, then you can use linux on the arm to extract that image and send it somewhere if that is what you need to do with the image.
Posts: 722
Joined: Sat May 26, 2012 5:32 pm
by dwelch67 » Sat Jun 17, 2017 7:36 pm
How fast does it boot from power on to the arm coming up? Not linux but the arm coming out of reset? Normal boot, no modifications to the GPU code, no config.txt, very small arm binary, maybe enough to set a gpio pin for your scope. Have you measured it? What time did you get?

What camera are you thinking of using?
Posts: 722
Joined: Sat May 26, 2012 5:32 pm
by Martin Frezman » Sat Jun 17, 2017 9:34 pm

Which no longer exists.

What happened to it? Did OP single-handedly delete the thread?
Did he get a mod to remove it?
If this post appears in the wrong forums category, my apologies.
Posts: 751
Joined: Mon Oct 31, 2016 10:05 am
by klricks » Sat Jun 17, 2017 9:49 pm
Martin Frezman wrote:

Which no longer exists.

What happened to it? Did OP single-handedly delete the thread?
Did he get a mod to remove it?


It was a duplicate thread in which the OP already had gotten several answers.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click web icon on right side --->
Posts: 4433
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by Gavinmc42 » Sat Jun 17, 2017 11:23 pm
Ultibo will boot in <2 seconds, but the VC4 accelerated stuff like camera interface is not working, yet.
Fast boot camera is one of the apps I want to use Ultibo for.
You probably won't get less than 3 seconds as the camera ISP still has to do white balance etc.

An always on OS would be the way to go, depending on what needs to be running 30-80ma could be the current drain.

Baremetal VC4 coding could be one way to do it, but you would be looking at a custom start.elf.
As start_x.elf has all the camera magic code, adding an extra "power on, take image", code could be done here.
RPF would have to be the ones to write this code as they have the secret sauce recipes.

There may not even be a need to fire up the ARM as the VC4 could write the image to SDcard.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges
User avatar
Posts: 1286
Joined: Wed Aug 28, 2013 3:31 am
by johnjones » Sun Jun 18, 2017 7:21 am
Thanks Gavinmc42

Your comments are helpful and Positive !

Your probably right about the 3 seconds as the camera ISP might be limitation I guess thats why ARM ltd are doing their own.
30mA seems a lot to me for a battery powered system that has to last weeks

A nice addition to the firmware would be to initialise the camera and take a snapshot but I think I would have to do this myself which would involve a lot of work in initialising the other subsystems for little benefit, this is why other systems have open firmware...

Pretty much all embedded systems I've used initialise very fast under 1 second, however things like phones spend a huge amount of time securing their boot process by checking all the binaries have not been patched and checking battery voltage etc, TV systems, radio systems and transport systems will initialise under a second and subsystems like disk and network might not be fully available but the schedular is up and busy...

I suppose it comes down to understanding other peoples point of view and having a broader understanding of the world around you...

Thanks

John
Posts: 8
Joined: Sat Jun 03, 2017 5:09 am
by mikerr » Sun Jun 18, 2017 9:16 am
Boot time can be down to 2 seconds with bare metal stuff - but that's not much use if you want to use linux niceties and peripherals.

The fastest I managed to boot and take a picture using the CSI camera is 7 seconds using Arch
https://www.raspberrypi.org/forums/view ... 43&t=80421
Android app - Raspi Card Imager - download and image SD cards - No PC required !
User avatar
Posts: 2420
Joined: Thu Jan 12, 2012 12:46 pm
Location: Up north , UK
by Martin Frezman » Sun Jun 18, 2017 10:21 am
It was a duplicate thread in which the OP already had gotten several answers.


Hence my question. I don't see how he could have deleted it once it had (substantive) responses from other people.

And I don't think mods would do that sort of thing either. Hence my question.
If this post appears in the wrong forums category, my apologies.
Posts: 751
Joined: Mon Oct 31, 2016 10:05 am
by Gavinmc42 » Sun Jun 18, 2017 12:31 pm
Thanks mikerr, I did not know arch was that fast.
Never really played with it because the first few Pi years I had no Internet access.

I might see how fast I can boot piCore, normally it is 12-15 secs.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges
User avatar
Posts: 1286
Joined: Wed Aug 28, 2013 3:31 am
by mahjongg » Sun Jun 18, 2017 6:50 pm
Martin Frezman wrote:And I don't think mods would do that sort of thing either. Hence my question.
Nope we do! if both identical posts have answers we simply choose the one with the least answers (but no promise here).
Simply do not post duplicate questions.
The other one should have the same subject line so you can search for it if you know it.
User avatar
Forum Moderator
Forum Moderator
Posts: 9216
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands