Hi all, I want to implement UDP communication between two LPC1768 boards. Coz each board should be able to send msg as well as receive msg at the same time, the only way I thought about is multi-task under RTOS.
I use the RL-RTX and create two tasks. The problem is if I only do some simply stuff in the task, like display a char on the screen, then it works fine. But if I add more in the task, it will stuck somewhere in the while loop.
I tried on one example, Keil\ARM\Boards\Keil\MCB1700\RL\TCPnet\LEDClient, i put the send function into a task. But the code stuck when the 2nd time it starts the while loop. (i use the display function to see the code step) I don't know the reason. Do I miss some key configuration?
__task void send_msg(void) { U8 p2val, cnt, lshf; p2val = 1; cnt = 0; lshf = 1; /* left shift */ while (1) { timer_poll(); main_TcpNet (); while (1) { if (tick == __TRUE) { if (++cnt == 2) { LED_out (p2val); send_data(p2val); p2val = lshf ? (p2val << 1) : (p2val >> 1); if (p2val == 0x80) lshf = 0; if (p2val == 0x01) lshf = 1; cnt = 0; } tick = __FALSE; } } }
/////////////////////////////////////////////////////////////////////////////////////////////// well...I changed the priviledged mode in RTX_Config, set OS_RUNPRIV to 1. Then it seems all right...I am not totally understand it right now, I'm quite a rookie in embedded sys...
Another thing is the stack setting in config file. I find there're two places to set stack size. One in startup_LPC17xx.s Stack_Size and another in RTX_Config.c OS_STKSIZE...I don't really know how to properly set it...
Thanks all. ///////////////////////////////////////////////////////////////////////////////////////////////