We are using Chan's FatFS with FreeRTOS and lwIP on a board incorporating Cortex-M4. The board is able to send and receive files over a TCP socket and store them on SD card using FatFS.
I'm trying to test the functionality but seems like it's not operating correctly. When I send and receive the same file, each time the content gets corrupted in a similar manner. The most distinct characteristic of the corruption is that it appends two zero bytes to the beginning of file. This happens all the time while the rest of the corruption may differ (not significantly).
I'm aware that there is not enough information to solve the problem but I'm stuck and looking for some advises for troubleshooting the problem. Chan's code is pretty cryptic and I can not find my way through it.