_lwevent_set hangs

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

_lwevent_set hangs

1,317 Views
eichest
Contributor I

Hello everyone

 

I have a problem in one of my applications. I have a timer interrupt which should trigger every ms an event. The problem is that after some time (20 min - 2h), the _lwevent_set functions hangs up.

      while (q_ptr != (QUEUE_ELEMENT_STRUCT_PTR)         ((pointer)&event_ptr->WAITING_TASKS))      {         td_ptr = (pointer)q_ptr;         _BACKUP_POINTER(td_ptr, TD_STRUCT, AUX_QUEUE);         next_q_ptr = q_ptr->NEXT;         if (((td_ptr->FLAGS & TASK_LWEVENT_ALL_BITS_WANTED) &&             ((td_ptr->LWEVENT_BITS & set_bits) == td_ptr->LWEVENT_BITS)) ||            ((!(td_ptr->FLAGS & TASK_LWEVENT_ALL_BITS_WANTED)) &&             (td_ptr->LWEVENT_BITS & set_bits)))         {  /* Start CR 406 */#if 0            _QUEUE_DEQUEUE(&event_ptr->WAITING_TASKS, q_ptr);#endif            _QUEUE_REMOVE(&event_ptr->WAITING_TASKS, q_ptr);/* End CR 406 */            _TIME_DEQUEUE(td_ptr, kernel_data);            td_ptr->INFO = 0;            _TASK_READY(td_ptr, kernel_data);            /* store information about which bits caused task to be unblocked */            td_ptr->LWEVENT_BITS &= set_bits;            set_bits &= ~(event_ptr->AUTO & td_ptr->LWEVENT_BITS);                     } /* Endif */         q_ptr = next_q_ptr;      } /*

next_q_ptr is equal to q_ptr, so the while loop becomes an endless loop. I don't know why this can happen.

 

Did someone else already have a similar problem? The interrupt is installed by calling _int_install_isr().

 

The platform is a Kinetis PK60DN512VLL10 with MQX V3.8 compiled on Codwarrior 10.2.

 

Best regards

Stefan

0 Kudos
Reply
4 Replies

844 Views
c0170
Senior Contributor III

Hi eichest,

 

find _int_install_kernel_isr in MQX reference manual. It might be a solution for your problem. You are using timer to trigger an even every ms, which could raise some latency problems.

 

This is copied from User Guide: Note that _int_install_kernel_isr() call is only enabled if the vector table is located in RAM memory (see MQX_ROM_VECTORS configuration option in section 3.14, “Configuring MQX at Compile Time”).

 

Regards,

MartinK

0 Kudos
Reply

844 Views
WHookway
Contributor III

  I have the same problem with a 82259-V2 and MQX 3.6.   Can you tell me what you think the problem is?  What leads you to believe this is an interrupt latency problem?  Shouldn't I be able to call as often and as fast as I want to start a thread running that has been blocked pending on an event?  The processing time for the lwevent_set is on the order of 8 uS and I am setting calling this function in a serial interrupt service routine, the entire receive interrupt time is less than 15uS.  Note that I had done a similar thing on another project that used the SPI at a much higher baud rate.  The transmit routine is in the interrupt service for less than 5 uS.  These times are my application times and does not include the MQX overhead.  What did Stefan find as to the solution to his problem?

Thanks,

Will Hookway

0 Kudos
Reply

844 Views
WHookway
Contributor III

Answer to my problem.  Since I had ported a large number of my base file from another application, I had provided alternate functions for interrupt enable and disable for project builds that did not include MQX.  These files were still in the build so the  function calls that enables / disables interrutps in the lwevent_set was not doing anything.  Didn't discover this until I actually stepped into the disable call.  Anyhow this was the source of my problem, not an interrupt latency problem.  This may help others if they stumble onto this unusual scenario.

Regards,

Will

0 Kudos
Reply

844 Views
eichest
Contributor I

Hi Kojto

 

Thanks for your answer, it seems you are right and I have/had a problem with the interrupt latency. I hope I could solve the problem by changing the priorities (a test is running).

 

But I'm still a little confused how it can happen that _lwevent_set hangs. I have no explaination for that, do you know what could be the problem there? Because I'm a little afraid that the problem could occur again after 1-2d.

 

Best regards,

Stefan

0 Kudos
Reply