<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>ColdFire/68K Microcontrollers and ProcessorsのトピックMC52233 client using minisockets</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134164#M1396</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to implement a simple tcp session between my PC and the 52233Demo board. The trouble I am having has been with the m_connect and m_send socket functions. All I want to do is open a socket, send one character via TCP and then close the socket. My code is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;M_SOCK sockfd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;struct sockaddr_in dest_addr; // will hold the destination addr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;char stuff='f';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int nb_bl=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sockfd = m_socket(); // do some error checking&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//m_ioctl(sockfd,SO_NBIO ,&amp;amp;nb_bl);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_family = AF_INET;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_port = 3490;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_addr.s_addr = inet_addr("192.1.3.149" );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memset(&amp;amp;(dest_addr.sin_zero), '\0', 8);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m_connect(sockfd, &amp;amp;dest_addr, something);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nmpcts=m_send(sockfd,&amp;amp;stuff,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m_close(sockfd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the code on the coldfire the following happens:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mc52233 sends out an ARP request&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Pc replies witht its mac address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mc5233 sends out TCP syn request&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PC replies with RST ACK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and then no more packets are sent and the mc52233 continues runnig other tasks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that the connect fucntion is working but not the send.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this may have something to do with my callback function: something&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at the moment it does nothing cause I'm not to sure how to use this. However the socket should be by default set to blocking so the callback function should not be needed...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone point out what I am doing wrong. Please speak slowly as I am new to sockets and TCP/IP &lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kyle&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2006 19:50:28 GMT</pubDate>
    <dc:creator>wyliek</dc:creator>
    <dc:date>2006-10-24T19:50:28Z</dc:date>
    <item>
      <title>MC52233 client using minisockets</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134164#M1396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to implement a simple tcp session between my PC and the 52233Demo board. The trouble I am having has been with the m_connect and m_send socket functions. All I want to do is open a socket, send one character via TCP and then close the socket. My code is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;M_SOCK sockfd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;struct sockaddr_in dest_addr; // will hold the destination addr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;char stuff='f';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int nb_bl=0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sockfd = m_socket(); // do some error checking&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//m_ioctl(sockfd,SO_NBIO ,&amp;amp;nb_bl);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_family = AF_INET;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_port = 3490;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dest_addr.sin_addr.s_addr = inet_addr("192.1.3.149" );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memset(&amp;amp;(dest_addr.sin_zero), '\0', 8);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m_connect(sockfd, &amp;amp;dest_addr, something);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nmpcts=m_send(sockfd,&amp;amp;stuff,1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m_close(sockfd);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the code on the coldfire the following happens:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mc52233 sends out an ARP request&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Pc replies witht its mac address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mc5233 sends out TCP syn request&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PC replies with RST ACK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and then no more packets are sent and the mc52233 continues runnig other tasks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that the connect fucntion is working but not the send.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this may have something to do with my callback function: something&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at the moment it does nothing cause I'm not to sure how to use this. However the socket should be by default set to blocking so the callback function should not be needed...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone point out what I am doing wrong. Please speak slowly as I am new to sockets and TCP/IP &lt;/SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kyle&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 19:50:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134164#M1396</guid>
      <dc:creator>wyliek</dc:creator>
      <dc:date>2006-10-24T19:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: MC52233 client using minisockets</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134165#M1397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Kyle,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It doesn't look as though you are doing much wrong, so it may be more that one of the calls has failed. I know that some of your code must be working for a SYN to have been sent, but I'd do the following:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Check that m_sock doesn't return NULL;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Explicitly set the socket to blocking mode - m_ioctl(sockfd, SO_BIO, NULL); // data not used by m_ioctl&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Check the return from m_connect, if it is EINPROGRESS, the socket is non-blocking. Connected OK will return 0.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is nmpcts after the call to m_send? -1 indicates an error and a BSD error code may be found in sockfd-&amp;gt;error.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If that is all fine, try removing the m_close - maybe the stack dumps the data before it reaches the ethernet interface.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 22:27:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134165#M1397</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2006-10-31T22:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: MC52233 client using minisockets</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134166#M1398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Paul,&lt;BR /&gt;&lt;BR /&gt;Thanks for the suggestions. It seems that you were correct. The code was working, the problem happened to be on the PC side. I was not listening for a connection from the coldfire. Therefore, when the TCP SYN request was received the PC replied with a reset ACK which prevented the connection.&lt;BR /&gt;&lt;BR /&gt;I have since fixed the problem, only to encounter a new one:&lt;BR /&gt;&lt;BR /&gt;I have been playing around with the ColFire Lite example project (HTTP server) to try and familiarise myself with the Interniche network stack and NicheTask. My goal is to edit the project to contain a task which simply sends a string via UDP. What I have done so far is:&lt;BR /&gt;&lt;BR /&gt;In the create_apptasks() function I have added-&lt;BR /&gt;&lt;BR /&gt;e = TK_NEWTASK(&amp;amp;kel_udp_task);&lt;BR /&gt;if (e != 0)&lt;BR /&gt;{&lt;BR /&gt;dprintf("udp task create error\n" );&lt;BR /&gt;panic("create_apptasks" );&lt;BR /&gt;return -1; // compiler warnings&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;which should create a new task if I am not mistaken.&lt;BR /&gt;I have declared the task object-&lt;BR /&gt;&lt;BR /&gt;TK_OBJECT(to_keludpclient);&lt;BR /&gt;TK_ENTRY(tk_keludpclient);&lt;BR /&gt;struct inet_taskinfo kel_udp_task={&amp;amp;to_keludpclient,&lt;BR /&gt;"UDP Client",&lt;BR /&gt;tk_keludpclient,&lt;BR /&gt;NET_PRIORITY,&lt;BR /&gt;APP_STACK_SIZE&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;My code for the task is as follows-&lt;BR /&gt;&lt;BR /&gt;TK_ENTRY(tk_keludpclient)&lt;BR /&gt;{&lt;BR /&gt;int e;&lt;BR /&gt;char data[]="some text";&lt;BR /&gt;e=0;&lt;BR /&gt;while (!iniche_net_ready)&lt;BR /&gt;TK_SLEEP(1);&lt;BR /&gt;e=kel_send_udp(data, 9, 0xC0010395, 3490, 3490);&lt;BR /&gt;TK_RETURN_OK();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int kel_send_udp(char *data, int datalen, ip_addr destip, u_short lport, u_short fport)&lt;BR /&gt;{&lt;BR /&gt;PACKET data_pkt;&lt;BR /&gt;int e;&lt;BR /&gt;void * event;&lt;BR /&gt;&lt;BR /&gt;data_pkt=udp_alloc(datalen,0);&lt;BR /&gt;if (!data_pkt)&lt;BR /&gt;printf("trouble allocating packet" );&lt;BR /&gt;data_pkt-&amp;gt;nb_prot =data;&lt;BR /&gt;data_pkt-&amp;gt;nb_plen =datalen;&lt;BR /&gt;data_pkt-&amp;gt;fhost =destip;&lt;BR /&gt;e=udp_send(fport, lport, data_pkt);&lt;BR /&gt;TK_APP_BLOCK(event);&lt;BR /&gt;return e;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;This sends a UDP packet to My PC containing "some text". But my PC replies with and ICMP "destination unreachable". Could the problem be that I'm not listening for the packet again?&lt;BR /&gt;&lt;BR /&gt;Another more important issue is that on observing the serial port output I get:&lt;BR /&gt;&lt;BR /&gt;INET&amp;gt; Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;Illegal instruction -- PC = 0x00010000&lt;BR /&gt;&lt;BR /&gt;which continues endlessly. Can anyone tell me what is causing this error?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2006 20:08:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/MC52233-client-using-minisockets/m-p/134166#M1398</guid>
      <dc:creator>wyliek</dc:creator>
      <dc:date>2006-11-07T20:08:00Z</dc:date>
    </item>
  </channel>
</rss>

