cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 PHY driver for LAN8742 2s delay

JDosp.1
Associate III

Hi All,

Can somebody point me what is a reason for 2 sec delay at PHY driver for LAN8742?

I mean code below at function LAN8742_Init() inside file lan8742.c.

if(status == LAN8742_STATUS_OK)
{
  tickstart =  pObj->IO.GetTick();
     
  /* Wait for 2s to perform initialization */
  while((pObj->IO.GetTick() - tickstart) <= LAN8742_INIT_TO)
  {
  }
  pObj->Is_Initialized = 1;
}

I am working at project with STM32H735 and ThreadX+NetX Duo. As PHY I use KSZ8081RNA, but I found that same delay need be there as at LAN8742 driver. Without this delay Ethernet does not work. With 2 sec delay works auto-negotiation with 100MB switch, but not with 1GB switch. For 1GB switch need be there ~3 sec delay.

I am not sure what is going on here. I didn't found anything related to this delay at KSZ8081 datasheet, IEEE spec for auto-negotiation or at STM32H735 errata. I will be gland for any comment.

Thanks.

Regards,

Jan

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
15 REPLIES 15

Hi Geir,

What issue do you have with driver? With some minor tweaking is PHY driver and link control state machine perfectly fine and works well. With STM32H735@400MHz I have no issue to transfer 70Mbps continuously via http protocol. For tests I used KSZ8081RNA. Now I moving to DP83826. DP83826 have better performance at long cable (100m+).

I found only a few minor issues with NetX Duo. DHCPv6 client have a few bugs and there is issue with cypher suites for tls, especially when you want to have HTTPs server.

Regards,

Jan

GJord.4
Associate II

Hi,

The issue is the 2 seconds delay after initializing the driver. We are using RTOS with watchdog, so this will block the threads and make the watchdog expire. The init method should not just wait for nothing, it could return and let the user handle the linkstate separately, just like @Piranha​ suggested.

/Geir

Hi Geir,

That delay can be removed from PHY init without any issue. At your link state handling thread you need to call nx_ip_driver_direct_command(&ipInstance, NX_LINK_ENABLE, &status); when you detect link up state.

Jan

GJord.4
Associate II

Ok, thanks for the tip on the link state.

The problem with removing stuff from the driver, is that it will be reset when we recreate the files from CubeMX. We have to recreate the project several times during the development phase.

I will fix it manually for now, but ST should really update the driver for a permanent fix this.

/Geir

Hi @GJord.4​ ,

OK, the LAN BSP drivers are being fixed and the internal ticket number is 151568.

The fixe will be first deployed on STM32H7 then follow for the other series asap.

Sorry I can't provide an exact date for the moment since it depends on the overall maintenance plan of STM32H7.

Thank you for highlighting this point.

GJord.4
Associate II

Hi @MWB_CHa​ ,

That is good news! We will make a workaround for now, and look forward to getting your permanent fix for this.

/Geir