gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Sleep mode - has anyone got it to work?

#55240 - agentq - Mon Sep 26, 2005 10:25 pm

Hi,

I'm trying to implement sleep mode when the lid is closed on the DS. I've got it pretty much working, but it seems that if I leave the DS suspended for more than about 5 minutes, it's completely screwed up when it resumes.

Sometimes the screens are swapped, other times the sound just loops. Sometimes it just resets, but not to the point where you can actually use it again.

If I close the lid and reopen it within a few seconds it suspends fine and seems ok.

I've looked at Moonshell, which I assumed used this feature, but it seems that it just turns the LCD backlights off, and doesn't suspend the CPUs. I would imagine this would not extend the battery life all that much.

I've had a go at setting up a timer interrupt to wake things up every 30 secs and go to sleep again, but I can't get this to work, and don't know if I even need to!

Can anyone help me?

#55270 - josath - Tue Sep 27, 2005 7:27 am

I would think turning off the backlights, as well as the screens themselves (and otherstuff, see REG_POWER or whatever) would cut most battery usage. Then you can make the cpu sleep, by calling swiWaitForVblank or something, that shouldn't use up much cpu.

#55271 - agentq - Tue Sep 27, 2005 8:14 am

That was my backup plan, but I'm not sure it would be as good as the real sleep mode. Apparently the battery is meant to last for two weeks, which means it's got to be around 3% of the power during sleep compared to running.

#55275 - Fatnickc - Tue Sep 27, 2005 9:10 am

Two weeks of 'average play'. The actual battery life is ~10 hours, but the two weeks figure comes out of how foten they think you're going to play for.

#55341 - TJ - Tue Sep 27, 2005 9:13 pm

He means 2 weeks in sleep.

The DS is supposed to last 2 weeks in sleep mode (assuming fully charged battery and full sleep).

#55355 - agentq - Tue Sep 27, 2005 11:29 pm

I've written a sleep mode which halts the ARM7 waiting on the lid open interrupt. The ARM7 then signals to the ARM9 to wake up using the IPC. The ARM9 wakes up each Vblank to check to see if it's been told to wake, then goes back to sleep. I suppose the ARM9 could wait on an interrupt initiated by the ARM7 if I wanted rather than waking each frame.

The screens and sound amp are both off.

I'm going to leave it overnight and see if it survives.

EDIT: It survived fine. No red light either, and my DS was about half charged. I think.