UDP Socket Problem...

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

UDP Socket Problem...

跳至解决方案
1,962 次查看
OOLife
Contributor III

 

Hello?

 

I'm testing UDP Socket program.

 

I made 8 UDP server tasks and each tasks has their own UDP socket.

(MQX Version  3.4.)

 

Every socket was created successfully. ( _RTCS_socket_part_init  is set to  10)

 

_RTCS_socket_part_init = 10;

 

My code works fine with short UDP frame less than 800 bytes frame.

 

But, If UDP frame is longer than 800, recvfrom() function is never return.

(I'm not sure the exact number. But, I just tested by 800 bytes frame and 900 bytes frame sending UDP client.)

 

So, I traced into recvfrom() and I found OVERRUN error.

Received packet length seems to correct, however packet was discarded.

 

I don't understand, why overrun error occured.....

 

How can I received Long(1500) UDP frame.

 

Who can tell me where I'm wrong or something can be modified?

 

I appreciate any kind of your reply...

 

Thank you.

 

标签 (1)
标记 (1)
0 项奖励
1 解答
390 次查看
OOLife
Contributor III

Hi all

 

Finally, I got the answer.

 

Everything works fine !! :smileyvery-happy:

 

Don't create DMA Buffer (of RTCS Task) on the External Memory....

 

It's the answer.

 

BR

OOLife

在原帖中查看解决方案

0 项奖励
2 回复数
390 次查看
OOLife
Contributor III

Hello, experts...

 

Following is my RTCS Setup code.

 

 _RTCSPCB_init = 4; _RTCSPCB_grow = 2; _RTCSPCB_max = 20; _RTCS_msgpool_init = 4; _RTCS_msgpool_grow = 2; _RTCS_msgpool_max  = 20; _RTCS_socket_part_init = 4; _RTCS_socket_part_grow = 2; _RTCS_socket_part_max  = 20;  _UDP_max_queue_size    = 3000;    _RTCSTASK_priority = 6; _RTCSTASK_stacksize = 10000;... error = RTCS_create(); error = ipcfg_init_device(0, mac); error = ipcfg_bind_staticip(0, &ip_data);...// Each Task call this function for socket binding.// currently, I used 8 UDP sockets.void Bindings( uint_32 *pSock, sockaddr_in *pladdr, uint_32 portNo ){ uint_32     error; pladdr->sin_family      = AF_INET; pladdr->sin_port        = portNo; pladdr->sin_addr.s_addr = INADDR_ANY; *pSock = socket(PF_INET, SOCK_DGRAM, 0); if( *pSock==RTCS_SOCKET_ERROR ) {  printf("error; port=%d\n", portNo);  _task_block(); }  error = bind(*pSock, pladdr, sizeof(sockaddr_in)); if( error!=RTCS_OK ) {  printf("error; bind port=%d, error=0x%lx\n", error);  _task_block(); }}// Each Task has infinite while loop.void TASK1( uint_32 initial_data ){ // local variable definition ... Bindings( &sock, &laddr, 20000 ); while( 1 ) {  rlen = sizeof(raddr);  length = recvfrom(sock, buffer, sizeof(buffer), 0, &raddr, &rlen);  printf("received length = %d\n", length);... }}

 

 

Abobe code works fine.

 

However, if frame size is longer than 823 bytes then recvfrom() is never return.

 

CW7.2 / RTCS / Ethernet Status  dialog is shown attached image.

 

Rx DMA Overrun: 63     --> this counter is exactly matched with my test sending counter.

 

How can I fix it?

 

Let me know if I the question isn't very clear.

 

I would like to know how to modify or check my souce code in order to prevent this Rx DMA Overrun error.

 

Regards.

 

0 项奖励
391 次查看
OOLife
Contributor III

Hi all

 

Finally, I got the answer.

 

Everything works fine !! :smileyvery-happy:

 

Don't create DMA Buffer (of RTCS Task) on the External Memory....

 

It's the answer.

 

BR

OOLife

0 项奖励