2022-06-20 04:13 AM
Hello everyone,
Now I am trying to test the Ethernet on our custom board with STM32F765 and MAX24287 via MII mode. Firstly I configure to test the transmit receive raw data with diagnostic loopback mode. From oscilloscope I saw the the data output from TX[0..3], TX_EN, RX[0..3]. RX_DV and all of them are correct with my test setup data. So this is sure that there are data signals come to RX pins of STM32. However, from SW side, I can not read the received data.
In main function:
"
char message[64] = {0};
struct pbuf *p_tx = NULL;
for(int i=0; i<64; i+=8)
{
message[i+0] = 0x01;
message[i+1] = 0x23;
message[i+2] = 0x45;
message[i+3] = 0x67;
message[i+4] = 0x89;
message[i+5] = 0xab;
message[i+6] = 0xcd;
message[i+7] = 0xef;
}
p_rx = pbuf_alloc(PBUF_RAW, sizeof(message), PBUF_RAM);
while (1)
{
HAL_Delay(1);
p_tx = pbuf_alloc(PBUF_TRANSPORT, sizeof(message), PBUF_RAM);
if(p_tx != NULL)
{
memcpy(p_tx->payload, message, sizeof(message));
gnetif.linkoutput(&gnetif, p_tx);
pbuf_free(p_tx);
}
ethernetif_input(&gnetif);
sys_check_timeouts();
}
}
"
In "ethernetif_input" I made a break point to toggle and copy the receive data:
"
void ethernetif_input(struct netif *netif)
{
err_t err;
struct pbuf *p;
/* move received packet into a new pbuf */
p = low_level_input(netif);
/* no packet could be read, silently ignore this */
if (p == NULL) return;
/* entry point to the LwIP stack */
err = netif->input(p, netif);
// copy out the receive data
memcpy(message_recv, p->payload, p->len);
if (err != ERR_OK)
{
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
pbuf_free(p);
p = NULL;
}
}
"
However the receive data is always not correct. Further more, receive packet come just only first 2 times in debuggind mode, the 3rd time the receive packet is NULL becasue the (heth->RxDesc->Status & ETH_DMARXDESC_OWN) is not reset.
Any one have idea about this and the correct way that can I read out the receive data.
Thanks.
2023-01-04 02:26 AM
Hi,
Thank you for sharing your problem,
and sorry for the delayed answer;
Could you please provide the status of the ETH_DMASR register to have an idea about the application status such as reception, transmission, interrupt summary..
Regards
Mahdy
2024-06-24 02:22 PM
I'm having similar issue.
When I'm configuring ETH interface in STMCubeMX I'm getting a warning message that ETH will not work if RAM is not pointing to 0x24000000. But I don't see any field where to set the correct address.