Skip to content

The lwIP_enc28j60 driver does not handle Rx buffer overflow. #8123

Open
@pvrfr

Description

@pvrfr

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ENC28J60]
  • Core Version: [Master]
  • Development Env: [All]
  • Operating System: [All]

Problem Description

I hope that I have done this right!

There is an intermittent going deaf condition with the Ethernet interface
using the ENC28J60 module. I have done a lot of work on the ENC28J60 driver
as used in the OpenSprinkler project: https://github.com/OpenSprinkler.
I believe that the problem relates to the lack of a recovery mechanism for
a receive buffer overflow condition.

According the the spec in section 7.2.4, if there is insufficient space
in the receive buffer the RXERIF bit will be set in the EIR register.
Also the BUFER bit will be set in the ESTAT register. The chip stops receiving data in this Rx overflow state. This buffer overflow condition and these error
bits will not be cleared without deliberate action by the system. A soft
reset is required.

There is no code in the driver that checks for the Rx overflow condition.
The BUFER bit is not defined in the header file or the src file. The RXERIF
bit in the EIR register is also not defined. These bits must be checked on
every call to receive data.

When in a buffer overflow state, no new packets will be received and
the buffer will remain empty once the previous packet has been
transferred to the system. Thus, the Ethernet interface appears to
go deaf.

A buffer overflow can be a frequent occurrence in some conditions.
The ENC28J60 supports up to 1000Base-T Ethernet but can only communicate
with the system at SPI speeds up to 20 MHz. Since there is no on-chip
processing of packets (offload engine), all received data must be sent
to the system for handling. This can easily overload the SPI interface
and/or the system.

The simplest recovery is to call the ENC28J60::softreset() routine.
But a more elegant recovery mechanism is needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions