Receive packets and read routine ENC28J60

Thread Starter

Samyukta Ramnath

Joined May 21, 2015
16
I am using an ENC28J60 Rev 7 (REVID = 0x06) with a TI CC1352P microcontroller. Trying to transmit and receive ethernet packets between the MCU and my computer. I was able to transmit packets from my MCU and see them in Wireshark, I could see the content of the message correctly.
I am doing a 'loopback' where I set both the source and destination MAC address to be that of my ENC28J60 module. That means I expect to receive whatever I sent.
I had a question about receiving packets - It says that the receive packet format has the first two bytes as the next Packet Pointer which points to the address of the next packet. That would seem to indicate that to read each packet, I should perform an RBM operation starting at the address pointed to by the next packet pointer - meaning I should first read the first two bytes of the receive packet, and then perform an RBM at that address.
However, how do I read the receive packet? My thoughts were to read the ERDPT location and perform a RBM at that location. I am not sure if this is valid though, and I'm not getting the packet that I sent by doing this. I performed an RBM operation starting at ERDPT, and read the first two bytes as the next packet pointer, the next four packets after that being the status bytes of the receive operation, and the next 2 bytes after that being the length of the received message, and everything after that being the received payload. If I were sending more packets, I would perform subsequent RBM operations starting at the address pointed to by the next packet pointer, and the ERDPT would update automatically?
I also tried setting the receive buffer space from 0 to 0xbff, and starting to read from 0 - i.e. for the first packet, setting getNextPacket pointer to address 0x0, and then writing to ERDPT the address of getNextPacket pointer. Then, once I read the first two bytes which should point to the address of the next packet, I update getNextPacket pointer and write to ERDPT once again for the next packet. This does not give me valid information either although EPKTCNT does increase (it does not increment by 1 like I expect but is some arbitrarily high number although I am just sending one packet of information).
Let me know if what I'm doing is correct or makes sense. I feel like I'm doing something wrong here. Missing a few pieces of information.
 
Top