Skip to main content
bully
Senior
February 13, 2021
Question

How to integrate/use CMSIS driver for custom ETH PHY KSZ8061RNB under FreeRTOS & LwIP ?

  • February 13, 2021
  • 4 replies
  • 2955 views

Hello,

i have custom board with STM32F779 and custom Ethernet PHY KSZ8061RNB.

I'm using CubeMX and only 2 PHYS are supported. I haven't found any documentation how to

do configuration with custom PHY device.

I have found CMSIS driver for  KSZ8061RNB, but it doesn't look like it could be easily integrated. Also ETH initialization code is integrated under LwIP and I have no clue how to change lower level of initialization or to switch it off completely and do initialization in custom code...

Any help would be appreciated,

thanks in advance,

regards,

Rob.

This topic has been closed for replies.

4 replies

Pavel A.
Super User
February 14, 2021

> I have found CMSIS driver for KSZ8061RNB, but it doesn't look like it could be easily integrated. 

Have you found this driver?

The ETH of STM32 provides the interface to the 16-bit PHY registers, it should work with your PHY in the same way as in the ST examples.

IMHO the first step would be understanding why your board has KSZ8061RNB rather than anything else?

Does your product require specific features of this chip? (low power states, special signal tweaking, diagnostics ...) that you need to access in software.

Otherwise (most likely) - just study how the ST examples deal with PHY and transplant that to the ARM's driver.

It should take a day or two at most.

If this still looks too hard or time consuming, look for somebody else to help (a.k.a. hire a consultant).

-- pa

bully
bullyAuthor
Senior
February 14, 2021

Hello,

thanks for informations... I've tried to go by defining Custom PHY Device. In this way, result will be useful also to other users.

I've checked the registers and they are much similar to those for supported PHYs. But still it isn't working...

It timeouts on SW reset - I guess that means that it is not working.

Not sure if related, but do have a question regarding reference clock.

In Ref. Manual for STM32F7xxx it says that reference clock source should be transferred to both MAC and PHY devices.

In Datasheet for my PHY it says that it generates ref. clock for MAC.

Do I have to do anything else beside default definitions in RMII interface ( I guess it is already defined as input) ?

Thanks in advance,

regards,

Rob.

Piranha
Principal III
February 17, 2021

There is no separate PHY driver in ST's code.

https://github.com/STMicroelectronics/STM32CubeF7/blob/08376dce1b404687e4a86b73077f396bccfc9cb5/Projects/STM32F767ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS/Inc/stm32f7xx_hal_conf.h#L242

The only things you need to modify are PHY_SR, PHY_SPEED_STATUS, PHY_DUPLEX_STATUS values. Adapt those to your PHY's register 1Eh bits 0 and 2.

That said, it will still not make the broken bloatware working:

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

P.S. The typical PHY connections and clocks are shown in datasheet figure 3-2.

IOvch
Associate II
April 29, 2022

Hello! Is any success on this way? Maybe you have find some tutorial?

VBOTO.1
Visitor II
April 7, 2023

Hello I'm dealing with the same issue. Has ST published a specification to explain how user can develop his own BSP driver component?.

I'm using stm32h753zi with ksz8041nl as phy interface.