Non-blocking UDP receive problem - Error 0x1120

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Non-blocking UDP receive problem - Error 0x1120

1,093件の閲覧回数
michael_wahler
Contributor III

Hi,

I'd like to receive UDP packets in a non-blocking way. The problem is that recvfrom returns error 0x1120.

Here's how I initialize the UDP socket:

socket_handle = socket(AF_INET, SOCK_DGRAM, 0);

server_socket_addr.sin_family      = AF_INET;

server_socket_addr.sin_port        = port;

server_socket_addr.sin_addr.s_addr = INADDR_ANY;

status = bind(socket_handle, &server_socket_addr, sizeof(server_socket_addr));

uint32_t opt_value = TRUE;

uint32_t opt_length = sizeof (uint32_t);

status = setsockopt (

  socket_handle,

  SOL_UDP,

  OPT_RECEIVE_NOWAIT,

  &opt_value,

  opt_length

  );

_UDP_max_queue_size = 1;

Cyclically, I call

recvfrom(socket_handle, buffer, sizeof(buffer), 0, &client_socket_addr, &socket_addr_len)

But this line returns error 0x1120. In rtcs_err.h the corresponding line says

     #define RTCSERR_OUT_OF_BUFFERS          (RTCS_ERROR_BASE|0x120)

Any ideas how to solve this problem? The blocking variant works, by the way.

Kind regards

Michael

--

Setup: CW 10.6, MQX 4.1, TWR-K60F120M

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

698件の閲覧回数
Martin_
NXP Employee
NXP Employee

It might be application specific configuration of system resources available for RTCS. Try to increase those before RTCS_create() in similar way as in the example below:

  /* Init RTCS */

  _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 = 100;

  

  _RTCSTASK_stacksize = 4500;

  

  error = RTCS_create();

0 件の賞賛
返信

698件の閲覧回数
michael_wahler
Contributor III

Thanks for your answer. Unfortunately, this does not help. With these parameters, recvfrom receives an empty buffer 20 times and then fails with the same error again.

Any other ideas?

0 件の賞賛
返信

698件の閲覧回数
Martin_
NXP Employee
NXP Employee

Then please check the priority of your application task and compare with the priority of TCP/IP task. By default the priority of TCP/IP task is set to 6. Your application task shall have lower priority (higher number = 7, 8 ...).

Seems like you don't allow the TCP/IP task to service and free the allocated messages, that might be MQX task priority problem.

0 件の賞賛
返信

698件の閲覧回数
michael_wahler
Contributor III

Hi Martin,

I checked the priorities of my tasks:


TCP/IP task - prio 6

Main task (MQX_AUTO_START_TASK) - prio 9

  - spawns hw timer task - prio 7

Still not working though :smileysad: Any other ideas?

Michael

0 件の賞賛
返信