cancel
Showing results for 
Search instead for 
Did you mean: 

DP83822 instead of DP83848

xianrecords
Associate III

Has anyone written a driver for the DP83822 PHY ?

I have tried to use the DP83848 driver. I am able to pass the DP83848_Init(&DP83848); in the ethernetif.c but then when it comes to check the list status, then I get a link down status. The LEDs on my Ethernet port are not lit up.

 

/* Initialize the DP83848 ETH PHY */

DP83848_Init(&DP83848);

if (hal_eth_init_status == HAL_OK)

{

PHYLinkState = DP83848_GetLinkState(&DP83848);

/* Get link state */

if(PHYLinkState <= DP83848_STATUS_LINK_DOWN).  

{

netif_set_link_down(netif);  // => Goes there.....

netif_set_down(netif);

}

Also is there a way to add a custom PHY to CubeIDE ?

3 REPLIES 3
Pavel A.
Evangelist III

 is there a way to add a custom PHY to CubeIDE ?

Not directly, as by clicking in the menus. But can exclude the cube-generated .c file for the PHY from build and add your own .c file instead.

More help with your custom board and PHY can be found here.

Also note that calling netif_set_down when the link is down is not right in the current LwIP version. Instead, it has special API to set the link state. See the LwIP documentation.

xianrecords
Associate III

Thank you. I made a bit more progress. I did not have my 25Mhz clock working properly.

 

What do you mean by netif_set_down is not correct. This is what was generated automatically by the STMCUBEIDE.

I did not touch anything. 

LCE
Principal

At least "some details" of Cube ethernet generation are a little whacky.

In case of PHY drivers: simply compare the registers in the datasheets bit by bit, check the HAL driver which registers are used, modify the new driver accordingly.