Skip to content

Commit

Permalink
manually wait for the wiznet chip to initialize
Browse files Browse the repository at this point in the history
it doesn't flag reset complete, so just wait long enough.
  • Loading branch information
esmil committed Oct 10, 2011
1 parent 9453054 commit 67db499
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions netboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ watchdog_interrupt_flag_clear(void)
WDTCSR |= _BV(WDIF);
}

static void
watchdog_wait(void)
{
while(!watchdog_interrupt_flag());
watchdog_interrupt_flag_clear();
}

static void
spi_wait(void)
{
Expand Down Expand Up @@ -302,8 +309,7 @@ exit_bootloader(void)
printf("EXIT\r\n");
while (1) {
pin_toggle(LED);
while (!watchdog_interrupt_flag());
watchdog_interrupt_flag_clear();
watchdog_wait();
}
}

Expand Down Expand Up @@ -684,8 +690,9 @@ main(void)

printf("\r\n\r\nResetting chip");
wiz_set(WIZ_MR, 0x80);
while (wiz_get(WIZ_MR) & 0x80)
printf(".");

/* wait for it to initialize */
watchdog_wait();
printf("\r\n");

/* set MAC address */
Expand Down

0 comments on commit 67db499

Please sign in to comment.