Microchip LAN9255

Introduction

This document describes the integration of the delivered EtherCAT example projects for Microchip LAN9255 target with the development environment MPLABX IDE.

Target System

The port EtherCAT stack was implemented and tested on the Microchip Board “EVB_LAN9255”.

EVB_LAN9255

Toolchain

  • Compiler/IDE: XC32 v1.42 / MPLABX IDE v6.05 (or newer)

  • Flash tool/Debugger: Microchip Pickit4

General information

The LAN9255 is a System on Chip solution. The EtherCAT Stack runs on the AT-SAM53x CPU which is internally connected to a Microchip LAN9253 EtherCAT® slave controller via the SPI interface.
Only this interface to the LAN9253 is implemented.
The interrupt lines IRQ and SYNC0 from the LAN9253 chip are internally connected with the
external interrupt lines (pins PB23, PB16) of the AT-SAM53x CPU.

The driver uses some modules of the LAN9255 Peripheral Library provided by Microchip.
The sources are taken from Microchip examples and are adapted as needed. They are already included in the following delivered package folder:

  • bsp/microchip/lan9255

You can find port’s EtherCAT example projects in the following folder of the delivery package:

  • examples/microchip_lan9255/

The package optionally supports a FreeRTOS implementation.
In order to activate this feature in the EtherCAT stack, the following project preprocessor defines are required:

  • EC_CONFIG_THREAD_SAFE

  • EC_CONFIG_USE_FREERTOS

Please see the following folders for a working FreeRTOS implementation:

  • examples/microchip_lan9255/s1_lan9255_freertos

  • examples/microchip_lan9255/s10_lan9255_isr_pdi_dc_freertos

These two examples were created with FreeRTOS support. All other examples are bare metal projects.

The FreeRTOS sources are not part of the delivery.
Please download the sources from FreeRTOS (https://www.freertos.org/index.html).

Open IDE projects

  1. open the project from the examples folder from within the MPLABX IDE:

Now you can build both projects.

2. Open the “Project Properties” and select the appropriate compiler toolchain and the connected debug Hardware Tool:

Now you can download and test the project.

ICC tool project

The sample projects are designed with port’s ICC tool. The HW configuration uses the LAN9255 CPU entry. Shown here for example s01:

Please install the ICC plugin for LAN9255 and use this setting also for your own customer projects.

Available sample applications

  • s01_lan9255:

    • SDO read and write

    • 2 RX-PDOs and 2 TX-PDOs

    • object dictionary containing objects of various data types

    • bare metal or FreeRTOS project version available

  • s03_lan9255:

    • SDO read and write

    • SDO Info service

    • SDO Info object names

    • 2 RX-PDOs and 2 TX-PDOs

    • Split SDO-Access

    • Split NMT-Control

    • object dictionary containing objects of various data types

  • s04_lan9255:

    • SDO read and write

    • SDO Info service

    • SDO Info object names

    • 2 RX-PDOs and 2 TX-PDOs

    • Split SDO-Access

    • Split NMT-Control

    • object dictionary containing objects of various data types

    • EoE service with rudimentary ARP and IGMP support (ping)

    • FoE service

  • s05_lan9255:

    • SDO read and write

    • SDO Info service

    • SDO Info object names

    • 2 RX-PDOs and 2 TX-PDOs

    • object dictionary containing objects of various data types

    • virtual objects

  • s07_lan9255:

    • SDO read and write

    • SDO Info service

    • SDO Info object names

    • 2 RX-PDOs and 2 TX-PDOs

    • object dictionary containing objects of various data types

    • FoE mailbox service

    • BOOTSTRAP NMT mode

  • s09_lan9255:

    • SDO read and write

    • 2 RX-PDOs and 2 TX-PDOs

    • object dictionary containing objects of various data types

    • dynamic PDO mapping with extension module usr_dynPdoMapping

  • s10_lan9255_xxx:

    • Interrupt handling

    • xxx = isr: PDI Events are handled in an ISR

    • xxx = isr_dc: PDI Events and DC Events are handled in separate ISRs

    • bare metal or FreeRTOS project version available

  • s11_lan9255_cia402

    • EtherCAT slave with CiA 402 profile example application