add a timeout exit loop when Enc28J60Network never ready
This commit is contained in:
parent
9e429939a8
commit
49fa96c417
|
@ -30,13 +30,13 @@ void setup() {
|
|||
Ethernet.begin(mac);
|
||||
|
||||
Serial.print("localIP: ");
|
||||
Serial.println(Ethernet.localIP());
|
||||
Serial.println(Ethernet.localIP().toString());
|
||||
Serial.print("subnetMask: ");
|
||||
Serial.println(Ethernet.subnetMask());
|
||||
Serial.println(Ethernet.subnetMask().toString());
|
||||
Serial.print("gatewayIP: ");
|
||||
Serial.println(Ethernet.gatewayIP());
|
||||
Serial.println(Ethernet.gatewayIP().toString());
|
||||
Serial.print("dnsServerIP: ");
|
||||
Serial.println(Ethernet.dnsServerIP());
|
||||
Serial.println(Ethernet.dnsServerIP().toString());
|
||||
|
||||
next = 0;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ email=Norbert Truchsess <norbert.truchsess@t-online.de>
|
|||
sentence=Ethernet library for ENC28J60
|
||||
paragraph=implements the same API as stock Ethernet-lib. Just replace the include of Ethernet.h with UIPEthernet.h
|
||||
url=https://github.com/ntruchsess/arduino_uip
|
||||
architectures=STM32F1
|
||||
architectures=STM32F4
|
||||
version=1.04
|
||||
dependencies=
|
||||
core-dependencies=arduino (>=1.5.0)
|
||||
|
|
|
@ -57,6 +57,7 @@ static byte selectPin;
|
|||
|
||||
void Enc28J60Network::init(uint8_t* macaddr)
|
||||
{
|
||||
uint32 timeout = 0;
|
||||
MemoryPool::init(); // 1 byte in between RX_STOP_INIT and pool to allow prepending of controlbyte
|
||||
// initialize I/O
|
||||
// ss as output:
|
||||
|
@ -100,8 +101,12 @@ void Enc28J60Network::init(uint8_t* macaddr)
|
|||
#ifdef ENC28J60DEBUG
|
||||
Serial.println("ENC28J60::initialize / before readOp(ENC28J60_READ_CTRL_REG, ESTAT)");
|
||||
#endif
|
||||
while (!readOp(ENC28J60_READ_CTRL_REG, ESTAT) & ESTAT_CLKRDY)
|
||||
;
|
||||
while (!readOp(ENC28J60_READ_CTRL_REG, ESTAT) & ESTAT_CLKRDY) {
|
||||
if (++timeout > 100000) {
|
||||
Serial.println("ENC28J60::initialize TIMEOUT !!!\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef ENC28J60DEBUG
|
||||
Serial.println("ENC28J60::initialize / after readOp(ENC28J60_READ_CTRL_REG, ESTAT)");
|
||||
#endif
|
||||
|
|
|
@ -28,17 +28,12 @@
|
|||
#include <SPI.h>
|
||||
#include "mempool.h"
|
||||
|
||||
//#define ENC28J60_CONTROL_CS SS
|
||||
//#define SPI_MOSI MOSI
|
||||
//#define SPI_MISO MISO
|
||||
//#define SPI_SCK SCK
|
||||
//#define SPI_SS SS
|
||||
|
||||
#ifdef ARDUINO_STM32F4_NETDUINO2PLUS
|
||||
#define ENC28J60_CONTROL_CS PC8
|
||||
//#define SPI_MOSI PA7
|
||||
//#define SPI_MISO PA6
|
||||
//#define SPI_SCK PA5
|
||||
//#define SPI_SS PA8
|
||||
#else
|
||||
#define ENC28J60_CONTROL_CS SPI.nssPin()
|
||||
#endif
|
||||
|
||||
#define UIP_RECEIVEBUFFERHANDLE 0xff
|
||||
|
||||
|
|
Loading…
Reference in New Issue