RE: The 52235 tcp issue

"Seymour David-RA2693" <[email protected]> Fri, 12 Sep 2008 08:37:39 -0700
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <FE151544B54DB0428FFA9AE99C27A121023036EF@az33exm22.fsl.freescale.net>
Hi Sanjay,
I took your code and tried it on my updated code base and it works fine.
I haven't tried it on the old code base thought.
Copy of code below as I did modify it slightly.
We/Freescale will post the updated version soon that supports more
ColdFire processors and has many code updates to improve reliability.
 
   //FSL terminal example.  Configure HyperTerm TCP client to the
displayed
   //FSL IP address and give the port number 5678.
   //FSL This code echo's back the type character as well as prints
   //FSL to terminal window.
void emg_tcp_rx( void )
 
{
 
            static int length, i;
            unsigned long rate;
 
            // PARAM1: M_SOCK socket,
            // PARAM2: char * buffer
            // PARAM3: unsigned length
            //
            // RETURNS: number of bytes actually read, or -1 if error. 
            // int m_recv(M_SOCK so, char * buf, unsigned buflen)
 
            length = m_recv( emg_tcp_communication_socket, (char
*)buffer, RX_BUFFER_SIZE );
 
            if( length > 0)
            {
              buffer[length] = '\0';
                 if(buffer[0]== 0x0d)
                  printf("\n");
                 else
                 {
                  printf("%s",buffer);
                  if(buffer[length-1]==0x0d)
                  {
                   printf("\n");
                  }
                 }
                  
                 m_send(emg_tcp_communication_socket,(char
*)buffer,length);
            }
}
 
 
 
Regards, 
David 
 
David E Seymour

http://www.freescale.com/coldfire

 

________________________________

From: [email protected] [mailto:[email protected]]
On Behalf Of Sanjay Morab
Sent: Friday, September 12, 2008 2:40 AM
To: Seymour David-RA2693
Subject: [ColdFire] The 52235 tcp issue



Dear All

 

The Sample code "Coldfire_lite"  which is provided by Freescale had
"ColdFire_lite_tcp_server" project. I am using this project for the my
application. The original sample code I am using with The development
board. 

 

When I start the PC side application up to 25 packets it woks fine but
after 25 packet transmission the communication hanges.. Select
Coldfire_Lite_tcp_server. Replace the code listed below. Try to use The
Hyperterminal for sending the data in winsock mode.

 

void emg_tcp_rx( void )

{

            int                                             length, i;

            unsigned long   rate;

            

            // PARAM1: M_SOCK socket,

            // PARAM2: char * buffer

            // PARAM3: unsigned length

            //

            // RETURNS: number of bytes actually read, or -1 if error. 

            // int m_recv(M_SOCK so, char * buf, unsigned buflen)

            length = m_recv( emg_tcp_communication_socket, (char
*)buffer, RX_BUFFER_SIZE );

 

            

            if( length > 5)

            {

                                    buffer[length] = '\0';

                                    

                                                            

                        printf("\n Received String %s Length
%d\r\n",buffer,length);

 
m_send(emg_tcp_communication_socket,(char *)buffer,length);

            

            }

}

 

Regards

Sanjay Morab

 

[email protected] Send a post to the list.
[email protected] Join the list. [email protected]
Join the list in digest mode. [email protected] Leave the
list.