|
| 1 | +# Ethernet3 |
| 2 | +Ethernet library for Arduino and Ethernetshield2 / WIZ550io / WIZ850io with Wiznet W5500 chip |
| 3 | +based on the Ethernet2 library of arduino.org |
| 4 | + |
| 5 | +added some new functionalities |
| 6 | + |
| 7 | +you need to include |
| 8 | + |
| 9 | + #include <Ethernet3.h> // instead Ethernet.h |
| 10 | + #include <EthernetUdp3.h> // instead EthernetUdp.h for UDP functionality |
| 11 | + |
| 12 | +###- New init procedure **!!!** |
| 13 | + |
| 14 | +the init of the Ethernetinterface changed, the ordner is now: |
| 15 | + |
| 16 | +*mac, ip, subnet, gateway, dns* instead *mac, ip, dns, gateway, subnet*, |
| 17 | +which is more logical |
| 18 | + |
| 19 | + Ethernet.begin(mac, ip, subnet, gateway, dns); |
| 20 | + |
| 21 | +###- Multicast support |
| 22 | + |
| 23 | +multicast for udp added |
| 24 | + |
| 25 | + EthernetUdp udp |
| 26 | + upd.beginMulticast(multicastIP, port); |
| 27 | + |
| 28 | +###- PHY support |
| 29 | + |
| 30 | +added some function to read the PHYCFGR in Ethernet3 |
| 31 | + |
| 32 | + uint8_t phyState(); // returns the PHYCFGR |
| 33 | + uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link |
| 34 | + const char* linkReport(); // returns the linkstate as a string |
| 35 | + uint8_t speed(); // returns speed in MB/s |
| 36 | + const char* speedReport(); // returns speed as a string |
| 37 | + uint8_t duplex(); // returns duplex mode 0 = no link, 1 = Half Duplex, 2 = Full Duplex |
| 38 | + const char* duplexReport(); // returns duplex mode as a string |
| 39 | + |
| 40 | +example |
| 41 | + |
| 42 | + Serial.println(Ethernet.linkReport()); |
| 43 | + |
| 44 | +###- MAC address |
| 45 | + |
| 46 | +added some function to read the MAC address in Ethernet3, this is helpfull when you use Wiznet boards like WIZ550io with build in MAC address |
| 47 | + |
| 48 | + void macAddress(uint8_t mac[]); // get the MAC Address |
| 49 | + const char* macAddressReport(); // returns the the MAC Address as a string |
| 50 | + |
| 51 | +example |
| 52 | + |
| 53 | + uint8_t mac[6]; // array for mac address |
| 54 | + Ethernet.macAddress(mac); |
| 55 | + |
| 56 | +###- Socketnumbers |
| 57 | + |
| 58 | +you can decrease the socketnumbers to get more free RAM space, this must be done before Ethernet.begin(...) |
| 59 | + |
| 60 | +the possible socketnumbers are |
| 61 | + |
| 62 | + Ethernet.init(1); -> 1 Socket with 16k RX/TX buffer |
| 63 | + Ethernet.init(2); -> 2 Socket with 8k RX/TX buffer |
| 64 | + Ethernet.init(4); -> 4 Socket with 4k RX/TX buffer |
| 65 | + Ethernet.init(); -> 8 Socket with 2k RX/TX buffer |
| 66 | + |
| 67 | +be carefull with the MAX_SOCK_NUM in w5500.h , it cannot changed dynamicly |
| 68 | + |
| 69 | +example |
| 70 | + |
| 71 | + Ethernet.init(4); // reduce to 4 Socket, each with 4k RX/TX buffer |
| 72 | + Ethernet.begin(); |
| 73 | + |
| 74 | +###- RST and CS pin settings |
| 75 | + |
| 76 | +you can set the CS and (Hardware) RST (e.g. WIZ550io or USR-ES1), this must be done before Ethernet.begin(...) |
| 77 | + |
| 78 | +standard is Pin 10 for CS and Pin 9 for RST |
| 79 | + |
| 80 | + Ethernet.setCsPin(3); // set Pin 3 for CS |
| 81 | + Ethernet.setRstPin(4); // set Pin 4 for RST |
| 82 | + |
| 83 | +example |
| 84 | + |
| 85 | + Ethernet.setRstPin(); // set Pin 9 for RST |
| 86 | + Ethernet.begin(); |
| 87 | + |
| 88 | +###- Hard- and Software Reset |
| 89 | + |
| 90 | +two new functions to make resets, they can done only after Ethernet.begin(...) |
| 91 | + |
| 92 | +for Hardware Reset you need to set the Pin number |
| 93 | + |
| 94 | + Ethernet.softreset(); // performs a software reset |
| 95 | + Ethernet.hardreset(); // performs a hardware reset |
| 96 | + |
| 97 | +example |
| 98 | + |
| 99 | + Ethernet.setRstPin(); // set Pin 9 for RST |
| 100 | + Ethernet.begin(); |
| 101 | + Ethernet.hardreset(); |
| 102 | + |
0 commit comments