Not applicable
Jun 20, 2012
06:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 20, 2012
06:02 AM
I wish to ask wich type of API is used in WEBSERVER001_Example1 or WEBSERVER001_Example2 from lwIP Stack.
Conform lwIP documentation there are some types of API wich can be used: Raw API or Netconn API
I wish to send some data over a network/Internet using TCP sockets, but I don't know wich type of API should I use.
Thank You.
Conform lwIP documentation there are some types of API wich can be used: Raw API or Netconn API
I wish to send some data over a network/Internet using TCP sockets, but I don't know wich type of API should I use.
Thank You.
- Tags:
- IFX
18 Replies
Not applicable
Jun 20, 2012
06:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 20, 2012
06:03 PM
I've started to make a project using lwIP Stack, but when I want to add a function in Main.c which is used by the stack, the editor doesn't recognize that function and I can't use it.
I wrote my_tcp_pcb=new_tcp(); in main file after the initialization of the stack, but when i want to "Open Declaration" I get an error: "Could not find symbol 'tcp_new' in index". If I search manually after tcp_new() I can see that the function is located in MyProject/Dave/Generated/src/ETH004/01_lwIP_Stack/src/include/lwip/tcp.h
Another observation is for initializing the stack, in manual is used: LwIP_Init() but in DAVE is used this function: lwIPStack_init() which can be seen in the WEBSERVER001_Example1 (I used this example as reference).
What could be wrong in my project? Do I have to include another directive(s) in Main.c?
Thank You.
I wrote my_tcp_pcb=new_tcp(); in main file after the initialization of the stack, but when i want to "Open Declaration" I get an error: "Could not find symbol 'tcp_new' in index". If I search manually after tcp_new() I can see that the function is located in MyProject/Dave/Generated/src/ETH004/01_lwIP_Stack/src/include/lwip/tcp.h
Another observation is for initializing the stack, in manual is used: LwIP_Init() but in DAVE is used this function: lwIPStack_init() which can be seen in the WEBSERVER001_Example1 (I used this example as reference).
What could be wrong in my project? Do I have to include another directive(s) in Main.c?
Thank You.
Jun 21, 2012
01:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
01:06 AM
dorinjj wrote:
I've started to make a project using lwIP Stack, but when I want to add a function in Main.c which is used by the stack, the editor doesn't recognize that function and I can't use it.
I wrote my_tcp_pcb=new_tcp(); in main file after the initialization of the stack, but when i want to "Open Declaration" I get an error: "Could not find symbol 'tcp_new' in index". If I search manually after tcp_new() I can see that the function is located in MyProject/Dave/Generated/src/ETH004/01_lwIP_Stack/src/include/lwip/tcp.h
Another observation is for initializing the stack, in manual is used: LwIP_Init() but in DAVE is used this function: lwIPStack_init() which can be seen in the WEBSERVER001_Example1 (I used this example as reference).
What could be wrong in my project? Do I have to include another directive(s) in Main.c?
Thank You.
Hi dorinjj ,
The present lwip app (ETH004) is not using a RTOS but just an internal scheduler so as written in lwip documentation you shall use only Raw_API. http://lwip.wikia.com/wiki/Raw/native_API
tcp_new is correct (I guess new_tcp is a typo).
I can find the definition of tcp_new using the contextual menu without problem. If you have still problem I suggest to rebuild the index (On project right click, index-> rebuld), sometime Eclipse forgets it after the first code generation.
I have no problem to compile the project and use tcp_new(); in the main.c including the same .h files as in the webserver demo. (I guess you problem was related to wrong function name new_tcp)
lwIPStack_init is used to initialize not only the lwip stack but also the webserver. I can agree it is unhappy function name :o. So to initialize just the lwip stack LwIP_Init() is ok.
Best Regards
Oreste
Not applicable
Jun 21, 2012
02:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
02:05 AM
Now is working, the mistake was mine because I used the function with a wrong name 🙂 and the
I suggest to rebuild the index (On project right click, index-> rebuld)was helpfully.
Not applicable
Jun 21, 2012
02:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
02:19 AM
What are the diferences between WEBSERVER001_Example1 and WEBSERVER001_Example2?
Jun 21, 2012
04:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
04:05 AM
dorinjj wrote:
What are the diferences between WEBSERVER001_Example1 and WEBSERVER001_Example2?
The first one just shows how to set up webserver that fetchs html files from a SD card. The page is static.
The second example is litte more complex. In the web page there is a button and when the user press it, a callback function is executed (defined in main.c). This function is calling api of I/O app to toggle a led. (In other word it is a server side scripting based on C)
Not applicable
Jun 21, 2012
05:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
05:19 AM
When I use lwip_init() I think that I have to configure manualy and another things like IP, MAC within the Stack or to "add a network interface", "register the default network interface". It is that true?
I observed that if I use only lwIPStack() into an "empty" project then it is possible to ping the XMC Board from my PC, but if I use lwip_init() and tcp_tmr() which is called by a software timer (SYSTM001) on every TCP_TMR_INTERVAL the ping wil doesn't work.
What are the necessary steps for making the application to respond on ping?
Thank You.
I observed that if I use only lwIPStack() into an "empty" project then it is possible to ping the XMC Board from my PC, but if I use lwip_init() and tcp_tmr() which is called by a software timer (SYSTM001) on every TCP_TMR_INTERVAL the ping wil doesn't work.
What are the necessary steps for making the application to respond on ping?
Thank You.
Not applicable
Jun 21, 2012
07:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2012
07:06 AM
When I want to create a PCB using tcp_new() function, why do I have to use something like this: struct tcp_pcb my_tcp_pcb = *tcp_new();
The declaration of this function is: struct tcp_pcb *tcp_new(void) and I think that I should be allowed to create the PCB in this way: tcp_pcb my_tcp_pcb = *tcp_new(); (without struct).
I know that I have to use Raw API, another question is if can I use the Socket API (Sockets Interfaces)?
The declaration of this function is: struct tcp_pcb *tcp_new(void) and I think that I should be allowed to create the PCB in this way: tcp_pcb my_tcp_pcb = *tcp_new(); (without struct).
I know that I have to use Raw API, another question is if can I use the Socket API (Sockets Interfaces)?
Jun 22, 2012
01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 22, 2012
01:50 AM
When I use lwip_init() I think that I have to configure manualy and another things like IP, MAC within the Stack or to "add a network interface", "register the default network interface". It is that true?
I observed that if I use only lwIPStack() into an "empty" project then it is possible to ping the XMC Board from my PC, but if I use lwip_init() and tcp_tmr() which is called by a software timer (SYSTM001) on every TCP_TMR_INTERVAL the ping wil doesn't work.
What are the necessary steps for making the application to respond on ping?
Thank You.
You are right.
If you look in the lwip
I used ETH004 some time ago and in those example all the configuration you see in lwIPStack() where in the main function and lwip_init was called.
Later it was decide to push al these in the lwIPStack to make it easier to be used.
So I have to correct myself lwIPStack is better in your case becasue it is easier.
Jun 22, 2012
02:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 22, 2012
02:10 AM
dorinjj wrote:
When I want to create a PCB using tcp_new() function, why do I have to use something like this: struct tcp_pcb my_tcp_pcb = *tcp_new();
The declaration of this function is: struct tcp_pcb *tcp_new(void) and I think that I should be allowed to create the PCB in this way: tcp_pcb my_tcp_pcb = *tcp_new(); (without struct).
I know that I have to use Raw API, another question is if can I use the Socket API (Sockets Interfaces)?
1) struct it is required due to C language specification. tcp_pcb it is a struct and not a type defined using typedef.http://en.wikipedia.org/wiki/Typedef#Simplifying_a_declaration For this you can blame the lwip developer ;).
2) As stated here http://lwip.wikia.com/wiki/Porting_For_Bare_Metal netcoon and socket interface are not available without operating system; so you can't :(.
Our developer are working on lwip + operating system but I can't commit any date for this.
Not applicable
Jun 22, 2012
03:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 22, 2012
03:01 AM
This means that I can't establish a "socket connection" between the XMC Board and another device using Raw API?
At begining I wish to send with XMC Board some simple data over network and checking on my PC with a Network Protocol Analyzer software if received data will be the same. I will try this using the rules from "lwIP Session Establishment (Local lwIP client / remote server)" table.
Thank You.
At begining I wish to send with XMC Board some simple data over network and checking on my PC with a Network Protocol Analyzer software if received data will be the same. I will try this using the rules from "lwIP Session Establishment (Local lwIP client / remote server)" table.
Thank You.
Jun 22, 2012
03:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 22, 2012
03:30 AM
dorinjj wrote:
This means that I can't establish a "socket connection" between the XMC Board and another device using Raw API?
At begining I wish to send with XMC Board some simple data over network and checking on my PC with a Network Protocol Analyzer software if received data will be the same. I will try this using the rules from "lwIP Session Establishment (Local lwIP client / remote server)" table.
Thank You.
If your problem it is just send simple data I suggest UDP protocol (simpler to be used).
I have already used UDP in one of past example based on this http://www.ultimaserial.com/avr_lwip_udp.html (use only raw api).
For tcp I have never tried it but you can look at this http://www.ultimaserial.com/avr_lwip_tcp.html example.
Not applicable
Jul 04, 2012
09:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 04, 2012
09:38 AM
Thank You for examples, these are usefull and based on the example with Raw API I have succed in sending UDP packets, but I think that something is missing there. 🙂
I can't figure out how to read UDP packets and I tried a lot of hours for making the application to read UDP packets.
Could You explain how can I read UDP packets?
I know that I have to use udp_recv function, but I'm not sure how to use it and when I tried the code similar like in the example, the microcontroller has blocked.
void udp_recv(struct udp_pcb * pcb,
void (* recv)(void * arg, struct udp_pcb * upcb,
struct pbuf * p,
struct ip_addr * addr,
u16_t port),
void * recv_arg)
I can't figure out how to read UDP packets and I tried a lot of hours for making the application to read UDP packets.
Could You explain how can I read UDP packets?
I know that I have to use udp_recv function, but I'm not sure how to use it and when I tried the code similar like in the example, the microcontroller has blocked.
void udp_recv(struct udp_pcb * pcb,
void (* recv)(void * arg, struct udp_pcb * upcb,
struct pbuf * p,
struct ip_addr * addr,
u16_t port),
void * recv_arg)
Not applicable
Jul 05, 2012
01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 05, 2012
01:35 AM
dorinjj wrote:
Thank You for examples, these are usefull and based on the example with Raw API I have succed in sending UDP packets, but I think that something is missing there. 🙂
I can't figure out how to read UDP packets and I tried a lot of hours for making the application to read UDP packets.
Could You explain how can I read UDP packets?
I know that I have to use udp_recv function, but I'm not sure how to use it and when I tried the code similar like in the example, the microcontroller has blocked.
void udp_recv(struct udp_pcb * pcb,
void (* recv)(void * arg, struct udp_pcb * upcb,
struct pbuf * p,
struct ip_addr * addr,
u16_t port),
void * recv_arg)
Do You think that udp_recv should be called by the Interrupt Service Routine of the Ethernet module?
Not applicable
Jul 10, 2012
05:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 10, 2012
05:15 AM
Finally I have succed in making an udp echo broadcaster application based on that example and with very few modifications. 😄
Jul 10, 2012
08:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 10, 2012
08:09 AM
dorinjj wrote:
Finally I have succed in making an udp echo broadcaster application based on that example and with very few modifications. 😄
Hi,
I am just back from vacation.
I prepared a udp demo project before leaving ofr my vacation but it was not put on the update site due to a technical problem.:(
This is implementing a simple udp echo server. (It send back received udp packet on a different port).
Probably you don't need it but just in case :confused:.
Project name is ETH004_Example and it should be available since tomorrow morning.
You can download it by pressing Install Dave apps/Example Library in the help menu.
Regards
Oreste
Not applicable
Jul 11, 2012
02:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2012
02:57 AM
Do you know how could I to extract data from my pbuf when it will arrive? I tried something in my receive function, but is not working:
/*
udp_data[30]; //used to store incoming data
//my receive function
//...
memcpy(udp_data, p->payload, p->len); //version 1
memcpy(udp_data, p->payload, sizeof(p->payload)); //version 2
//...
*/
Design and Implementation of the lwIP TCP/IP Stack; page 9 (pdf)
-len: "contains the length of the data contents of the pbuf"
-payload: "points to the start of the data in the pbuf"
/*
udp_data[30]; //used to store incoming data
//my receive function
//...
memcpy(udp_data, p->payload, p->len); //version 1
memcpy(udp_data, p->payload, sizeof(p->payload)); //version 2
//...
*/
Design and Implementation of the lwIP TCP/IP Stack; page 9 (pdf)
-len: "contains the length of the data contents of the pbuf"
-payload: "points to the start of the data in the pbuf"
Jul 11, 2012
04:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2012
04:57 AM
dorinjj wrote:
Do you know how could I to extract data from my pbuf when it will arrive? I tried something in my receive function, but is not working:
/*
udp_data[30]; //used to store incoming data
//my receive function
//...
memcpy(udp_data, p->payload, p->len); //version 1
memcpy(udp_data, p->payload, sizeof(p->payload)); //version 2
//...
*/
Design and Implementation of the lwIP TCP/IP Stack; page 9 (pdf)
-len: "contains the length of the data contents of the pbuf"
-payload: "points to the start of the data in the pbuf"
Hi
the correct function should be:
/*** Copy (part of) the contents of a packet buffer* to an application supplied buffer.** @param buf the pbuf from which to copy data* @param dataptr the application supplied buffer* @param len length of data to copy (dataptr must be big enough). No more * than buf->tot_len will be copied, irrespective of len
* @param offset offset into the packet buffer from where to begin copying len bytes* @return the number of bytes copied, or 0 on failure*/
u16_t
pbuf_copy_partial(struct pbuf *buf, void *dataptr, u16_t len, u16_t offset);I don't tried it but from the code, it should be the correct one. (It support chined pbuf)
Regards
Oreste
Not applicable
Jul 11, 2012
05:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 11, 2012
05:37 AM
n=pbuf_copy_partial(p, udp_data, p->len, 0);
Yes, it seems to work. Thank You. 🙂
Yes, it seems to work. Thank You. 🙂