현재 회로에서 65mA 정도 소요되는 것 같습니다.
더 Sleep 하게 들어갈 수 있는데 LCD쪽이랑 충돌이 나는지 리셋되네요.
// SDRAM Refresh Control Register (MEMREFCON)
#define R_MEMREFCON (volatile unsigned int*)(0x80000408)
#define F_MEMREFCON_RFR_15USEC ( 0<< 9) // 15 usec
#define F_MEMREFCON_RFR_30USEC ( 1<< 9) // 30 usec
#define F_MEMREFCON_NRC_1CYC ( 0<< 8) // 1 Cycle
#define F_MEMREFCON_NRC_2CYC ( 1<< 8) // 2 Cycle
#define F_MEMREFCON_AUTO ( 0<< 0) // Auto Refresh
#define F_MEMREFCON_SELF ( 1<< 0) // Self Refresh
void Sleepmode_Check(void)
{
register U32 Sleep_timeout = SLEEP_TIMEOUT;
register U32 i;
register U32 cnt;
if(Sleepmode.SleepTick > SLEEPTIME){
/* LD Control BD Disable */
MAINBD_POWER_DIS();
/* Buzzer Off*/
BUZZEROFF();
/* BackLight OFF */
BACKLIGHTDIS();
/* LED OFF */
STATLED1OFF();
STATLED2OFF();
STATLED3OFF();
STATLED4OFF();
/* LCD DE Disable */
DISP_DE_DIS();
/* STOP Timer */
STOP_Timer(TIMER1);
STOP_Timer(TIMER3);
// PMU Write Enable
*R_PMUWREN = F_PMUWREN_BOD | F_PMUWREN_USB | F_PMUWREN_PCLK | F_PMUWREN_HCLK | F_PMUWREN_SOUND | F_PMUWREN_PLL | F_PMUWREN_CLOCK;
// *R_HCLKCON = F_HCLKCON_SDRAM_ENABLE | F_HCLKCON_SDRAMCON_ENABLE | F_HCLKCON_AHB_ENABLE | F_HCLKCON_GPIO_ENABLE;
*R_PCLKCON = F_PCLKCON_APB_ENABLE;
*R_CLKCON = 0;
// PLL Control 0 / 1
*R_PLLCON = 0x7575; // 12MHz
for(i=0; i<40000; i++)
asm("nop");
// *R_PMUWREN = 0;
//=============================================================
// SDRAM Refresh Self Mode
*R_MEMREFCON |= F_MEMREFCON_SELF;
//=============================================================
while(1){
if(TP_nIRQ()){
while(TP_nIRQ()){
/* WatchDog Timer Clear */
WDG_Clr(WDG_3SEC);
/* Check Time */
if((Sleep_timeout--) == 0){
break;
}
}
break;
}
for(i=0; i < 525950; i++){
asm("nop");
/* WatchDog Timer Clear */
WDG_Clr(WDG_3SEC);
if(TP_nIRQ())
break;
}
STATLED2TOGGLE();
Sleepmode.SleepTick++;
/* POWER OFF */
if(Sleepmode.SleepTick > POWERTIME){
STATLED1ON();
/*System Off*/
POWER_OFF();
}
}
// ============================================================
// Recovery
PMU_WRITE_ENABLE;
*R_PLLCON = 0x3524;
for(i=0;i<40000;i++)
asm("nop");
*R_CLKCON = 0x3301;
// *R_HCLKCON = F_HCLKCON_USBHOST_ENABLE |
// F_HCLKCON_CRTCM_ENABLE | F_HCLKCON_SDHC_ENABLE |
// F_HCLKCON_EXSRAM_ENABLE | F_HCLKCON_SERIAL_ENABLE | F_HCLKCON_DMA_ENABLE | F_HCLKCON_GPIO_ENABLE |
// F_HCLKCON_INTCON_ENABLE | F_HCLKCON_SDRAMCON_ENABLE | F_HCLKCON_SDRAM_ENABLE | F_HCLKCON_AHB_ENABLE;
*R_PCLKCON = F_PCLKCON_PINMUX_ENABLE | F_PCLKCON_QEI_ENABLE | F_PCLKCON_MPWM_ENABLE |
F_PCLKCON_SMIXER_ENABLE | F_PCLKCON_TWI_ENABLE |
F_PCLKCON_UART_ENABLE | F_PCLKCON_TIMER_ENABLE | F_PCLKCON_WDT_ENABLE | F_PCLKCON_CRTCS_ENABLE |
F_PCLKCON_APB_ENABLE;
PMU_WRITE_DISABLE;
//=============================================================
// SDRAM Refresh Auto Mode
*R_MEMREFCON = 0;
// ============================================================
Sleepmode.SleepTick = 0;
/* LCD DE Disable */
DISP_DE_EN();
/* LD Control BD Enable */
MAINBD_POWER_EN();
/* Status LED Turn On */
STATLED2ON();
/* Backlight IC Enable */
BACKLIGHTEN();
/* Initialize Timer1 */
SET_Timer(TIMER1, TIMER1MS);
/* Initialize Timer3 */
SET_Timer(TIMER3, TIMER1000MS);
}
}
'초보의 아웅다웅 설계하기 > Adstar' 카테고리의 다른 글
USB Device Mode - MSC(mass storage class) (0) | 2023.02.25 |
---|---|
ADSTAR SDCard Boot 시 각종 에러 발생 문제 (0) | 2023.01.06 |
ADSTAR - Sleep mode (0) | 2022.06.17 |
SD Card 내에 파일을 읽어서 Ymodem으로 업데이트 (0) | 2022.05.18 |
WatchDog Clear 문제 (0) | 2015.06.29 |