cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7S78-DK: Issues with ETH and LwIP

BartekTaczala
Associate

Hi,

I'm having a project that uses LTDC (565) UART4 (for printf debugging purposes) and ETH/LwIP. 

The issue i'm having is an infinite loop in `LAN8742_Init` : 

```

while(regvalue & LAN8742_BCR_SOFT_RESET)

```

always evalute to true and 

```

if((pObj->IO.GetTick() - tickstart) <= LAN8742_SW_RESET_TO)

``` 

evalutes to true as well (tickstart is 0 and pObj->IO.GetTick() also returns 0).

STM32CubeMX warns me about possible conflicts with PIN - but I don't think LTDC and UART/ETH are using the same pins. Ater enabling ETH CubeMX warned about Clock but autoresolver fixed the issue. 

3 REPLIES 3
Pavel A.
Super User

One of reasons can be failure of handshake with the PHY.

If you suspect conflict with other components, disable them and get the ETH working first.

tickstart is 0 and pObj->IO.GetTick() also returns 0).

Maybe the PHY setup is broken too. Replace this to HAL_GetTick(). If HAL_GetTick keeps returning 0, the tick timer is broken. Too bad.

 

 

EXUE.2
ST Employee

it looks like the ETH phy communication is failed, below is my ETH initial code on STM32H7S3:

const u8 ETH_HEADER_PACKET[] =
{
0x05, 0x04, 0x03, 0x02, 0x01, 0x00, // Destination Address, 6 bytes
// 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, //
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // Source Address, 6 bytes, ETH_MAC_ADDR0~5
0x00, 0x04 // Length/type, 2 bytes
};

uint32_t idx, duplex, speed = 0;

ETH_MACConfigTypeDef MACConf;
ETH_MACFilterConfigTypeDef FilterConfig;
uint8_t macaddress[6]= {ETH_MAC_ADDR0, ETH_MAC_ADDR1, ETH_MAC_ADDR2, ETH_MAC_ADDR3, ETH_MAC_ADDR4, ETH_MAC_ADDR5};

EthHandle.Instance = ETH;
EthHandle.Init.MACAddr = macaddress;
EthHandle.Init.MediaInterface = HAL_ETH_RMII_MODE;
EthHandle.Init.RxDesc = DMARxDscrTab;
EthHandle.Init.TxDesc = DMATxDscrTab;
EthHandle.Init.RxBuffLen = ETH_RX_BUFFER_SIZE;

/* configure ethernet peripheral (GPIOs, clocks, MAC, DMA) */
HAL_ETH_Init(&EthHandle);

for(idx = 0; idx < ETH_RX_DESC_CNT; idx ++)
{
HAL_ETH_DescAssignMemory(&EthHandle, idx, Rx_Buff[idx], NULL);
}

memset(&TxConfig, 0 , sizeof(ETH_TxPacketConfig));
TxConfig.Attributes = ETH_TX_PACKETS_FEATURES_CSUM | ETH_TX_PACKETS_FEATURES_CRCPAD;
TxConfig.ChecksumCtrl = ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC;
TxConfig.CRCPadCtrl = ETH_CRC_PAD_INSERT;

/* Set PHY IO functions */
LAN8742_RegisterBusIO(&LAN8742, &LAN8742_IOCtx);

/* Initialize the LAN8742 ETH PHY */
if(LAN8742_Init(&LAN8742)!= LAN8742_STATUS_OK)

{

Error_Handler();

}

Pavel A.
Super User

Well, then debug LAN8742_Init ?