arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
261 stars 264 forks source link

Between 10% and 90% performance more #125

Closed pierre83 closed 4 years ago

pierre83 commented 4 years ago

NEED SOME people to test on orther platform than MEGA-UNO-DUE

Performances: 1.Between 10 and 25% increase in TX speed, all protocols, 2 increase up to 90% in transactionnal mode, 3 increase up to 25% in server mode, 4 small increase in RX modes 5.10% decrease with DUE in RX bytes continuous mode, Ethernet PCasal.zip

Errors corrected: RX_inc must be an uint16_t instead of uint8_t (as both are compared) TX_FSR : not initialized correctly and never used in the library despite the fact it is updated in getSnTX_FSR() Error in LARGE BUFFER #endif content (w5100.cpp : w5200 init)

Errors in W5500 addresses:(already seen on github) GP_REGISTER8 (SIR, 0x0017); // Sockets Interrupt // Which socket raised an interrupt __GP_REGISTER8 (SIMR, 0x0018); // Sockets Interrupt Mask // Which socket is allowed to raise an interrupt GP_REGISTER16(RTR, 0x0019); // Timeout address

Bugs corrected: 1.Add a timeout out in UDP rcv as suggested by +2018.11 fil (HUGE IMPROVEMENT), never stucks again, 2.if client.connect() asked twice reports -1, close the socket in any other case, 3.0. udp.read(...) and read() reports -1 if socket close on rcv operation and 0 if no data, 3.1 udp.read(...) and read() _remaining adjusted to 0 iof cnx close, 4.client.connect() verify that the socket status is INIT before connecting, 5.No more loops() without timeout, 6.udp.parsePacket() reports connection closed

bugs created: 1.Arduino Due : link on/off & duplex not correct

Improvements: 2.UDP and socket more reliables, 3.Verification if client connect is called twice by the sketch, 4.If no local port is provided, socket provide a 'random' one, 5.Manage provided port output list in outputPort[] and verify unity, 6.Remove random DHCP port thanks to (4), 7.DHCP now reports errors, 8.all 'Ethernet.begin' always report the result 1 or -1, 9.Report up to the application if the socket is closed, as much as possible, 10.Report link duplex and speed (W5500), 11.Implement SPI buffer transfert in W5100.write (w5200 & w5500), 12.Add interrupt availables, 13.Client connect() more reliable, 14.Let the sketch aware in case of W5x00 reset(return -1), 15.Fixed udp.flush(),

Interrupt management: 1.Enable global interrupts, count bits represent interrupts from 7...0, (1 enabling it) static void enableSocketsInterrupt(uint8_t count) { writeSIMR(count); } 2.Clear the general socket interrupt register static void clearSocketsInterrupt(uint8_t value) { writeSIR(value); } 3.Read the general socket interrupt register static uint8_t getSocketsInterrupt() { return readSIR(); } 4.Clear the socket interrupt register static void clearSocketInterrupt(uint8_t s, uint8_t value) { writeSnIR(s, value); } 5.Return the socket's interrupt register static uint8_t getSocketInterrupt(uint8_t s) { return readSnIR(s); }

Tools: Some small sketches to test speed/throughput and pps transactionnal

Errors: Surely, there may still have some errors/improvements to find/make

pierre83 commented 4 years ago

Released a more reliable version: see https://github.com/pierre83/Ethernet