Wake Me Up Before You Go-go

Official FreeEMS vanilla firmware development, the heart and soul of the system!
Post Reply
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Wake Me Up Before You Go-go

Post by Fred »

http://www.youtube.com/watch?v=pIgZ7gMze7A

I'm so sorry, but I couldn't resist!

To IRQ or XIRQ, that is the question! Do you feel lucky? Well, do ya, punk?
[22:33] <@Cheetah> djandruczyk: in light of that article on NMI that i linked you, can you think of anything in an engine bay that needs that sort of functionality? We have a separate ISR for low voltage, btw. I can't.
[22:33] <@Cheetah> I'm tempted to leave it disabled and use it to come out of STOP back into the code where it left off and tidy up in that respect without an ISR
[22:34] <@Cheetah> all we need is to wake. we don't need to get an interrupt to deal with it
[22:34] <@Cheetah> as long as we're at a known spot in the code
[22:34] <@Cheetah> which we will be as we will run STOP and the next instruction will be the one that runs when the machine wakes up (likely something to setup the clocks again i guess)
[22:34] <@Cheetah> the thing is, when you leave it masked it still wakes the device up
[22:35] <@Cheetah> which means we can have nice simple code, never fuck with the X bit, set the I bit to disable ALL other interrupts, disable the XGATE entirely, then go to sleep, wake up again from XIRQ, then setup the clocks if its not automatic, then restore all functionality.
[22:35] <@Cheetah> data cleansing can be done post going to sleep
[22:36] <@Cheetah> such that upon wake its fast to get going again with no init to do
[22:37] <@djandruczyk> does HCS12 have NMI's?
[22:37] <@djandruczyk> or not?
[22:39] <FreeAir> XIRQ is one IF enabled
[22:39] <FreeAir> brb
[22:44] <@Cheetah> if you don't enable it, it's not. That's the only external one. Resets are another type, as is SWI and spurious interrupt and so on.
[22:44] <@Cheetah> XIRQ, even if NOT enabled will still wake the device up, just not interrupt from it, pick up where you left off scheme.
[22:45] <@Cheetah> I *think* I like that idea.
[22:45] <@Cheetah> less complex than the IRQ approach
[22:46] <@Cheetah> so in that usage case, the XIRQ is not an NMI, it's just a wake up pin pure and simple
[22:46] <@Cheetah> however if we NEED an NMI source for something ELSE and we've used that pin for wake up, we're fucked
[22:46] <@Cheetah> hence question
[22:46] <@Cheetah> make sense?
[22:46] <@Cheetah> seank-efi: you may have input there too
[22:46] <@Cheetah> and others also
[22:46] <@Cheetah> anyone chime in
[22:47] <seank-efi> noted, thx
[22:53] <@djandruczyk> sorta. i just think something needs to the tell the device to shutdown in case of loss of power signal, that signal needs to be clean(debounced), and depending on ifthe device is level or edge triggered will make certain demands in the circuitry. last thing i want is it to randomly writing shit to memory due to fuckedinstructions during a power fade...
[22:54] <@Cheetah> it can go pretty far below 5v and still function OK, but flash burns probably wont work. We have a Low V interrupt separately, and we're monitoring Batt V live all the time, so we can react in multiple ways at multiple levels
[22:55] <@Cheetah> however, the truth is, we're always connected to the battery, so if we ever dip that low on our main supply line, chances are the battery is flat or the starter fucked or battery terminal corroded etc, and it'll go uber low and just reset.
[22:55] <@Cheetah> what we're concerned about here is key off and on again
[22:56] <@Cheetah> for this purpose we're talking about a slow controlled shut down and a fast startup
[22:58] <@Cheetah> the nice thing with the masked XIRQ wakeup is no interrupts, so even if the V level is fucked up and saw toothed it'll just wake up the device anyway, and not do anything else, and then the device can examin the environment, see the low V on that pin and put itself back to sleep.
[22:59] <@Cheetah> I'm going to grab all of this and bang it in a thread for a wider audience
Any wild ideas are welcome! We're listening!

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Wake Me Up Before You Go-go

Post by Fred »

Hardware circuit design to support this code:

viewtopic.php?f=9&t=1267

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply