Hi all,
I'm using the CMSIS ftp client to upload a file to a server.. All the process is ok, create the file in the memory card, write some data, connect to the server, start session and put the file... everything is ok.. but, the file on the server is always empty.
When I debug the program and place a breakpoint on the ftp_client_fread function where is the fread function that reads the file from the SD card requested by the ftp client, the fread function is returning a 0 value that is an error (no data readed)... for this reason the file on the server have size zero.
The function receives a correct file handler but can't read enything. If I place in the ftp_client_fread function a full code to open a file and read (to be sure that the handler is ok) fread returns zero:
__weak uint32_t ftp_client_fread (void *file, uint8_t *buf, uint32_t len) { // Read block of data from local file in FTP client. size_t ret; char data[40]; FILE *f = fopen ("M0:\\hola.txt", "r"); if (f != NULL){ ret = fread (data, 10, 1, (FILE *)f); fclose (f); } return (ret); }
But the file exists and is OK with data.. Also I tested the same with a ramdrive and the same result...
Thanks
Hi,
Don't want to use a SD card for this for many reasons:
1. The SD card add extra cost to the project (this is not a home made project, is for large quantity)
2. If the power fails in a writing to the SD card the card can be broken (this is a problem with the SD cards) and the product will never be upgraded
I'm using a STM32F4 with 1M of flash and I have enough memory for bootloader, firmware (2 partitions), user data.
The process is the next:
1. Bootloader checks the latest firmware version of each of the two partitions 2. Check the MD5 for this partition with the MD5 saves to user data space 3. If the check fails boots from the other partition 4. If a new firmware will be downloaded this will be wrote to the not used partition and then restart. If the ftp fails and the data is corrupted the bootloader will boot from current partition
I think this boot and updating system can't fail