cancel
Showing results for 
Search instead for 
Did you mean: 

LWIP TFTP

STuri.1
Associate II

Hi, I have to develope a system where an stm32 connected via ethernet handles files stored in a sdcard through an FTP connection from a PC.

I know there is a sample from ST exactly about this but I can't get it to work on my nucleo H723 board, it seems that somehow the generated files from cubemx are totally scrambled, different content and placed in different locations.

Infact if I try to setup a project using cubemx as found in an online blog the project is generated but I cannot find ethernetif.c under src folder for example...

Could you please help me and show me the right directions?

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
STuri.1
Associate II

Thanks, I finally figured it out. It was not working because on cortexM7 processors MPU and ram needs to be configured carefully.

For the posterity I was really helped from this article, pay attention to the linker script editing and the macro definition in project options: https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working

Also my MCU is an H723 so it is the special case with not enough ram in D2 and my MPU region base address needed to be 0x30000000 instead of 0x30040000.

Thanks again to who tryied to help me, really appreciate it.

View solution in original post

9 REPLIES 9
Pavel A.
Evangelist III

FTP and TFTP are very different. Decide which one do you need.

STuri.1
Associate II

I'd say TFTP which seems to be somehow included in the cubemx configuration options...

But my ultimate goal is to have file trasfers working via ethernet, whatever works I'll pick it.

Pavel A.
Evangelist III

For TFTP, you may want to start from LwIP UDP echo server then merge TFTP from project for other board.

STuri.1
Associate II

Thanks I'll try

STuri.1
Associate II

No way.

I tryied setting up the project in cube mx and copying only the .c/.h of the TCP & UDP echo servers and copying in main.c the relevant part in setup and in the while(1): the project compiles with no errors or warnings but I'm unable to get any answer from a ping.

Maybe importing the whole original project could have worked but I need to start from cubemx since there are other parts of the project which has already been written and that depends on the current HAL initialization...

Too bad that the provided examples doesn't follow the current cubemx structure generation.

Pavel A.
Evangelist III

Start from the  LwIP UDP echo server example which is exactly for your board (nucleo H723).

Get it working: ping and whatever it should do. Do not change anything until you see it working.

Then get TFTP working.

Only then try to generate something in cube. Examine and merge differences.

> Too bad that the provided examples doesn't follow the current cubemx structure generation.

Yep.

Alec Davis
Associate III

2 months ago I started from link below, however I use it to write firmware to an onboard SPI Flash with an STM32F417 and stm32cubeide.

https://community.st.com/s/question/0D53W00000LFUOmSAP/lwip-tftp-on-stm-boards

STuri.1
Associate II

Thanks, I finally figured it out. It was not working because on cortexM7 processors MPU and ram needs to be configured carefully.

For the posterity I was really helped from this article, pay attention to the linker script editing and the macro definition in project options: https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working

Also my MCU is an H723 so it is the special case with not enough ram in D2 and my MPU region base address needed to be 0x30000000 instead of 0x30040000.

Thanks again to who tryied to help me, really appreciate it.

Daecheol
Associate II

thank you for your comment.

I have already seen this article and modified my cubeMx MPU Base Address to 0x30000000, but as I said in the question article, when I try to debug the project, it moves to the MemMange_Handle(void) function.0693W00000Y8UAPQA3.png