@@ -196,6 +196,20 @@ Enc28J60Network::receivePacket()
196
196
// read the receive status (see datasheet page 43)
197
197
rxstat = readOp (ENC28J60_READ_BUF_MEM, 0 );
198
198
// 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
199
213
// decrement the packet counter indicate we are done with this packet
200
214
writeOp (ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PKTDEC);
201
215
// check CRC and symbol errors (see datasheet page 44, table 7-3):
@@ -229,6 +243,8 @@ Enc28J60Network::blockSize(memhandle handle)
229
243
void
230
244
Enc28J60Network::sendPacket (memhandle handle)
231
245
{
246
+ if (handle == NOBLOCK)
247
+ return ;
232
248
memblock *packet = &blocks[handle];
233
249
uint16_t start = packet->begin -1 ;
234
250
uint16_t end = start + packet->size ;
@@ -243,10 +259,10 @@ Enc28J60Network::sendPacket(memhandle handle)
243
259
Serial.print (" sendPacket(" );
244
260
Serial.print (handle);
245
261
Serial.print (" ) [" );
246
- Serial.print (start);
262
+ Serial.print (start,HEX );
247
263
Serial.print (" -" );
248
- Serial.print (end);
249
- Serial.println (" ]:" );
264
+ Serial.print (end,HEX );
265
+ Serial.print (" ]: " );
250
266
for (uint16_t i=start; i<=end; i++)
251
267
{
252
268
Serial.print (readByte (i),HEX);
0 commit comments