Skip to content

Commit f7aca62

Browse files
author
Rami Elkhatib
committed
MPS2 CM3DS ethernet fix packet bug
The function smsc9220_receive_by_chunks loads data from the Ethernet port. It is expected to return the Ethernet frame without the 4 CRC bytes. However, it is required to call the Ethernet data port register (32-bit) an amount equal to the number of frame words (including the 4 CRC bytes) to pop all frame words. The current code doesn't call the register for the last word (which has CRC data). This causes subsequent calls to have this missed word at the beginning. The impact of this is huge as the high level API is getting fed wrong data. The fix adds one additional call to the data port register.
1 parent cbfda0e commit f7aca62

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/drivers/smsc9220_eth_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,7 @@ uint32_t smsc9220_receive_by_chunks(const struct smsc9220_eth_dev_t* dev,
10601060
}
10611061

10621062
empty_rx_fifo(dev, (uint8_t *)data, packet_length_byte);
1063+
(void) (register_map->rx_data_port); /* Discard last word (CRC) */
10631064
dev->data->current_rx_size_words = 0;
10641065
return packet_length_byte;
10651066
}

0 commit comments

Comments
 (0)