lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Tcp Server on Texas Instrument RM57


From: Julio Cesar Aguilar Zerpa
Subject: Re: [lwip-users] Tcp Server on Texas Instrument RM57
Date: Mon, 31 Oct 2016 10:00:07 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hi Noam,


Thank you for helping me.


1. First of all are you running with an OS or without?
    I am using the RM57 Microprocessor -> without OS

2. Secondly do you understand that with RAW API you should not call any LwIP if the call is not from within the LwIP own context?
    That is a very important point that I didn't know about! So, then how should I send data? How do I initialize the pbuf pointer?

3. As far as I see you are not copying the data into the new buffer. How is the send itself? does the function tcpecho_raw_send copying the data to the buffer?
   
Yes, you are right. I noticed that. I then tried it with "TEST_DATA" as global. Same problem (but at least the data was correct at tcpecho_raw_send)

4. The code is just partial so I cannot see the picture
    You can see the code if you have the examples. It's the 'tcpecho_raw'. I will attach it just in case you don't have it. I made some minor modifications to check if there's a connection and also added the function already described. (Again: the 'echo' part works -> received data is being sent back correctly, but sending data that wasn't received is not working)

5. Secondly check if tcp_write uses the copy mode into an internal buffer or use a reference to data.
    Yes, it uses the copy mode.

I also tried to send the data using the 'tcp_write' function directly instead of calling tcpecho_raw_send and it returned error -11 (no connection) but was receiving and sending data over the callbacks.

It appears your second statement is one of the reason my program is not working. I don't have any current docu, do you have any?

How do I send data? Is there another example that receives data over callbacks and is able to send data created on its own memory space?

Best regards,
Julio



Am 29.10.2016 um 02:04 schrieb Noam Weissman:

Hi,


First of all are you running with an OS or without ?

Secondly do you understand that with RAW API you should not call any LwIP

if the call is not from within the LwIP own context ?


As far as I see you are not copying the data into the new buffer. How is the send itself ?

does the function tcpecho_raw_send copying the data to the buffer ?


RAW API means that everything you do is in the same context. If you block on the function

tcpecho_raw_send and/or do something that takes too much time yes the data will not properly

handled.


The code is just partial so I cannot see the picture.


I would start with setting your uint8 data[] = "TEST_DATA"; to static OUTSIDE of the function. This way

it will not change when you exit from the function.


Secondly check if tcp_write uses the copy mode into an internal buffer or use a reference to data.


BR,

Noam.




From: lwip-users <address@hidden> on behalf of Julio Cesar Aguilar Zerpa <address@hidden>
Sent: Friday, October 28, 2016 4:56 PM
To: address@hidden
Subject: [lwip-users] Tcp Server on Texas Instrument RM57
 
Hi there,

I am trying to use the LwIP library (1.4.1) to create a simple tcp
server on a Texas Instrument RM57.

So far, I could make the "tcpecho_raw" example to work using an static ip.

I also added the following function (which did not work), to be able to
send data that wasn't an echo:

void tcpServer_send()
{
     uint8 data[] = "TEST_DATA";
     struct pbuf* buffer = pbuf_alloc(PBUF_RAW, sizeof(data), PBUF_POOL);

     if (buffer)
     {
         sciDisplayText(sciREG1, txt_new_line, sizeof(txt_new_line));
         sciDisplayText(sciREG1, "buffer created", sizeof("buffer
created"));

         buffer->tot_len = sizeof(data);
         buffer->len = sizeof(data);
         buffer->payload = data;
         tcpecho_es->p = buffer;

         tcpecho_raw_send(tcpecho_raw_pcb, tcpecho_es);
     }
}

As you can see, the function prints a debug msg ("buffer created"). I
modified the function 'tcpecho_raw_send' to also print a debug msg (the
data being sent).

When I run the program, I can see the msg "buffer created" every time
the function is called, but the msg from 'tcpecho_raw_send' comes only
when I close the client! (And the msg is missing the acutal data, btw).

NOTE: I want to build a server that receives some commands and sends a
block of data (4KB) every 60 ms. I am using the raw API because I don't
want to use blocking functions (from what I understood the netconn API
uses blocking functions).

I would appreciate any help.

Best regards,

Julio Aguilar


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
lists.nongnu.org
Welcome to the lwip-users mailing list. Use it to ask questions, share your experience and discuss new ideas. To see the collection of prior postings to the list ...



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

Mit freundlichen Grüßen
Götting KG
i.A. Julio Cesar Aguilar Zerpa
-- 
M.Sc. Julio Cesar Aguilar Zerpa
Forschung & Entwicklung
address@hidden
Tel. +49(0)-5136-8096-39
————————————————————
Götting KG
Celler Str. 5, D-31275 Lehrte/Röddensen
Geschäftsführer H.-H. Götting
HR A 31127 | Amtsgericht Hildesheim
Gerichtsstand Lehrte
USt.-Id. Nr. DE 115055039
USt.-Nr. 16-226-13403
Phone +49(0)-5136-8096-0
Fax +49(0)-5136-8096-80
address@hidden | www.goetting.de
————————————————————

Attachment: tcpecho_raw.zip
Description: Zip compressed data


reply via email to

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