PXA300+WINCE5 第一次supend 用USB wake up,activesync 连接失败问题

硬件环境:
CPU:    Marvell PXA300 XScale Processor 624MHz
System Memory/RAM:    Mobile DDR/16Bit 64Mbyte
NAND FLASH:    NAND Flash/16Bit 128MByte
Power Management with Touch Screen controller chip:    Dialog DA9034
SYSTEM: WINCE 5
我的PDA 第一次按power button进入suspend模式之后再唤醒(power button 或者plug usb)后会立刻进入到systemidle,此时若唤醒源为usb则,usb不能连接成功,之后再使系统进入suspend再唤醒不会立刻进入systemidle模式,

问题详细描述如下:
操作步骤:
1.上电,启动进入WINCE桌面
2.按power button 使system enter suspend mode
3.再次按Power button 使system wake up ,此过程中屏幕会白屏数秒(大概3~5s),之后显示桌面,但屏幕马上变暗.串口信息显示:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
4.此后再按下power button 使系统suspend 和wake up ,wake up得时间明显比第一次短,而且不会出现屏幕马上变暗,串口信息:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
------------------------------------------------
第二种操作情况:
1.上电,启动进入WINCE桌面
2.按power button 使system enter suspend mode
3.插入USB cable(UAB 另一端与PC相连)使system wake up ,此过程中屏幕会白屏数秒(大概3~5s),之后显示桌面,但屏幕马上变暗.此时usb连接得弹出窗口停留在"Connectting to Host"画面,activsync没有连接成功.
串口信息显示:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x0]: 'systemidle'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x4
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: CYH Power State Flags:0x0
PWM: Waiting for PM state transition notification
AUTORAS:: Dialer notifies: [1] [Dialer Start]
4.重新给系统断电再上电(或者reset按钮 作reset),按power button 使system enter suspend mode
   再次按Power button 使system wake up ,
5.
此后再按下power button 使系统suspend 插入USB wake up ,wake up得时间明显比第一次短,而且不会出现屏幕马上变暗,activsync连接成功!
串口信息:
PWM: PBT_RESUME
PWM: Set System status ON
read DA9034 reg event C=0x0
read DA9034 reg event D=0x0
PWM: Waiting for PM state transition notification
CYH PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
read DA9034 reg sts A=0x5
read DA9034 reg sts B=0x1
read DA9034 reg EVENT_A=0x0
read DA9034 reg EVENT B=0x0
read DA9034 reg EVENT C=0x0
read DA9034 reg EVENT D=0x0
PWM: POWER_STATE_ON
CYH backlight_set 95-32
PWM: Waiting for PM state transition notification
Statll 0
AUTORAS:: Dialer notifies: [1] [Dialer Start]
gcu reset!OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
Posting WM_NETCONNECT(TRUE) message
AUTORAS:: Dialer notifies: [4] [Dialer Connected]

-------------------------------------------------
DA9034 reg EVENT B bit4:USB_DEV

USB_DEV : USB device detection/removal caused a nIRQ to be generated

什么系统第一次进入suspend wakeup后会立刻进入systemidle并且USB 唤醒得话也不能连接成功那?


   我后来作了个实验在pwrbutton.c 里得PWM: PBT_RESUME后调用了函数SystemIdleTimerReset();但是结果一样第一次还是会立刻进入sustemidle.


case PBT_RESUME:
                {
                    RETAILMSG(1, (TEXT("PWM: PBT_RESUME/r/n")));
   SystemIdleTimerReset();// prevent systemidle

.... 

                 }

 

=======================================================

DATE :2008-12-03 UPDATE

更新下,这个问题

1.昨天做了试验,去掉了SDHC 功能,重新编译了系统,结果没有改善

2.今天早上,把pwrbutton.c恢复到来原来的BSP带的样子,power button suspend 失败,但可以唤醒.

  步骤:

1),上电,启动系统,从start menu进入suspend mode,之后按power button 唤醒,这次没有进sustemidle 但唤醒时间也比较长,

串口信息:

[SDH1:] SDH_IOControl: Entering D3/D4...
backlight_set 1
[BKL1] Notify IPM Ready For Processor state for driver -84213757
PWM: PBT_TRANSITION to system power state [Flags: 0x200000]: 'suspend'
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=24, HSS=2
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=24, HSS=2
SA2Video::power_ioctl 3
SA2Video::set_power_state 4, original state 1XllpLCDSuspend
Suspend_Graceful
XllpLCDSuspend-
OALIoCtlHalPreSuspend
SA2Video::PowerHandler 1gcu suspend!
+Touch panel power handler Start
-Touch panel power handler End
[MMC] SDH: +SDH_PowerDown
BUZZER - PowerDown
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep

-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
+FMD_PowerUp
[FMD] probe the flash successfully, index=2
[FMD] It is 1G 16bit Micron NAND
-FMD_PowerUp
IMM_PowerUp...
1-wire driver Sequent call of CreateFileMapping(MFPRMDB_SHARED_FILENAME)!
Battery Driver::BatteryPDDPowerHandler
BUZZER - PowerUp
[MMC] SDH: +SDH_PowerUp
SA2Video::PowerHandler 0+Touch panel power handler Start
-Touch panel power handler End
Battery Driver::BatteryPDDResume
[SDH1:] SDH_IOControl: Entering D0...
backlight_set 95-32
[BKL1] Notify IPM Ready For Processor state for driver -84213757
PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
[STUART]:notify IPM that do not enter D0CS
[SDH1:] fSimulateCardInsertion
[BKL1:] MinOP Set/Release FAILED
SA2Video::power_ioctl 0
SA2Video::set_power_state 1, original state 4LCDInitControllerCommon lccr1 0x000
0013f @ 0x00430000
[STUART]: IPM_SetMinOp failed (enIPMRetStatus = 3)
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=0
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=0
PWM: PBT_RESUME
PWM: Set System status ON
PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
Time: 8:01 --- DS2781 Voltage: 3441 mV --- DS2781 Current: -194 mA
OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
Time: 8:01 --- DS2781 Voltage: 3441 mV --- DS2781 Current: -172 mA

2),从菜单进入suspend ,按power button 唤醒,这次唤醒时间很快,未出现白屏,串口信息:

OEMIoControl: Unsupported Code 0x1010024 - device 0x0101 func 9
gcu reset!Time: 8:01 --- DS2781 Voltage: 3441 mV --- DS2781 Current: -172 mA
[SDH1:] SDH_IOControl: Entering D3/D4...
backlight_set 1
[BKL1] Notify IPM Ready For Processor state for driver -84213757
SA2Video::power_ioctl 3
SA2Video::set_power_state 4, original state 1PWM: PBT_TRANSITION to system power
 state [Flags: 0x200000]: 'suspend'
XllpLCDSuspend
Suspend_Graceful
XllpLCDSuspend-
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=24, HSS=2
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=24, HSS=2
OALIoCtlHalPreSuspend
SA2Video::PowerHandler 1gcu suspend!
+Touch panel power handler Start
-Touch panel power handler End
[MMC] SDH: +SDH_PowerDown
BUZZER - PowerDown
Battery Driver::BatteryPDDPowerHandler
IMM_PowerDown...
FMD_PowerDown
Save Register Counter 19
g_SRAM_Start is :0xabb14000
Finish init save content
PWER::0x8000000f AD3ER:0x80000001
+OALKitlPowerOff
Call XllpPmEnterSleep
-InitDebugSerial
Resume back from XllpPmEnterSleep
Wakeup Source 1027, AD3SR 0x1
+OALKitlPowerOn
OEMPowerOff(): to restart the RCOMP eval, and enable RCOMP interrupts
Return from OEMPowerOff
+FMD_PowerUp
[FMD] probe the flash successfully, index=2
[FMD] It is 1G 16bit Micron NAND
-FMD_PowerUp
IMM_PowerUp...
1-wire driver Sequent call of CreateFileMapping(MFPRMDB_SHARED_FILENAME)!
Battery Driver::BatteryPDDPowerHandler
BUZZER - PowerUp
[MMC] SDH: +SDH_PowerUp
SA2Video::PowerHandler 0+Touch panel power handler Start
-Touch panel power handler End
Battery Driver::BatteryPDDResume
[SDH1:] SDH_IOControl: Entering D0...
backlight_set 95-32
[BKL1] Notify IPM Ready For Processor state for driver -84213757
SA2Video::power_ioctl 0
SA2Video::set_power_state 1, original state 4LCDInitControllerCommon lccr1 0x000
0013f @ 0x00430000
PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
[STUART]:notify IPM that do not enter D0CS
[SDH1:] fSimulateCardInsertion
PWM: PBT_RESUME
PWM: Set System status ON
PWM: PBT_TRANSITION to system power state [Flags: 0x10000]: 'on'
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=1
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=0
OALIOCtlIPM:  Received SET_OP
    OALIOCtlIPM:  next XL=16, HSS=0

3),断电,上电,启动系统,从start menu 进入suspend,插入usb cable唤醒,虽然没有进入systemidle ,但是连接不成功,停留再"Connectting to HOST "窗口,且这时机器易死掉.

 

===================================================

2008-12-04 UPDATE

问题已解决:

我仔细观察串口信息,第一次醒来,白屏时,是卡在了这里耗费了时间

[BKL1:] MinOP Set/Release FAILED

我跟踪了代码,发现在backlight.cpp里有函数BackLightSetState,每次suspend和resume都会调用该函数,第一次wake up时 IPM_notify(is_on); 会返回错误代码3:    IPM_STATUS_READ_TIME_OUT,也就是在这里调用失败时延时退出,耗费了时间,具体为什么会失败,我还没搞明白,上电初始化,suspend 时也会调用IPM_notify(is_on); 都是成功的,只有在第一次wake up时会失败。

我把这个延时退出的时间改小就好了.第一次醒来不管是power button唤醒还是USB 唤醒都不会进入systemidle ,USB activsync也可以连接成功了.

下面是两个函数的代码:
----------------------------------------------------------------------------------------------------------

BOOL BackLightSetState(DWORD dwContext, CEDEVICE_POWER_STATE state)
{
    // sets the backlight state (turns the backlight on and off)
    DEBUGMSG(ZONE_FUNCTION, (L"+BackLightSetState(0x%08x)/r/n", (DWORD) state));

    BOOL is_on = is_state_on(state);

    backlight_set(is_on);
    IPM_notify(is_on); //这里返回错误

    return TRUE;
}

static void IPM_notify(BOOL is_on)
{
    DWORD dwProcState;
    BOOL ret;

    if(is_on)
 dwProcState = IPM_PROCESSOR_RING_OSC_RDY |IPM_PROCESSOR_D0_RDY;
    else
        dwProcState = IPM_PROCESSOR_RING_OSC_RDY |IPM_PROCESSOR_D0_RDY
                      | IPM_PROCESSOR_D2_RDY | IPM_PROCESSOR_D1_RDY;

    NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver %d/r/n"),ipm_client_id);
    if (IPM_NotifyReadyForProcState(ipm_client_id, dwProcState, 3000) == IPM_STATUS_SUCCESS)
    {
 // NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver Completed/r/n"));
    }
    else
 NKDbgPrintfW(_T("[BKL1] Notify IPM Ready For Processor state for driver FAILED/r/n"));


    if(is_on)
      //  ret = IPM_SetMinOp(ipm_client_id, IPM_OP_104MHZ ,3000);//cyh mask
      // 2008-12-04,
      //system first time enter systemidle and wake up
      //in this satuation ,when wake up,will return "MinOP Set/Release FAILED 3",it mean failed ,and will have a delay(3000),
      //this will make system enter "systemile",usb activesync fail if the wake up source is USB.
      //in order to solve this issule,here make the delay 30,
     ret = IPM_SetMinOp(ipm_client_id, IPM_OP_104MHZ ,30);//cyh add to solve the fisrt time USB AS resume source ,activesync fail issule
    else
        ret = IPM_ReleaseMinOp(ipm_client_id, 1000);

    if (ret == IPM_STATUS_SUCCESS)
    {
        //NKDbgPrintfW(_T("[%s] MinOP Set/Release Success!/r/n"),pController->szName);
    } else
        NKDbgPrintfW(_T("[BKL1:] MinOP Set/Release FAILED %x /r/n"),ret);
}


总结:

[BKL1:] MinOP Set/Release FAILED 这个错误我一开始就发现了,就是没有深究,而是转过头找禁止系统进systemidle 的方法,用了函数SystemIdleTimerReset(),还不起作用,我又把sdhc驱动去掉,看是不是sd那边引起的,因为sd也会返回有错误

"SetDevicePower: Wrong Return Value from 'sdh1:', returning ERROR_GEN_FAILURE"

去掉sdhc也不起作用,才回过头来追查[BKL1:] MinOP Set/Release FAILED ,才找到问题,浪费了4天时间,如果一开始目标明确,不要眉毛胡子一把抓,一一排查,我想会更快的解决问题.现在这个问题的原因,还没有时间深究,暂时能够解决问题.以后有时间再来看.

另外,查问题要细心观察,哪个地方有异常,像这个问题就是时间耗费在哪里的问题.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值