Author Topic: FTP hangs in MCF52232 based board  (Read 13356 times)

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
FTP hangs in MCF52232 based board
« on: September 16, 2009, 12:02:14 AM »
Hi,

I am currently evaluating uTasker on MCF52232 based custom board. When I login to FTP, executing the command "dir" hangs, then the connection timedout. Also I am not able to upload any files, again the uTasker application hangs and after few minutes it timedout.

C:\Documents and Settings\Sundar\Desktop\WebPagesM5223X>ftp 192.168.15.120
Connected to 192.168.15.120.
220 Welcome M5223X FTP.
User (192.168.15.120:(none)):
331 Enter pass.
Password:
230 Log OK.
ftp> dir
200 OK.
150 Data.
Connection closed by remote host.
ftp> quit


I have the following configuration in the config.h file.

            #define ANONYMOUS_LOGIN                                      // allow anonymous FTP without user/password
            #define FILE_NAMES_PER_FTP_FRAME    6                        // limit size of buffers required to display files to this many names (remove to use maximum possible)
            #define FTP_SOCKETS 2                                        // reserve 2 TCP sockets for command and data
            #define FTP_SUPPORTS_NAME_DISPLAY                            // show details of files
            #define FTP_SUPPORTS_DELETE                                  // enable delete of files via FTP
            #define FTP_SUPPORTS_DOWNLOAD                                // support read of files via FTP
            #define FTP_VERIFY_DATA_PORT                                 // check for valid data port when in active mode
            #define FTP_PASV_SUPPORT                                     // allow passive mode of operation
            #define DATA_PORT_TRIGGERS_CONTROL                           // activity on the FTP data port resets the control port TCP idle timer - stops control connection timing out on large data transfers with short idle time value
            #define FTP_USER_LOGIN
            #define FTP_WILDCARD_DEL                                     // file system content delete using *.* supported
            #define FTP_DATA_WINDOWS            2                        // allow transmission of FTP data with windowing support
            #ifdef INTERNAL_USER_FILES
                #define FTP_DISPLAY_USER_FILES                           // allow user files to be displayed by FTP
                #define MAX_FILE_NAME_LENGTH    20                       // user files maximum file name length
 

Did I miss anything ?.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: FTP hangs in MCF52232 based board
« Reply #1 on: September 16, 2009, 12:29:58 AM »
Hi Frank

You didn't mention which compiler you are using.

A similar problem has been found when working with the new CW 7.1.2 compiler (it is OK with CW 7.1.1) and a service request was sent to Freescale about it.
See details here: http://www.utasker.com/forum/index.php?topic=659.0

There is also a workaround in code http://www.utasker.com/forum/index.php?topic=657.0 which can be made to avoid it (although there are reports of similar errors in project application code too). If optimisation is disabled the compiler doesn't make this error. Also by going back to CW 7.1.1 solves it. The compiler makes a strange mistake of calculating the element of a struc incorrectly and this results in TCP connections (not just the FTP) from never closing since the code doesn't recognise that the sever has sent the FIN flag.

Could this explain what you are suffering?

Regards

Mark

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #2 on: September 16, 2009, 08:11:38 PM »
I am using CW 7.1 Build 14 ( which is a special edition ).

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #3 on: September 16, 2009, 08:26:41 PM »
After the FTP login, if I try the command "dir", immediately it hangs and after a while the FTP connected timed out. FTP upload also not working. I will try the workaround code.

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #4 on: September 17, 2009, 05:19:08 PM »
After I did the modification as per this link (http://www.utasker.com/forum/index.php?topic=657.0 ), I am still getting the same behaviour.

Help Needed...

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: FTP hangs in MCF52232 based board
« Reply #5 on: September 17, 2009, 09:26:14 PM »
Hi Frank

When the FTP connection hangs is it because the board is resetting? Or is it a TCP problem? (send a Wireshark recording as reference)
If it is not due to the CW 7.1.2 bug (and the workaround didn't fix it) it may be due to the file system not being configured accordingly(?)

Can you try a pre-build object to see whether it has the same problem (http://www.utasker.com/SW_Demos.html)? These are for all boards and use only internal FLASH so should exclude any other potential problems (although they run at 60MHz, which is theoretically faster than the maximum speed of an M52232).

Regards

Mark

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #6 on: September 17, 2009, 09:50:53 PM »
Sure. I will try the pre-built image. Also I can send the tcpdump.

I think in my config setting, I would end up with the following configuration.

            #define PARAMETER_BLOCK_START 0x18000                        // {34} FLASH location at 96k start
            #define uFILE_START 0x19000                                  // FLASH location at 100k start
            #define SINGLE_FILE_SIZE (1*FLASH_GRANULARITY)               // each file a multiple of 2k
            #define FILE_SYSTEM_SIZE (78*SINGLE_FILE_SIZE)               // 156k reserved for file system

Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #7 on: September 17, 2009, 09:51:25 PM »
Currently I am using the internal flash.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: FTP hangs in MCF52232 based board
« Reply #8 on: September 17, 2009, 10:17:22 PM »
Hi Frank

I see a problem with the FLASH configuration with the M52232.

This device has 128k FLASH, whereas the setup of the file system is for a larger device. When FTP DIR is commanded it will try to search for file in the memory range and crash since it will try to access memory beyond the 128K limit.

To solve this you can change (in app_hw_m5223x.h)

            #define FILE_SYSTEM_SIZE (78*SINGLE_FILE_SIZE)               // 156k reserved for file system

to
            #define FILE_SYSTEM_SIZE (14*SINGLE_FILE_SIZE)               // 28k reserved for file system

This will give the smaller file system as described in the document FileSystemM5223X.doc in \Applications\uTaskerV1.4\WebPages\WebPagesM5223X\FileSystem
(Note that there is a mistake in this document since it shows the 158k setting, where it should be as above).

Regards

Mark


Offline frank

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: FTP hangs in MCF52232 based board
« Reply #9 on: September 18, 2009, 10:29:28 AM »
Hi Mark,

You are right. After chainging the FILE_SYSTEM_SIZE  to (14*SINGLE_FILE_SIZE) , the system works perfectly.

Thanks for your help.

- Franklin