Hi there
I have been playing around with the M52233DEMO board and InterNiche's network stack and have encountered a few problems with NicheTask.
I have a simple application in mind that I have been battling to complete. I want to modify the existing ColdFire Lite project (webserver) to include a task which sends a single UDP packet containing some string and then idles. My code is as follows:
In the function create_apptasks()--
Code: e = TK_NEWTASK(&kel_udp_task); if (e != 0) { dprintf("udp task create error\n" ); panic("create_apptasks" ); return -1; // compiler warnings }
I have declared the task Object--
Code:TK_OBJECT(to_keludpclient);TK_ENTRY(tk_keludpclient);struct inet_taskinfo kel_udp_task={ &to_keludpclient, "KEL UDP Client", tk_keludpclient,
NET_PRIORITY,
APP_STACK_SIZE };
My task code is as follows--
Code:TK_ENTRY(tk_keludpclient){ int e, i=0; char data[]="heres a thing!"; void * event; e=0; while (!iniche_net_ready) TK_SLEEP(1); for (;;) { while (!iniche_net_ready) TK_SLEEP(1); i++; if (i==1) { e=kel_send_udp(data, 14, 0xC0010395, 3490, 3490); } tk_yield(); if (net_system_exit) break; } TK_RETURN_OK();}int kel_send_udp(char *data, int datalen, ip_addr destip, u_short lport, u_short fport){ PACKET data_pkt; int e; void * event; data_pkt=udp_alloc(datalen,0); tk_yield(); if (!data_pkt) printf("trouble allocating packet" ); data_pkt->nb_prot =data; data_pkt->nb_plen =datalen; data_pkt->fhost =destip; e=udp_send(fport, lport, data_pkt); tk_yield(); //************ //this only works if I add in tk_exit at this point //tk_exit(); //************ udp_free(data_pkt); tk_yield(); return e;} Using the code as is, the MCF52233 boots up and sends a UDP packet as expected, but then hangs. The Serial port output stops at--
Calling netmain()...
InterNiche ColdFireLite TCP/
The only way I get it to work without hanging is when I add tk_exit() after I call the udp_send function. Why is this? How do I make the task run properly without having to kill it?
Thanks
Kyle