Networking-for-Arduino / EthernetENC

Ethernet library for ENC28J60. This is a modern version of the UIPEthernet library. EthernetENC library is compatible with all Arduino architectures with Arduino SPI library with transactions support. Only include EthernetENC.h instead of Ethernet.h
135 stars 30 forks source link

receive packet failed error. #29

Open fatihbasaris opened 2 years ago

fatihbasaris commented 2 years ago

Hi everyone. I am using atmega2560+enc28j60+rc522 rfid reader in my project. Last days, i'm struggling an interesting problem. Sometimes everything is working well but sometimes i am getting an error.

01:31:36.580 -> receivePacket [6-23C], next: 3A3A, stat: 3A, count: 25 -> failed 01:31:36.580 -> sendPacket(1) [801-93E]: 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 38 3A 3A 3A 3A 2 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 1A 3A 3A 3A 3A 3A 1A 3A 3A A 3A 3A 3A 3A 3A 3A 3A 3A 3A 38 2 3A 3A 3A 3A 3A 3A 3A 3A 3A A 3A 3A 3A 3A 0 3A 3A 3A 3A 3A 3A 3A 3A 3A 38 38 3A 3A 3A 3A 3A 38 3A 3A 3A 3A 3A 20 20 3A 3A 3A 3A 3A 3A 32 3A 3A 38 3A 3A 12 3A 3A 3A 3A 3A 12 3A 3A 2A 3A 3A 32 3A 3A 3A 3A 3A A 3A 3A 3A 3A 2 3A 3A 3A 3A 3A 3A 3A 3A 3A 12 2A 3A 3A 3A 3A 32 2 3A 3A 3A 3A 2 3A 3A 3A 1A 3A 3A 3A 3A 3A 0 3A 3A 3A 3A 10 3A 3A 3A 3A 3A 12 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 8 3A 3A 3A 3A 3A 10 3A 3A 3A 3A 3A 3A 18 3A 3A 3A 3A 3A 3A 22 3A 3A 3A 3A 20 20 3A 3A 3A 3A 3A 0 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 2 3A 3A 3A 3A 12 3A 3A 3A 3A 3A 20 3A 3A 3A 3A 3A 8 3A 3A 3A 10 1A 3A 3A 3A 3A 30 3A 3A 3A 3A 3A 3A 12 3A 3A 3A 3A 3A 32 22 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 38 32 3A 3A 3A 3A 38 3A 3A 3A 3A 3A 3A 12 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 3A 28 32 3A 3A 3A 3A 3A 01:31:36.580 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 25 -> failed 01:31:36.625 -> receivePacket [3240-476], next: 1A38, stat: 3A, count: 25 -> failed 01:31:36.666 -> receivePacket [123E-472], next: 3A3A, stat: 3A, count: 25 -> failed 01:31:36.749 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 25 -> failed 01:31:36.790 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 17 -> failed 01:31:36.832 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 9 -> failed 01:31:36.878 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 25 -> failed 01:31:36.967 -> receivePacket [3240-476], next: 3A3A, stat: 3A, count: 25 -> failed

I changed a line in Enc28J60Network.cpp. I added |ERXFCON_BCEN but nothing change.

//writeReg(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN); writeReg(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN|ERXFCON_BCEN);

How can it possible? one working one not working. I am pulling my hair.

Jandrassy, i need your help? maybe you can say something what is wrong in my project?

JAndrassy commented 2 years ago

ERXFCON_BCEN is UDP broadcast receive filter. it filters packets in the ENC saving space in the receive buffer. It would never cause the kind of error you have. your problem must be in wiring or other hardware error. are the CS pins working correctly. and many times I see on forums people using the software SPI of Adafruit rc622 library on hw SPI pins.