Skip to content

Commit 6b6c92a

Browse files
committed
Merge branch 'master' into Arduino_1.5.5
2 parents 7459fdf + c37970b commit 6b6c92a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

UIPEthernet/src/utility/Enc28J60Network.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@ Enc28J60Network::receivePacket()
196196
// read the receive status (see datasheet page 43)
197197
rxstat = readOp(ENC28J60_READ_BUF_MEM, 0);
198198
//rxstat |= readOp(ENC28J60_READ_BUF_MEM, 0) << 8;
199+
#ifdef ENC28J60DEBUG
200+
Serial.print("receivePacket [");
201+
Serial.print(readPtr,HEX);
202+
Serial.print("-");
203+
Serial.print((readPtr+len) % (RXSTOP_INIT+1),HEX);
204+
Serial.print("], next: ");
205+
Serial.print(nextPacketPtr,HEX);
206+
Serial.print(", stat: ");
207+
Serial.print(rxstat,HEX);
208+
Serial.print(", count: ");
209+
Serial.print(readReg(EPKTCNT));
210+
Serial.print(" -> ");
211+
Serial.println((rxstat & 0x80)!=0 ? "OK" : "failed");
212+
#endif
199213
// decrement the packet counter indicate we are done with this packet
200214
writeOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PKTDEC);
201215
// check CRC and symbol errors (see datasheet page 44, table 7-3):
@@ -229,6 +243,8 @@ Enc28J60Network::blockSize(memhandle handle)
229243
void
230244
Enc28J60Network::sendPacket(memhandle handle)
231245
{
246+
if (handle == NOBLOCK)
247+
return;
232248
memblock *packet = &blocks[handle];
233249
uint16_t start = packet->begin-1;
234250
uint16_t end = start + packet->size;
@@ -243,10 +259,10 @@ Enc28J60Network::sendPacket(memhandle handle)
243259
Serial.print("sendPacket(");
244260
Serial.print(handle);
245261
Serial.print(") [");
246-
Serial.print(start);
262+
Serial.print(start,HEX);
247263
Serial.print("-");
248-
Serial.print(end);
249-
Serial.println("]:");
264+
Serial.print(end,HEX);
265+
Serial.print("]: ");
250266
for (uint16_t i=start; i<=end; i++)
251267
{
252268
Serial.print(readByte(i),HEX);

0 commit comments

Comments
 (0)