Skip to main content
Associate II
Aug 23, 2024 12:47 AM UTC
Question

Failed to receive file via tftp

I am working on a tftp client program that receives a file from a tftp server.

I found the tftp client library below and ported it.

https://github.com/particle-iot/lwip/blob/master/contrib/examples/tftp/tftp_example.c

 

The file is received in debugging mode, but it is not received at runtime.

I checked and confirmed that 'fopen' does not work at runtime. I don't know why.

Below is the fopen code. 

-------------------------------------------------------------------------------------

static void *
tftp_open_file(const char* fname, u8_t is_write)
{
snprintf(full_filename, sizeof(full_filename), "%s%s", LWIP_TFTP_EXAMPLE_BASE_DIR, fname);
full_filename[sizeof(full_filename)-1] = 0;

if (is_write) {
return (void*)fopen(full_filename, "wb");
} else {
return (void*)fopen(full_filename, "rb");
}
}

-------------------------------------------------------------------------------------

I tried delaying before the tftp_client_init() function because it seemed to be a timing issue.

Please help.

 

This topic has been closed for replies.

8 replies

Pavel A.
Aug 23, 2024 12:07 PM UTC

Do you know why fopen works in debug mode? Do you use semihosting? 

 

jmyooAuthor
Associate II
Aug 26, 2024 12:14 AM UTC

I don't know

Please let me know

ST Technical Moderator
Aug 23, 2024 3:54 PM UTC

Hello @jmyoo ,

Ensure that the tftp configuration parameters are correctly set and the tftp server software is up to date and properly configured.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks