2018-03-26 03:54 AM
I have a Nucleo-H743ZI board that I'm running some ethernet code on, that I based on the LWIP example applications. The problem was that I could only ping it once on every reset. The problem went away when I disabled the cache, which lead me to an issue withlow_level_output.
As the memory is configured as cachable and the TX buffers now live in regular user memory the dcache must be flushed before calling
HAL_ETH_Transmit
, so my solution is to callSCB_CleanDCache_by_Addr
for every entry put into the Txbuffer:static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
uint32_t i=0, framelen = 0;
struct pbuf *q;
err_t errval = ERR_OK;
ETH_BufferTypeDef Txbuffer[ETH_TX_DESC_CNT];
memset(Txbuffer, 0 , 4*sizeof(ETH_BufferTypeDef));
for(q = p; q != NULL; q = q->next)
{
if(i >= ETH_TX_DESC_CNT)
return ERR_IF;
Txbuffer[i].buffer = q->payload;
Txbuffer[i].len = q->len;
framelen += q->len;
SCB_CleanDCache_by_Addr((uint32_t *)q->payload, q->len);
if(i>0)
{
Txbuffer[i-1].next = &Txbuffer[i];
}
i++;
}
TxConfig.Length = framelen;
TxConfig.TxBuffer = Txbuffer;
HAL_ETH_Transmit(&EthHandle, &TxConfig, 0);
return errval;
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
#dcache #lwip #dma #stm32h7 #bug-report
2018-04-04 12:24 AM
This only fixed part of the problem =/
2018-04-05 05:51 AM
Hi Sven.
I didn't know that the STM32H7 has a cache bug. I thought I just had to worry about putting the LwIP application running on the AXI-SRAM.
Ari.
2018-04-17 07:22 AM
Great job on spotting it! I'm tired working with Ethernet drivers provided by ST, there are always some bugs, even in sample code. Please fix it ST. I am trying to port my code from F7 to H7 which uses ethernet and I face difficulties. I started to work with the LWIP_HTTP_Server_Netconn_RTOS to check if ethernet works at all at this thing and applying your patch make the DHCP operational. After choosing static IP in the example I can't connect to the board anymore nor ping it. Anybody had the same problem? Or even better, a solution?