Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetNetIf.h" 00003 EthernetNetIf eth; 00004 00005 void dogKick() { 00006 LPC_WDT->WDFEED = 0xAA; 00007 LPC_WDT->WDFEED = 0x55; 00008 printf("dogkick\n"); 00009 } 00010 void setDog(float s =30) { 00011 LPC_WDT->WDCLKSEL = 0x1; // Set CLK src to PCLK 00012 uint32_t clk = SystemCoreClock / 16; // WD has a fixed /4 prescaler, PCLK default is /4 00013 LPC_WDT->WDTC = s * (float)clk; 00014 LPC_WDT->WDMOD = 0x3; // Enabled and Reset 00015 dogKick(); 00016 } 00017 DigitalOut ethrst(P1_28);// PHY chip on mbed reset 00018 DigitalOut led(LED3); //Alive 00019 int main() { 00020 ethrst=0;//PHY reset 00021 wait(1); 00022 ethrst=1; 00023 wait(1); 00024 00025 printf("\n\nStartup...\n"); 00026 00027 00028 setDog(30); 00029 printf("Setting up...\n"); 00030 EthernetErr ethErr = eth.setup();// i have tested with different timeouts setup(30000) etc 00031 00032 00033 if (ethErr) { 00034 printf("Error %d in setup.\n", ethErr); 00035 return -1; 00036 } 00037 printf("Setup OK\n"); 00038 led=1; 00039 return 0; 00040 00041 }
Generated on Tue Jul 12 2022 23:12:28 by
