Skip to content

Commit a82c796

Browse files
committed
Merge branch 'master' into ext
2 parents 90bdd67 + c37970b commit a82c796

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

utility/Enc28J60Network.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ Enc28J60Network::receivePacket()
168168
// read the receive status (see datasheet page 43)
169169
rxstat = readOp(ENC28J60_READ_BUF_MEM, 0);
170170
//rxstat |= readOp(ENC28J60_READ_BUF_MEM, 0) << 8;
171+
#ifdef ENC28J60DEBUG
172+
Serial.print("receivePacket [");
173+
Serial.print(readPtr,HEX);
174+
Serial.print("-");
175+
Serial.print((readPtr+len) % (RXSTOP_INIT+1),HEX);
176+
Serial.print("], next: ");
177+
Serial.print(nextPacketPtr,HEX);
178+
Serial.print(", stat: ");
179+
Serial.print(rxstat,HEX);
180+
Serial.print(", count: ");
181+
Serial.print(readReg(EPKTCNT));
182+
Serial.print(" -> ");
183+
Serial.println((rxstat & 0x80)!=0 ? "OK" : "failed");
184+
#endif
171185
// decrement the packet counter indicate we are done with this packet
172186
writeOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PKTDEC);
173187
// check CRC and symbol errors (see datasheet page 44, table 7-3):
@@ -201,6 +215,8 @@ Enc28J60Network::blockSize(memhandle handle)
201215
void
202216
Enc28J60Network::sendPacket(memhandle handle)
203217
{
218+
if (handle == NOBLOCK)
219+
return;
204220
memblock *packet = &blocks[handle];
205221
uint16_t start = packet->begin-1;
206222
uint16_t end = start + packet->size;
@@ -215,10 +231,10 @@ Enc28J60Network::sendPacket(memhandle handle)
215231
Serial.print("sendPacket(");
216232
Serial.print(handle);
217233
Serial.print(") [");
218-
Serial.print(start);
234+
Serial.print(start,HEX);
219235
Serial.print("-");
220-
Serial.print(end);
221-
Serial.println("]:");
236+
Serial.print(end,HEX);
237+
Serial.print("]: ");
222238
for (uint16_t i=start; i<=end; i++)
223239
{
224240
Serial.print(readByte(i),HEX);

0 commit comments

Comments
 (0)