lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwip-users Digest, Vol 121, Issue 27


From: Bellphin Billu
Subject: Re: [lwip-users] lwip-users Digest, Vol 121, Issue 27
Date: Sat, 5 Oct 2013 17:12:14 +0530

Thanks in advance...

 With your kindness help i can overcome the tcp issue ..now i have complex to configure ethernet by the value stored in SD card.SD card has the data for IP,Gateway,Mask and Port number also.I used to read the data in the function of prv_cat.

My Problem is ethernet configure from the data in SD card,But ethernet was configured by default value.afterwords the ethernet wasn't reconfigured.I know free Rtos run with priorities .Herewith i attach my main,c file

/*1) Start the Supervisor Task */
vSupervisor_Start( mainSUPERVISOR_TASK_PRIORITY );

/* 2) Start the ethernet tasks launcher. */
vStartEthernetTaskLauncher( configMAX_PRIORITIES );

/* 3) Start FreeRTOS. */
vTaskStartScheduler();

/* Will only reach here if there was insufficient memory to create the idle task. */
I wolud like to configure ethernet from the data in SD card,

Pls Help me Its Very Urgent
Thanks in advance...
Reg
Bellphin...

 




On Mon, Sep 30, 2013 at 2:08 PM, <address@hidden> wrote:
Send lwip-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."


Today's Topics:

   1. Re: lwip bind fail (Daniel Doron)


----------------------------------------------------------------------

Message: 1
Date: Mon, 30 Sep 2013 08:08:11 +0000
From: Daniel Doron <address@hidden>
To: "address@hidden" <address@hidden>
Subject: Re: [lwip-users] lwip bind fail
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Hi Jin,

Sorry, I have no experience with any RTOS. I am building my app the old fashioned way (super loop).
I hope the other listeners can help...

BR,

Daniel Doron
Embedded Linux Software Engineer

IdentyTech Solutions ltd.
<http://www.identytech.com>Efal 35
P.O.B. 3620
<http://maps.google.com/maps?q=Efal+35%2CP.O.B.+3620%2CPetah+-+Tikva+49155%2CIsrael&hl=en>Petah - Tikva 49155 Israel
We're hiring!<http://www.linkedin.com/vsearch/j?company=IdentyTech&openAdvancedForm=true&locationType=I&countryCode=il&sortBy=R>        [cid:part4.00090007.09090801@identytech.com]    Work: +972-773414243
Fax: +972-772074757
Email:address@hidden<mailto:address@hidden>
[cid:part6.07040001.02050004@identytech.com]http://il.linkedin.com/in/lightydo

See who we know in common<http://www.linkedin.com/e/wwk/1347335/?hs=false&tok=0KDDNwqTnr9BQ1>

On 09/24/2013 10:08 PM, Jin Won Seo wrote:
Hi Daniel,

I tested the listener modules with different setting as you mentioned, and nothing worked.

Finally I found the problem in different configuration file which is sys_arch.c. Of course I changed the configuration in lwipopts.h, but some of them in lwipopts.h seem like not affecting that much.

My problem was netconn was not properly allocated. I am not sure still how nicely debug programs based on lwip+safeRTOS, but they seem like not giving me that much options, so I tried to print out a certain message on LCD for debugging.

What I did in sys_arch.c is change SYS_SEM_MAX, SYS_MBOX_MAX. There are simple 5 tasks running together with listener task in my test project, and I guess each task uses their own SEM and MBOX as they get into active.

I just changes the MAX # in sys_arch.c to above # of tasks running on safeRTOS.

In addition, I changed DEFAULT_UDP_RECVMBOX_SIZE as well since I used DHCP option in lwipopts.h to get IP from server in my test project.

However, based on my analysis, even though LWIP_TCP is set, it seems like not affecting because a couple of definitions are redefined in opt.h in case of commenting out definitions in lwipopts.h.

Moreover, netconn_alloc() in api_msg.c(lwip1.3.2) seems like not allowing to use two different protocols like using UDP and TCP together. Only one type of protocol among other that filtered by switch~case for the first time is returned by netconn_alloc() since detecting UDP is prior to TCP in codes.

My project may need both protocols(UDP+TCP), and I wonder how both are used in different scenario??.

I am not sure yet, but it won't allow to use mixed protocols based on the behavior of the function.

I appreciate your help,
Jin


On Tue, Sep 24, 2013 at 4:49 AM, Darius Babrauskas <address@hidden<mailto:address@hidden>> wrote:
It looks, that not defined UDP bufs.
 In your lwipopts.h   commented out:
//#define LWIP_UDP                        1
 #define LWIP_UDP                        1
//#define MEMP_NUM_UDP_PCB                4
#define MEMP_NUM_UDP_PCB                5

Need uncomment ---------- ARP options ----------

You not using tcp, so comment
#define LWIP_TCP                        0
#define MEMP_NUM_TCP_PCB                0// default is 5


Read  opt.h for more information...
----- Original Message -----
From: Jin Won Seo<mailto:address@hidden>
To: Mailing list for lwIP users<mailto:address@hidden>
Sent: Friday, September 20, 2013 8:07 PM
Subject: Re: [lwip-users] lwip bind fail

Thanks,

It's my misunderstanding. Telnet doesn't let me check if UDP Server's IP port is alive.

Anyhow, I can't still figure the main problem out.

Why is lwip_socket() not working?

socket_fd = lwip_socket(AF_INET, SOCK_DGRAM, 0) always return -1.

I put a debugging codes to see get a connection in lwip_socket() in sockets.c

  if (!conn) {
      DisplayString(115, 180 - 10, "  ENOBUFS (could not create netconn) ");
    LWIP_DEBUGF(SOCKETS_DEBUG, ("-1 / ENOBUFS (could not create netconn)\n"));
    set_errno(ENOBUFS);
    return -1;
  }

and display "ENOBUFS...." on LCD.

lwip_socket_init() is called in different task, which is lwip_task, and listener task sets up socket and receives packets.

lwip_task init lwip and calls lwip_socket_init()

    // Initialize lwIP.
    //
   //get client IP and use it to set up socket later on
   lwIPInit(pucMAC, 0, 0, 0, IPADDR_USE_DHCP);

    //
    // Setup the remaining services inside the TCP/IP thread's context.
    //
    tcpip_callback(SetupServices, 0);// lwip_socket_init() is called in SetupServices().

I was suspicious about lwipopts.h, so kept changing definition and tested to see if I missed one of definition in the header file. However, it still doesn't work.

I attached my lwipopts.h.

Thanks,
Jin


On Thu, Sep 19, 2013 at 10:53 PM, Darius Babrauskas <address@hidden<mailto:address@hidden>> wrote:

>>Also I directly attempts to access the listener using telnet command(telnet 192.2.0.208 5701), but the below error message comes out
Telnet using TCP protocol. Your server  type are  UDP. Connection not possible.
----- Original Message -----
From: Jin Won Seo<mailto:address@hidden>
To: Mailing list for lwIP users<mailto:address@hidden>
Sent: Friday, September 20, 2013 12:41 AM
Subject: Re: [lwip-users] lwip bind fail

Hi,

I put a debugging code to see what error no spits out.

  if (!conn) {
      DisplayString(115, 180 - 10, "  ENOBUFS (could not create netconn) ");
    LWIP_DEBUGF(SOCKETS_DEBUG, ("-1 / ENOBUFS (could not create netconn)\n"));
    set_errno(ENOBUFS);
    return -1;
  }

"  ENOBUFS (could not create netconn) " was displayed on LCD. The meaning of ENOBUFS is  /* No buffer space available */

I think it just says that no connection is made up.

I don't know what makes this happened, but I feel like something to do with configuration to use  lwip-socket since not even lwip-socket conn is assigned.

Anyone knows about this?



On Thu, Sep 19, 2013 at 11:42 AM, Jens Nielsen <address@hidden<mailto:address@hidden>> wrote:
Hi

Did you check the value of socket_fd? lwip_socket() returns -1 on error but your code tests for == 0

Also check the value of errno after your call, that might give you a hint

BR /Jens



On 2013-09-19 20:19, Jin Won Seo wrote:
Hi all,

I posted my issue but I fell like not describing the problem in detail. So I re-post it with detail information.

I am testing listener modules using LM3S9B96, lwip1.3.2, safeRTOS, StellarisWare 10636, ccs 5.4.x.

The listener task running on safeRTOS basically receives message from server daemon in Unix using socket(UDP).

As the server daemon sends messages, the listener seems like not getting anything from the server

Also I directly attempts to access the listener using telnet command(telnet 192.2.0.208 5701), but the below error message comes out

"telnet : Unable to connect to remote host: Connection refused"

My test scenario is :

1. Get an IP from Server(Unix) using DHCP

    //
    // Initialize lwIP.
    //
    lwIPInit(pucMAC, 0, 0, 0, IPADDR_USE_DHCP);

    //
    // Setup the remaining services inside the TCP/IP thread's context.
    //
    tcpip_callback(SetupServices, 0);

2. Init lwip socket in SetupServices().

lwip_socket_init();

3. Create listener task to receive packets from server daemon(UDP).

    int socket_fd;
    struct sockaddr_in sa, ra;//sa = sender addr, ra= receiver addr
    NET_MSG *sMsg;
    int length;

    u32_t size;
    size = sizeof(sa);

//    addr_setup();
//    portTickType xTime1, xTime2;

    // Setup the local address.
    memset((char *) &ra, 0, sizeof(ra));
    ra.sin_family = AF_INET;
    ra.sin_len = sizeof(ra);
//    ra.sin_addr.s_addr = lwIPLocalIPAddrGet();
    ra.sin_addr.s_addr = inet_addr("192.2.0.208");
    ra.sin_port = htons(S_PORT);//#define S_PORT 5701

    //setup the destination address
    memset((char *) &sa, 0, sizeof(sa));
    sa.sin_family = AF_INET;
    sa.sin_len = sizeof(sa);
    sa.sin_addr.s_addr = inet_addr("192.2.0.3");// for test, hard-corded
//    sDestAddr.sin_addr.s_addr = chgd_in_addr();
    sa.sin_port = htons(S_PORT);

    while((socket_fd = lwip_socket(AF_INET, SOCK_DGRAM, 0)) == 0)
    {
        DisplayString(115, 210 - 10, "  lwip socket error...  ");
        //xTaskDelay(CHGD_OPEN_TIME);
        xTaskDelay(SECONDS(5));//arbitrary time for test
    }

    //bind socket to the local address and port
    if(lwip_bind(socket_fd, (struct sockaddr *) &ra, sizeof(ra)) == -1)
    {
        lwip_close(socket_fd);
        DisplayString(115, 190 - 10, "  bind error...  ");//Display message on LCD in LM3S9B96
    }

    while(1)
    {

        //receive from server
        length = lwip_recvfrom(socket_fd, (char *) msg_buf, sizeof(msg_buf),
                MSG_DONTWAIT, (struct sockaddr *)&sa, &size);

        if(length > 0)
        {
            sMsg = (NET_MSG *) (msg_buf);
            mon_cmd_do(socket_fd, &sa, sMsg, length);
        }

        lwip_close(socket_fd);
        xTaskDelay(1);// 1ms tick delay
    }


As the program is executed, it seems like not binding socket properly since "bind error..." is displayed on LCD.

Here is my lwipopts.h

#define SYS_LIGHTWEIGHT_PROT            1           // default is 0
#define NO_SYS                          0           // default is 0
#if !NO_SYS
#define RTOS_SAFERTOS                   1
#define RTOS_FREERTOS                   0
#endif /* !NO_SYS */

#define MEMP_NUM_PBUF                   64
#define MEMP_NUM_TCP_PCB                40
#define MEMP_NUM_TCP_SEG                48
#define MEMP_NUM_SYS_TIMEOUT            10
#define PBUF_POOL_SIZE                  64

#define IP_REASSEMBLY                   0           // default is 1
#define IP_FRAG                         0           // default is 1

#define LWIP_DHCP                       1

#define LWIP_AUTOIP                     1           // default is 0
#define LWIP_DHCP_AUTOIP_COOP           ((LWIP_DHCP) && (LWIP_AUTOIP))
                                                    // default is 0
#define LWIP_DHCP_AUTOIP_COOP_TRIES     5           // default is 9


#define TCP_WND                         4096   // default is 2048
#define TCP_MSS                        1500        // default is 128
//#define TCP_CALCULATE_EFF_SEND_MSS      1
#define TCP_SND_BUF                     (6 * TCP_MSS)
                                                    // default is 256
#define TCP_SND_QUEUELEN                (MEMP_NUM_TCP_SEG)

#define PBUF_LINK_HLEN                  16          // default is 14
#define PBUF_POOL_BUFSIZE               256
                                                    // default is LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
#define ETH_PAD_SIZE                    2           // default is 0

#define TCPIP_THREAD_NAME              "tcpip_thread"
#define TCPIP_THREAD_STACKSIZE          1024
#define TCPIP_THREAD_PRIO               3
#define TCPIP_MBOX_SIZE                 32

#define LWIP_NETCONN                    1           // default is 1

//*****************************************************************************
//
// ---------- Socket Options ----------
//
//*****************************************************************************
#define LWIP_SOCKET                     1           // default is 1
#define LWIP_COMPAT_SOCKETS             0
#define LWIP_POSIX_SOCKETS_IO_NAMES     0
#define LWIP_TCP_KEEPALIVE              0
#define LWIP_SO_RCVTIMEO                0
#define LWIP_SO_RCVBUF                  0
#define SO_REUSE                        0

#define LWIP_PROVIDE_ERRNO              1            //Add for lwip socket errors

#define LWIP_STATS_LARGE                  1

#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF

#define LWIP_DBG_TYPES_ON               (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)


So far I don't see any clues to figure this out.

If anyone can help me out, I will appreciate that.

Thank,

Jin



_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users

________________________________
_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users


________________________________
_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users




_______________________________________________
lwip-users mailing list
address@hidden<mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20130930/e275aa1c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic_plastic_cool_26x130.gif
Type: image/gif
Size: 454 bytes
Desc: pic_plastic_cool_26x130.gif
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20130930/e275aa1c/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icon_in_blue_14x14.gif
Type: image/gif
Size: 146 bytes
Desc: icon_in_blue_14x14.gif
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20130930/e275aa1c/attachment-0001.gif>

------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

End of lwip-users Digest, Vol 121, Issue 27
*******************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]