buffer = rxFrame->rxBuffArray[i].buffer; // corrupted
bufferLength = rxFrame->rxBuffArray[i].length; // corrupted
len += bufferLength;
/* Find pbuf wrapper for the actually read byte buffer */
idx = ((rx_buffer_t *)(((uint8_t *)buffer) - ETH_PAD_SIZE)) - ethernetif->RxDataBuff;
LWIP_ASSERT("Buffer returned by ENET_GetRxFrame() doesn't match any RX buffer descriptor",
((idx >= 0) && (idx < ENET_RXBUFF_NUM)));- idx = 1953659110- bufferLenght = 65535 (or -1)
/* Get the valid frame */
index = 0;
do
{
rxDesc = &rxBdRing->rxBdBase[rxBdRing->rxGenIdx];
/* Calculate the buffer and frame length. */
if ((rxDesc->rdes3 & ENET_RXDESCRIP_WR_LD_MASK) != 0U)
{
isLastBuff = true;
rxFrame->totLen = (uint16_t)(rxDesc->rdes3 & ENET_RXDESCRIP_WR_PACKETLEN_MASK);
if (rxFrame->totLen - offset > (uint16_t)rxBdRing->rxBuffSizeAlign)
{
buff1Len = (uint16_t)rxBdRing->rxBuffSizeAlign;
if (handle->doubleBuffEnable)
{
buff2Len = rxFrame->totLen - offset - (uint16_t)rxBdRing->rxBuffSizeAlign - ENET_FCS_LEN;
}
}
else
{
buff1Len = rxFrame->totLen - offset - ENET_FCS_LEN;
}
rxFrame->totLen -= ENET_FCS_LEN;
}
else
{
if (!handle->doubleBuffEnable)
{
buff1Len = (uint16_t)rxBdRing->rxBuffSizeAlign;
offset += buff1Len;
}
else
{
buff1Len = (uint16_t)rxBdRing->rxBuffSizeAlign;
buff2Len = (uint16_t)rxBdRing->rxBuffSizeAlign;
offset += buff1Len + buff2Len;
}
}
// <-- Check data here (assert on invalid buff1Len)
/* Allocate new buffer to replace the buffer taken by application */
if (!isDrop)
{
/* Get the frame data information into Rx frame structure. */
/* Give new buffer from application to BD */
}
else
{
/* Drop frame if there's no new buffer memory */
}
} while (!isLastBuff);- buff1Len = 65534 (or -2)- rxDesc->rdes3 & ENET_RXDESCRIP_WR_LD_MASK = 1522- rxFrame->totLen = 1518- offset = 1520
Hi @lucas3
"I wasn't able to compile with the enet/ driver, because I'm missing some definitions which are only available for iMX plateforms. Is there a chance I could use this driver for LPC546 ?"
You cannot directly switch to drivers/nets/(i.MX series universal drivers)
This driver is designed for i.MX, not LPC, and cannot be used immediately.
Base on your description.
The freeze is triggered only by VLAN‑tagged frames (~1522 bytes on the wire) coming from another VLAN. The current lpc_enet RX path assumes 1518‑byte frames;
when a 1522‑byte frame arrives, the RX length/offset computation underflows (e.g., buff1Len = -2) and corrupts the RX frame structure, which then trips the LWIP_ASSERT.
Harry_Zhang_0-1770366880148.png
So i think you can try to change the ENET_RXBUFF_SIZE to 1522.
BR
Harry