Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

LAN8651 10BASE-T1S MACPHY Integration Guide for LAN9662 PCB8291 (UNG8291)

Overview

This guide describes the exact steps for integrating the Microchip LAN8651 10BASE-T1S MACPHY Ethernet Controller on the LAN9662 PCB8291 Evaluation Board (UNG8291). The LAN8651 is connected via a Raspberry Pi Hat-compatible connector to the PIN header of the LAN9662.

Hardware Setup

Required Hardware

  • LAN9662 PCB8291 Evaluation Board (UNG8291/EVB-LAN9662-EndNode)
  • Raspberry Pi Hat Adapter (MIKROE-1513)
  • LAN8651 PHY Module (MIKROE-5543)

Hardware Connection

  1. Mount the Raspberry Pi Hat Adapter on the 40-pin GPIO header of the LAN9662 PCB8291
  2. Insert the LAN8651 PHY module onto the Raspberry Pi Hat Adapter
  3. Connect the Ethernet cable to the LAN8651 connector

Software Configuration

1. Buildroot Configuration Files

1.1 Device Tree Configuration

File: external/configs/arm_standalone_defconfig

Ensure the following Device Tree names and overlay support are activated:

BR2_LINUX_KERNEL_INTREE_DTS_NAME="... microchip/lan966x-pcb8291 ..."
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y

Used Device Tree Files:

  • Base-DTS: microchip/lan966x-pcb8291.dtb → configured as lan9662_ung8291_0_at_lan966x
  • LAN8651 Overlay: overlays/lan966x_pcb8291_lan8651.dtbo → configured as lan9662_ung8291_lan8651_0_at_lan966x

1.2 Kernel Configuration

Kernel Features to Activate:

# Microchip PHY Support
CONFIG_MICROCHIP_PHY=y

# 10BASE-T1S Support  
CONFIG_NET_DSA=y
CONFIG_NET_DSA_MSCC_FELIX=y

# SPI Interface (if connected via SPI bus)
CONFIG_SPI_MASTER=y
CONFIG_SPI_SPIDEV=y

# Ethernet Subsystem
CONFIG_NETDEVICES=y
CONFIG_ETHERNET=y
CONFIG_PHYLIB=y

2. Board-Specific Configuration

2.1 Post-Image Script

File: board/lan966x/post-image.sh

The LAN8651 Device Tree Overlay is already automatically included in the build process:

-a $BINARIES_DIR/overlays/lan966x_pcb8291_lan8651.dtbo,lan9662_ung8291_lan8651_0_at_lan966x

2.2 Board Configuration

File: external/configs/arm_standalone_defconfig

# Post-Image Script
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/lan966x/post-image.sh"

# Microchip Utilities
BR2_PACKAGE_MSCC_CML_UTILS_LAN966X=y

3. U-Boot Configuration

3.1 Device Tree Overlay Activation

Most Important Step: Setting the PCB environment variable in U-Boot:

# In the U-Boot console or in the persistent environment:
setenv pcb "lan9662_ung8291_0_at_lan966x#lan9662_ung8291_lan8651_0_at_lan966x"
saveenv

PCB String Syntax Explanation:

  • lan9662_ung8291_0_at_lan966x: Base Device Tree for LAN9662 PCB8291
  • #: Separator for overlays
  • lan9662_ung8291_lan8651_0_at_lan966x: LAN8651 Device Tree Overlay

Why is the U-Boot configuration necessary?

The LAN966x system uses a dynamic hardware detection system:

  1. Device Tree Overlay System: The system uses modular Device Trees - a base-DT for the basic board and specific overlays for additional hardware like the LAN8651.

  2. Runtime Hardware Variants: The PCB8291 board can have various hardware configurations. U-Boot must decide at boot time which overlays to load, since the kernel needs this information before hardware initialization.

  3. Hardware Abstraction Layer: U-Boot functions as a hardware abstraction layer and:

    • Recognizes the hardware configuration via PCB variable
    • Loads the corresponding Device Tree overlays
    • Passes the correct hardware description to the Linux kernel
  4. Without U-Boot Configuration: The kernel boots only with the base Device Tree, causing the LAN8651 hardware not to be recognized and no additional Ethernet interface to be created.

Alternative methods are not practical:

  • Static Compilation: Would include all possible overlays (resource waste)
  • Kernel Runtime Loading: Too late, since hardware initialization already begins at kernel start
  • Auto-Detection: LAN8651 cannot be automatically detected (no Plug&Play ID)

3.2 Alternative: Direct Boot Arguments

If the PCB variable doesn't work, you can load the overlay directly via boot arguments:

setenv bootargs "fdtoverlays=lan966x_pcb8291_lan8651.dtbo"

4. Build Process

4.1 Buildroot Configuration

# Configuration for LAN966x standalone
make arm_standalone_defconfig

# Optional: Menuconfig for further customizations
make menuconfig

# Execute build  
make

4.2 Important Build Outputs

After successful build, you will find the following files in output/images/:

lan966x-pcb8291.dtb                    # Base Device Tree
overlays/lan966x_pcb8291_lan8651.dtbo  # LAN8651 Overlay
fit.itb                                # FIT Image with all Device Trees and Overlays

5. Installation and Boot

5.1 Image Installation

Flash the generated image according to the standard LAN9662 documentation:

# For NOR Flash Boot
dd if=output/images/fit.itb of=/dev/sdX bs=1M

# Or for NFS/TFTP Boot
cp output/images/fit.itb /tftpboot/

5.2 Boot Process Verification

In the U-Boot Console:

# Check PCB variable
printenv pcb

# Should output:
# pcb=lan9662_ung8291_0_at_lan966x#lan9662_ung8291_lan8651_0_at_lan966x

# Continue boot
boot

After Linux Boot - Verification:

# Check network interfaces
ip link show

# Should additionally show a new Ethernet interface for LAN8651
# e.g. eth1 or lan966x-1

# Check Device Tree overlay
ls /proc/device-tree/

# Check kernel messages  
dmesg | grep -i lan8651
dmesg | grep -i phy

6. Expected Output

After successful boot, you should see the following outputs:

# ip link show (Example)
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff  
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN  
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

# dmesg Output (Example)
[ 2.345678] lan966x-switch 60000000.switch: Adding to iommu group 0
[ 2.456789] LAN8651 10BASE-T1S PHY detected
[ 2.567890] lan966x-1: PHY [xxx] driver [LAN8651] (irq=POLL)

Troubleshooting

1. Device Tree Overlay is not loaded

Problem Diagnosis:

# Check U-Boot PCB variable
printenv pcb

# If empty or wrong:
setenv pcb "lan9662_ung8291_0_at_lan966x#lan9662_ung8291_lan8651_0_at_lan966x"
saveenv
reset

2. LAN8651 PHY is not recognized

Possible Causes:

  • Check hardware connection
  • Verify SPI/I2C configuration
  • Check PHY address mapping in Device Tree

Diagnostic Commands:

# Check PHY status
cat /sys/class/net/eth*/phy*/uevent

# Test hardware connection  
i2cdetect -y 0  # or corresponding I2C bus number

3. Network Interface is not created

Check Steps:

  1. Verify kernel configuration (CONFIG_MICROCHIP_PHY=y)
  2. Validate Device Tree overlay syntax
  3. Check hardware strapping pins on LAN8651

4. Build Errors

Common Problems:

# Device Tree Compiler Error
# → Check overlay syntax in Device Tree

# Missing Overlay File
# → Clear BitBake cache: make clean && make

# Kernel Config Inconsistencies  
# → Regenerate kernel defconfig

Additional Configuration Options

1. SPI Interface Configuration (optional)

If additional SPI devices should be configured on Flexcom2 SPI:

# Extend U-Boot PCB variable for SPI:
setenv pcb "lan9662_ung8291_0_at_lan966x#lan966x_pcb8291_fc2_spi_0_at_lan966x#lan9662_ung8291_lan8651_0_at_lan966x"

2. Custom Device Tree Customizations

File: BR2_LINUX_KERNEL_CUSTOM_DTS_PATH

For custom Device Tree customizations, you can add custom DTS files and include them via:

BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/path/to/custom/dts/files"

3. Advanced Network Configuration

Network Manager for 10BASE-T1S:

# Static IP configuration
ip addr add 192.168.1.100/24 dev eth1
ip link set eth1 up

# DHCP Client (if available)
dhclient eth1

References

Support

Microchip Support Channels:

Version Notes

  • BSP Version: 2025.12
  • Kernel Version: According to BSP version
  • U-Boot Version: According to BSP version
  • Compatible Hardware: LAN9662 PCB8291 (UNG8291), LAN8651 PHY Module

About

Step-by-step guide to integrating the LAN8651 10BASE-T1S MAC-PHY on the LAN9662 PCB8291 (UNG8291): kernel config, device-tree overlay, the U-Boot pcb variable and troubleshooting.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors