setting up a UDP “connection” in the DEMO

hello everyone! now that I finally managed to adjust the freeRTOS/uIP demo (for LPC2368 under eclipse with GCC) I tried to make a "UDP task" but got some problems. here’s what I did so far: 1. adjusted folder structure of the project (every source is in the project folder now) –> webserver still works 2. switched from thumb to arm compiling mode –> webserver still works when I disable MAM (MAM is bugged for initial revision and revision A) 3. added my own task, a "dummytask" that only counts up a variable every 10 ticks (with "taskdelayuntil()") –> webserver still works so far, so good :-) now I replaced that basic dummy task with something more advanced. I set the UIP_CONF_UDP in uip_conf.h and include the "myTask.h" file. The Header files look as follows (just to give you a small overview of what I did). ########################   myTask.h:   ####################### #ifndef MYTASK_H_ #define MYTASK_H_ #include "myApp.h" void mytask( void* pvParameters); void myapp_call(void); void udp_config(void); typedef struct udp_state uip_udp_appstate_t; #ifndef UIP_UDP_APPCALL #define UIP_UDP_APPCALL myapp_call #endif extern packet p; extern packet* packet_ptr; #endif /*MYTASK_H_*/ ######################   myApp.h:    ###################### #ifndef MYAPP_H_ #define MYAPP_H_ struct udp_state {     int emptyvar;     int nothing; }; typedef struct my_packet {     unsigned long ticks;     unsigned long number; } packet; #endif /*MYAPP_H_*/ ########################   myTask.c ###################### #include <math.h> #include <string.h> #include "FreeRTOS.h" #include "Task.h" #include "myTask.h" #include "uip.h" packet p; int valid_data = 0; packet *packet_ptr;    struct uip_udp_conn *udp_conn; void mytask( void* pvParameters) {     portTickType xLastWakeTime;     const portTickType xFrequency = 10;     portCHAR buf[20];     portLONG i = 0;     p.ticks = 0;     p.number = 0;            xLastWakeTime = xTaskGetTickCount();         for (;;)     {         vTaskDelayUntil( &xLastWakeTime, xFrequency );         i += 2;         if (i%10 == 0)         {             i = 0;         }         if (valid_data == 0)         {             // get ticks             p.ticks = xTaskGetTickCount();                // increase packt number             p.number++;                    // indicate that p contains valid (= new) data now             valid_data = 1;            }                } } void myapp_call(void) {     int lala = 5;     if ( uip_udp_conn->rport == HTONS(53) )     {         if ( uip_poll() )         {             if (valid_data == 1)             {                 // set packet_ptr to address of uip_appdata (= the uip_buf[])                 packet_ptr = (packet*) uip_appdata;                 // clear the required memory                 memset(packet_ptr, 0, sizeof(packet));                 // write the data into the buffer                 packet_ptr->ticks = p.ticks;                 packet_ptr->number = p.number;                 // send out the data                 uip_udp_send(sizeof(packet));                 // indicate that the data has been send                 valid_data == 0;             }         }         if ( uip_newdata() )         {                     }     } } void udp_config(void) {     uip_ipaddr_t addr;        uip_ipaddr(&addr, 192,168,2,20);     udp_conn = uip_udp_new(&addr, HTONS(53));    } the udp_config i call inside the uIP_Task (as the demo calls httpd() in there too) just befor the endless loop. I also adjusted the uIP_Task loop and added the sequence to call uip_udp_periodic() (an example for thats is provided with the uIP stack code/doc). now my big problem is: after these changes the uIP_Task gets STUCK when initialising the EMAC controller!! the following while loop never gets "false" and thus the uIP_Task just sleeps endless (at least thats how it behaves. the other tasks, like LED and LCD still work and when i want to step _over_ that loop GDB stays on "running" mode) while( Init_EMAC() != pdPASS ) {         vTaskDelay( uipINIT_WAIT ); } sorry for the long post but maybe anyone got an idea what I’m doing wrong? maybe I missed to change a config-settings? thanks in advance D. Holzwarth

setting up a UDP “connection” in the DEMO

There were some posts on this in the uIP mailing this this week – this might provide some useful examples. Regards.

setting up a UDP “connection” in the DEMO

it seems to work now :-) even tho I dont really know why it’s working now and didn’t work before ^^ maybe it got something to do with the unstable MAM of the LPC2368/78 …