Question
Data Corruption when Simultaneous Transferring Data from SD Card and via ETH
Posted on June 29, 2015 at 15:22
Hello
We have a custom board with a STM32F429ZG MCU and CubeMX 4.7 FW Lib 1.5 generated libraries. The board is a redesign of a board a STM32F103ZG MCU with Wiznet W5300 Ethernet Coprocessor. The old FW is based on the non-HAL/CubeMx libraries V3.5.0 (SPL?). Used Libraries (new board): FreeRTOS 8.1.2 FatFS R0.10b LwIP: Self-modified to handle data transfers with 64k per tcp_write (exchanged several u16 with u32 for snd_buf and like variables) Zero Copy ethernetif + stm32f4xx_hal_eth driver in send and receive direction sdio.c implementation has two independent DMA for send and receives (like found in this forum) With the new board we are facing some strange data corruption: Reading larger binary files (2MB+) in chunks of SD-Card page sizes (64k, but occurs also with smaller chunks):- Requesting a buffer of 64k from a custom LWIP mempool (memp_malloc())
- Read from SD Card to SDRAM 1 via DMA2_Stream3 Channel 4.
- Posting a pbuf to a FreeRTOS queue which is read by LWIP tcp_poll and eventually processed by tcp_write
- LwIP splits up the large 64k in slices of 1460 byte and passes an pbuf chain to the driver
- The low level ethernetif sets the ETHIF_DMATxDescriptors to point directly to the payload of the pbuf without copy: heth->TxDesc->Buffer1Addr = (uint32_t)p->payload;
- In LwIP tcp_sent() the pbuf is freed on successful receiving confirmation
