Skip to main content
Visitor II
April 3, 2022
Question

File writing issue with Ethernet in STM32Cube F4 V1.27.0

  • April 3, 2022
  • 3 replies
  • 1088 views

Hi,

I ported my project from F4 V1.26.2 to V1.27.0 and found an issue related to file corruption on the sd card after transferring the file through Ethernet (by FileZilla FTP). The weird point is transferred file size is correct but the file contents are different.

It looks like TCP client/server, VNC, FTP, etc work fine. So, I thought the problem comes from SD driver or file system (FatFS) however, there was no such update.

Does anyone have a similar issue and resolution?

Thanks.

Chris

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    April 4, 2022

    Hello @mclapd​ ,

    You might want to review this post F4 + FreeRTOS + LwIP. Bad default LWIP_RAM_HEAP_POINTER after updating to v1.9.0. and see if you have similar issue.

    When your question is resolved, please close this topic by choosing Select as Best. This will help other users find that answer faster.

    Imen

    mclapdAuthor
    Visitor II
    April 5, 2022

    Hi Imen,

    I am using external SDRAM for LwIP like below to use various Ethernet services such as TCP client/server, VNC, web server, FTP, syslog, etc...

    So, it looks different issue from mine. Thanks anyway.

    /** heap (ram_heap) in external SDRAM */
    #ifdef USE_EXTERNAL_SDRAM_FOR_LWIP
    uint8_t LwipHeapOnSdram[MEM_SIZE_ALIGNED + (2U*SIZEOF_STRUCT_MEM)] __attribute__((section(".sdram")));
    #endif
     
    ....
     
     /* align the heap */
    #ifdef USE_EXTERNAL_SDRAM_FOR_LWIP
     ram = (u8_t *)LwipHeapOnSdram;
    #else
     ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER);
    #endif
     /* initialize the start of the heap */
     mem = (struct mem *)(void *)ram;
     mem->next = MEM_SIZE_ALIGNED;
     mem->prev = 0;
     mem->used = 0;
     /* initialize the end of the heap */
     ram_end = ptr_to_mem(MEM_SIZE_ALIGNED);
     ram_end->used = 1;
     ram_end->next = MEM_SIZE_ALIGNED;
     ram_end->prev = MEM_SIZE_ALIGNED;
     MEM_SANITY();

    mclapdAuthor
    Visitor II
    April 5, 2022

    And I found there is no issue with HAL_ETH_LEGACY_MODULE_ENABLED. So, it seems the issue happens with the new Ethernet driver.