1.2.5.4.1 Abstraction Model

The ENCx24J600 Driver library has several different layers to it, as illustrated in the following figure. The interface layer has two main sections that are used the most often: The Tasks function, and the TCP/IP Send and Receive functions.

The Tasks function manages the internal state machine which detects, resets, and then configures the ENCx24J600 External MAC. It also handles the monitoring of the hardware status, sending and receiving packets.

The TCP/IP Send and Receive functions interact with the RAM-based queue of packets that are queued to send and packets that have been queued waiting for pick-up by the stack.

The main state machine does not interface directly to the SPI bus, but instead, interfaces to a virtual bus abstraction layer that allows for the replacement of the specific underlying bus implementation.

Configuring the SPI Driver

The ENC hardware requires a specific configuration of the SPI driver to work correctly. Inside the MHC SPI Driver configuration be sure to select:

  • SPI clock rate of 14000000 or less. With a PB clock of 80 MHz, 13333333 is the clock rate.

  • Clock mode of DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL

  • Input phase of SPI_INPUT_SAMPLING_PHASE_AT_END

Recommended Settings:

  • Interrupt Driver mode

  • Enhanced Buffer mode

  • DMA mode enabled:

    • DMA block transfer size of at least 1600 bytes

    • Size of DMA buffer for dummy data of at least 1600 bytes

    • Ensure when setting up DMA in interrupt mode that the DMA interrupts are a higher priority than the SPI Driver interrupt