From 9dc6c28545daf15e8f7e67e5fa9b5cf6730a0585 Mon Sep 17 00:00:00 2001 From: Guillaume Knispel Date: Thu, 26 Jul 2012 21:30:04 +0200 Subject: make power sequence work quite well Properly reset the EP80579 by driving SYS_RESET_N inside the reset state machine and IMCH_RSMRST_N correctly back in the main state machine. --- hardware.h | 7 ++++--- main.c | 16 ++++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/hardware.h b/hardware.h index dfd7bbe..7c017f2 100644 --- a/hardware.h +++ b/hardware.h @@ -97,9 +97,10 @@ PxIES_INIT //Interrupt Edge Select (0=pos 1=neg) // PORT2 #define P2OUT_INIT (CK410_PWR_GD_N | CPU_VCCP_EN_N | GREEN_LED_N \ - | RED_LED_N | IMCH_RSMRST_N | SYS_RESET_N) -#define P2DIR_INIT (CPU_VCCP_EN_N | GREEN_LED_N | RED_LED_N) -#define P2REN_INIT (CK410_PWR_GD_N | IMCH_RSMRST_N | SYS_RESET_N) + | RED_LED_N | SYS_RESET_N) +#define P2DIR_INIT (CPU_VCCP_EN_N | GREEN_LED_N | RED_LED_N \ + | IMCH_RSMRST_N) +#define P2REN_INIT (CK410_PWR_GD_N | SYS_RESET_N) #define P2SEL_INIT 0 #define P2IE_INIT 0 #define P2IES_INIT 0 diff --git a/main.c b/main.c index 7310e0f..bc4fa18 100644 --- a/main.c +++ b/main.c @@ -97,16 +97,16 @@ int main(void) break; case RST_STATE: - SetBit(P2DIR, IMCH_RSMRST_N); - ClrBit(P2OUT, IMCH_RSMRST_N); - Timer2 = 100; + ClrBit(P2REN, SYS_RESET_N); + SetBit(P2DIR, SYS_RESET_N); + ClrBit(P2OUT, SYS_RESET_N); + Timer2 = 150; resetState = RST_WAIT; break; case RST_WAIT: if (Timer2 == 0) { - ClrBit(P2DIR, IMCH_RSMRST_N); - SetBit(P2OUT, IMCH_RSMRST_N); + SetBit(P2OUT, SYS_RESET_N); if (SW2State == 0) resetState = ON_STATE; } @@ -130,9 +130,6 @@ int main(void) if (SW1State || TENSION_EXPIRED) state = STOP; if ((P4IN & ATX_PWROK) && TENSION_WAIT(bV2P5 && bVCC3)) { - SetBit(P2DIR, SYS_RESET_N); //modif jmo 25072012 - ClrBit(P2OUT, SYS_RESET_N); //modif jmo 25072012 - ClrBit(P1OUT, V1P2_CORE_EN_N); Timer1 = 30; state = WAIT_V1P2; @@ -153,8 +150,7 @@ int main(void) if (SW1State) state = STOP; if (Timer1 < 20) { - SetBit(P2DIR, IMCH_RSMRST_N); - ClrBit(P2OUT, IMCH_RSMRST_N); + SetBit(P2OUT, IMCH_RSMRST_N); state = WAIT_V1P8; } break; -- cgit v1.2.3