An issue with ARM interrupts revisits.

groups at chichak.ca groups at chichak.ca
Wed Nov 22 04:41:44 UTC 2017


Back in June 2015 I reported an issue where my program would crash after a very predictable period when working with rtems_event_receive. Sebastian and I tracked the problem down to an issue with the priorities of my interrupts causing an infinite loop in the dealings with “Watchdog” values in events and “NMI”s. (neither watchdog nor NMI are used in the hardware sense).

If my DMA complete interrupts use a priority of less than 0x80 they are interpreted as RTEMS NMI events (I probably have that wrong, but no matter).

Now, I’m trying to get a system going on a ST Cortex-M7 using the same structures and I’m running into this same problem, or maybe something related even though I have set my priorities to 0x80, 0x90, 0xA0, and so on.

I am using the latest head version pulled out of git with the latest tools.

Here is the situation, I have my ADCs set up to deliver results using DMA 200 times per second using two interrupt routines. One routine is called when the ADC buffer is half full, the other when the ADC buffer is full. The interrupt routines execute a rtems_event_send call that is picked up in the task code using rtems_event_receive.

If I don’t call rtems_event_receive (wth a timeout of 100 ticks) the code runs for hours. With the rtems_event_send call, it fails after 125 seconds.

The failure is not something that I have seen before:


#0  _Terminate (the_source=the_source at entry=INTERNAL_ERROR_CORE, the_error=the_error at entry=31) at /Users/andreichichak/development/rtems/kernel/rtems/c/src/../../cpukit/score/src/interr.c:37
#1  0x0800bf6e in _Internal_error (core_error=core_error at entry=INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT) at /Users/andreichichak/development/rtems/kernel/rtems/c/src/../../cpukit/score/src/interr.c:52
#2  0x0800dd38 in _Thread_Do_dispatch (cpu_self=<optimized out>, level=<optimized out>) at /Users/andreichichak/development/rtems/kernel/rtems/c/src/../../cpukit/score/src/threaddispatch.c:186
#3  0x0800f924 in _ARMV7M_Thread_dispatch () at /Users/andreichichak/development/rtems/kernel/rtems/c/src/../../cpukit/score/cpu/arm/armv7m-isr-dispatch.c:32


In _Thread_Do_dispatch, it looks like an maybe an ISR is firing when it is disabled (?) and then _Internal_error is being called.
 

void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
{
  Thread_Control *executing;

  _Assert( cpu_self->thread_dispatch_disable_level == 1 );

#if defined(RTEMS_SCORE_ROBUST_THREAD_DISPATCH)
  if (
    !_ISR_Is_enabled( level )
#if defined(RTEMS_SMP)
      && rtems_configuration_is_smp_enabled()
#endif
  ) {
    _Internal_error( INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT );
  }
#endif


Does anybody have any idea where I should look to figure this out?

Thanks,
Andrei

---------------------
Andrei Chichak

Systems Developer
CBF Systems Inc.
Suite 225 
8215 112 St NW
EDMONTON, ALBERTA
T6G 2C8
CANADA

Phone: 780-628-2072
Skype: andrei.chichak










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20171121/8d3d48fe/attachment.html>


More information about the users mailing list