WinCE 6 + i.MX28: cannot clear AUTO_RESTART

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WinCE 6 + i.MX28: cannot clear AUTO_RESTART

Jump to solution
1,319 Views
mmaaxx
Contributor III

Hello, I'm using imx28 with wince. I need to be able to reboot and shutdown the system.

I'm can reboot the system with no problems, using: KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL); 


However I'm having troubles shutting it down. I read power up sequence part of the RM, and aware of everything that makes system boot. I believe, that AUTO_RESTART is the only thing that makes system start. So I'm trying to clear it, and for some reason it doesn't clear.

Here is a code that I'm using to shut it down (I'm shutting it down form the keypad driver):

HW_RTC_PERSISTENT0_SET(BM_RTC_PERSISTENT0_DISABLE_PSWITCH);

HW_RTC_PERSISTENT0_CLR(BM_RTC_PERSISTENT0_AUTO_RESTART);

Sleep(1000);

if (HW_RTC_PERSISTENT0_RD() & BM_RTC_PERSISTENT0_AUTO_RESTART) GREEN_LED();

     else RED_LED();

Sleep(1000);

KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);

Basically, I'm trying to DISABLE_PSWITCH (even thou pin is pulled down to ground), then clear AUTO_RESATRT, then wait little bit, and check if AUTO_RESTART is set (and it is always set), then reboot. System always reboots after running this code.

Any suggestions on why AUTO_RESTART is not being cleared (and how to clear it)? Oh how to shut the system down, otherwise?

Thanks!

Labels (1)
0 Kudos
1 Solution
1,006 Views
mmaaxx
Contributor III

I figures the issue. I've been missing virtual to physical address mapping: 

    static PVOID pv_HWregRTC = NULL;

    PHYSICAL_ADDRESS phyAddr;

    phyAddr.QuadPart = CSP_BASE_REG_PA_RTC;

    pv_HWregRTC = (PVOID) MmMapIoSpace(phyAddr, 0x500, FALSE);

    if (pv_HWregRTC == NULL)

        ERRORMSG(TRUE, (_T("MmMapIoSpace pv_HWregRTC failed!\r\n")));

After this was added, everything worked fine.

Thanks!

View solution in original post

0 Kudos
5 Replies
1,007 Views
mmaaxx
Contributor III

I figures the issue. I've been missing virtual to physical address mapping: 

    static PVOID pv_HWregRTC = NULL;

    PHYSICAL_ADDRESS phyAddr;

    phyAddr.QuadPart = CSP_BASE_REG_PA_RTC;

    pv_HWregRTC = (PVOID) MmMapIoSpace(phyAddr, 0x500, FALSE);

    if (pv_HWregRTC == NULL)

        ERRORMSG(TRUE, (_T("MmMapIoSpace pv_HWregRTC failed!\r\n")));

After this was added, everything worked fine.

Thanks!

0 Kudos
1,006 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Perfect :smileyhappy:

0 Kudos
1,006 Views
markwilliams
Senior Contributor I

Hi, how are you powering the system? Via battery or through the +5V/USB input? I believe if you are running from the 5V input you cannot shut the system down.

I used an external power switch controller IC that I can assert a "power kill" line that disconnects and latches off the power to shut down. It has a push button input to restart, or remove and reapply the main power.

I do not have a battery and my design is powered via the i.MX28 5V input.

Mark

0 Kudos
1,006 Views
mmaaxx
Contributor III

Mark, thanks for the suggestion.

I know about 5V (I user +5V to start the system - pretty much like a power on signal). And I'm trying to shutdown with the battery power only (I manually unplug 5V, before the shutdown). No RTC Alarms are set, pswitch is hard-wired to the ground.

My concern is inability to clear the persistent bit AUTO_RESTART. I know that it is set before the reboot, so it doesn't surprises me that the system reboots. However It surprises me that AUTO_RESTART remains set after attempt to clear it.

0 Kudos
1,007 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Deactivated user are you available to help on this case?

0 Kudos