2025-03-31 2:12 AM - last edited on 2025-04-07 2:48 AM by mƎALLEm
I am trying to implement TFTP file transfer on my STM32 module (Nucleo-H723ZG). I have taken reference from:
https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM324xG_EVAL/Applications/LwIP/LwIP_IAP
https://github.com/JoeMerten/Stm32-Tools-Evaluation/tree/master/STM32Cube_FW_F4_V1.9.0/Projects/STM324xG_EVAL/Applications/LwIP/LwIP_TFTP_Server
For file transfer I am using tftpd64 software. I used the software for PC-PC file transfer which were on the same local network and it was successful. But when I am trying to send file from PC-STM32 module I am only receiving write request from the client (PC). After that I am suppose the get a block 0 acknowledgement from the server (STM32 module) which I am not receiving.
I tried debugging the code but in the code the acknowledgement is being sent successfully. For more information:
- my ethernet is up
- I have successfully ping the IP address that I have assigned or configured for the module.
- Moreover, I am using UDP so I am able to send messages using Hercules software.
Until the block 0 acknowledgement is received by the client (PC), it will not send the data packets.
Solved! Go to Solution.
2025-04-07 2:30 AM
For TFTP server to work properly it is recommended to use the tftp_server source and header files in Middleware. Earlier I was referring to the GitHub code in which a different file is created for initializing TFTP server, which came with many problems like mentioned above. After creating new project and by using this autogenerated files by STM32CubeIDE, I accomplished creating a TFTP server on stm module and transfer a file.
Some points to consider when using this file:
- To initialize TFTP server we have to define the function pointers for handling file I/O operations. This structure is used by the TFTP server to manage file transfers, including opening, writing, and closing files.
- This functions are called from the recv function in the tftp_server.c file.
2025-03-31 2:07 PM
Please do a wireshark capture.
2025-03-31 11:03 PM
I did the wireshark capture and in that only the write request packet sent by the client is displayed.
But while debugging the code the ack is being sent successfully without generating any error. I checked the ip address and the port that it is sending the ack. and both the things are correct.
2025-04-01 12:24 AM
So it appears that the ACK is not sent on the wire. When you capture from the board reset or power on, are ARPs and ping replies from the board visible?
2025-04-01 12:32 AM - edited 2025-04-01 1:41 AM
Hi @jowakar122
the app note for your project says:
I would fix your filename first... Your filename in your shark capture is invalid.... meaning no response
2025-04-01 3:55 AM
Yes the ip address is listed and successfully responds when ping.
2025-04-01 3:56 AM
@matt-crc there is no footnote or app note like the one you mentioned. It would be great if you specify.
2025-04-01 3:59 AM
its in the readme, or you can read it when selecting the example from cubemx
2025-04-01 4:14 AM - edited 2025-04-01 4:15 AM
No, moreover I am not using a example code from cubemx.
2025-04-01 4:19 AM
I assume you are using CubeIDE?
1- File -> New -> STM32 Project
2- On the Top, select "Example Selector"
3- in the search box, type "Tftp", a list of all example project appears on the bottom right
4- Select the row with your processor / demo board
5- Read...