Showing results for 
Search instead for 
Did you mean: 

STM32-H7 driver for LAN8670 external phy

Associate II

Hi, I'm working on project, and as a part of it I need to establish an Ethernet connection between the 2 devices.    The device is powered by STM32H7 MCU which is connected to Microchip LAN8670 PHY (10BaseT-1s). 

On the other side there is or another device, or the LAN8670 bases EVB LAN8670-USB dongle. 

from the EV side, Microchip provides driver for windows, and the dongle seems working.

But from the PCB side it's more complicated - there is no driver for this PHY. 

As I understand, all the STM boards with ethernet have the same LAN8742 PHY, and HAL ETH drivers (also LwIP), are based on BSP driver LAN8742 (from ST or Microchip, both have it in their GitHub repositories).

But the only 2 drivers I could find for LAN8670 are the Microchip Harmony driver for their MCUs (see their GitHub), and the oryx driver for cyclone TCP stack.

So the only way I see, if someone hasn't did it yet, is to port those drivers to the STM base (which is no so straight, the drivers are very different).

Besides the drivers, the STM32H7 family can't even establish proper ethernet connection out of the box with is own PHY (using nucleo board) - need to redirect the memory, as shown in the example.  So even if to port the basic BSP driver, I'm now sure it will work properly. 

Any thoughts about it? How can I use this PHY with STM32 MCU ? 





Pavel A.
Evangelist III

The LAN8670-USB EVB dongle has a device USB connector on one end and screw terminals for 10BaseT-1s wires on another end. This thing is not intended to connect directly to a STM32. You need some other PHY  between it and STM32. STM32 can connect to either RMII or MII type PHY.


I have LAN8670 on the PCB which is connected from one side to the MAC (on the MCU) with RMII,

and on the other side, using twisted pair, to the LAN8670-USB EVB, that is connected to the PC. 


Chief II

For the typical PHYs one just has to port the register and bit locations for auto-negotiation speed and duplex status. This PHY doesn't have an auto-negotiation, because 10BASE-T1S is the only mode it supports. So what exactly do you want to "port" there?

You have to set the MAC to 10 Mbps half-duplex mode and do not use auto-negotiation. 

Associate II

Several updated here, it still not working.

As I understood, the standard LAN8742 driver in doing nothing but reads the PHY status and resets it, so there no real initiation, for the LAN8670 several register setting are required. 

@Piranha both LAN8742 and LAN8670 have the same address of the reset bit and the status bit SMR, 

so using the standard init function I am reading the proper values from the SMR register.

Auto negotiation is disabled, and during the initiation, the LAN8742_GetLinkState returns the proper value of LAN8742_STATUS_10MBITS_HALFDUPLEX.

the LAN8670 requires specific settings of MMD registers, different for each version of silicon. 

I have the B1 version, so there are 12 registers to set. I used the code from the Oryx driver (also check it with linux driver) to read\write to those MMD registers. 

So the only change I did was setting of those registers, and reading all the status registers to ensure connection with the PHY, and still I cant ping the device from the PC dongle, or to receive data from another PCB.

I have 2 of those dongles, and between them ping do works (only when PLCA is disabled).

The interesting point also is that when I'm sending UDP data from the PCB I see the signal on the scope, also I see RXDV and TXEN signals triggered.
But there is no MAC callbacks raised, all of the time the HAL_ETH_ReadData func returns no data.

I assume that the problem is somewhere around RMII, from one of the sides, but I have no clue how to check or test it. 

Attach the additions to the standard PHY driver. 

Any thoughts?