Msg send blocked

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Msg send blocked

Jump to solution
1,411 Views
emilien
Contributor III

Hi,

 

I have a task which sends 1460Bytes UDP datagrams every 0.1 seconds. I'm using IAR+k60n512(rev d)+rtcs onwindows and I'm watching packets with wireshark. I have two problems there:

- First, I have a very high rate of lost packets (ok it's UDP so it should happen sometimes, but I would expect it to be lowerthan 20% :s)

- Second, my network task sometimes stops, with status "Msg send blocked". Then the RTCS task won't even answer toICMP requests.

 

while(1){
if (_lwevent_wait_ticks(&NETW_lwevent, 1, TRUE, 0) != MQX_OK) // it is triggered every 0.1s
_task_block(); 
_lwevent_clear(&NETW_lwevent, 1);
byteCount = sendto(sock, &buffer, sizeof(buffer), 0, &raddr, sizeof(sockaddr_in));
if (byteCount != sizeof(filterResult)){
printf("\nsendto() failed with count %ld and error %lx\n Task blocked.", count, RTCS_geterror(sock));
_task_block();
}

}

 

The microcontroller is a bit busy doing other things (from which writing to sdcard, filtering, sampling...) but I set thepriorities of my network task and RTCS higher (lower value) than the other tasks.

I tried the flag RTCS_MSG_NONBLOCK, but still get the same kind of behavior.

I noticed also that even with the provided rtcs examples, it sometimes fails to answer ICMP requests. Do you think it couldbe related to hardware? I already corrected the sdcard+eth issue...

 

Best regards.

 

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
740 Views
emilien
Contributor III

Hi again,

 

It's fixed. If somoene gets the same behavior with RTCS, he/she may look at the interrupt levels. I had barebone code which installed interrupts (_int_install_isr ...) with very high priority (low value). This seems to break the scheduler. This could explain why the TCP/IP task refused to release. 

However this post (https://community.freescale.com/message/96384#96384) says that it's fixed in mqx 3.8.

Anyway I put higher interrupt values (lower priority) for my user-defined interrupts, and it works now.

 

Best regards.

 

-- 

Emilien

View solution in original post

0 Kudos
Reply
2 Replies
740 Views
emilien
Contributor III

- The lost packets were due to hardware issue (the microcontroller clocks and the Eth clock had the same frequency but different sources, knowing that it's surprising it worked for 80% of packets !)

 

- Actually the "Msg send blocked" seems unrelated to the fact that the TCP/IP task hangs... After a bit of investigation it seems I'm blocked in this:

 

tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);

if (tcpip_msg) {
if (NULL != tcpip_msg->COMMAND)
tcpip_msg->COMMAND(tcpip_msg->DATA);
RTCS_msg_free(tcpip_msg);
}
timeout = TCP_tick();

timeafter = RTCS_time_get();
timedelta = timeafter - timebefore;
timebefore = timeafter;
timedelta = TCPIP_Event_time(timedelta);
if (timedelta != 0) {
if ((timedelta < timeout) || (timeout == 0)) {
timeout = timedelta;
}
}

 

which is inside the tcpip.c file in the RTCS sources. I could not localise exactly the problem but I saw somoene reported issues with the TCP/IP message queue (https://community.freescale.com/thread/95540). Is it fixed? Could this be the problem?

 

 

Best regards

0 Kudos
Reply
741 Views
emilien
Contributor III

Hi again,

 

It's fixed. If somoene gets the same behavior with RTCS, he/she may look at the interrupt levels. I had barebone code which installed interrupts (_int_install_isr ...) with very high priority (low value). This seems to break the scheduler. This could explain why the TCP/IP task refused to release. 

However this post (https://community.freescale.com/message/96384#96384) says that it's fixed in mqx 3.8.

Anyway I put higher interrupt values (lower priority) for my user-defined interrupts, and it works now.

 

Best regards.

 

-- 

Emilien

0 Kudos
Reply