FTP Error transfering bytes


Hi everyone,

I am running into difficulty transfering bytes of binary data to a ftp server. I convert a 3 digit string (range 0 - 255) to a u8. This is then added to a buffer (either by using u8 pointers or through the wm_sprintf(*buffer, “%c”, byte) function.

I then echo the byte to the serial port to ensure that the conversion has been performed correctly which it appears to be. after several hundred conversion and appends to the buffer the buffer is sent to the ftp server as a file. When I use a hex viewer to look at this file the byte values only range from 0 - 127 instead of 0 - 255. ie an orginal string of “128” will be transferred as 0 and a string of 255 will be transfered as 127. Does anyone have any idea where or what is causing the error?




When you use an FTP client on a PC, etc, you have to tell it whether to use ASCII or Binary mode - are you sure that you have correctly configured your client?


Thank You awneil,

I have not found any settings on the server for changing ftp ascii/binaryfile handling however i have seen options for ascii/binary data on the client software. In this instance the client is the M1306B part I am using and the tcp/IP library.

Can anyone give me any further guidance?



The transfer mode don’t depend on the server but on the client. If you will transfer binary data as yours you should set FtpType of the ftp params to ‘I’.

Best regards


Thank you everyone, made the correction and it works correctly