Dummy_Handler using FreeRTOS

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello to everyone, 

I'm developing a prototype some kind of diagnostics measurements, till yesterday everything was running perfectly but, recently my code in entering the Dummy_Handler() which I've never seen before and I'have no idea what can cause it. I've done some research aboit it and it seems that I'm enabling some kind of interrupts but, the weird thing is that the running period is like 2 minutes maybe less or more and then the the software freezes and goes to the Dummy_Handler(). 

For the purpose of my project I'm using a FreeRTOS and the tracking the code backwards  I can see that go to --- 

taskSECOND_CHECK_FOR_STACK_OVERFLOW();

then 

 

void vApplicationStackOverflowHook(xTaskHandle pxTask,
		signed char *pcTaskName)
{

	/**
	 * Run time stack overflow checking is performed if
	 * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.
	 * This hook function is called if a stack overflow is
	 * detected.
	 */
	printf("stack overflow %x %s\r\n", pxTask, (portCHAR *)pcTaskName);
	for (;;) {
	}
}

which is in the main by default from FreeRTOS. Then jumps to 

 

#elif (defined(__GNUC__) && !XMEGA && !MEGA)

int __attribute__((weak))
_write (int file, const char *ptr, int len);

int __attribute__((weak))
_write (int file, const char *ptr, int len)
{
	int nChars = 0;

	if ((file != 1) && (file != 2) && (file!=3)) {
		return -1;
	}

	for (; len != 0; --len) {
		if (ptr_put(stdio_base, *ptr++) < 0) {
			return -1;
		}
		++nChars;
	}
	return nChars;
}

#elif (defined(__GNUC__) && (XMEGA || MEGA))

int _write (char c, int *f);

int _write (char c, int *f)
{
	if (ptr_put(stdio_base, c) < 0) {
		return -1;
	}
	return 1;
}
#endif

And finally to the Dummy_Handler()

 

I think is some kind of stack overflow butm unfortunately I can figure it out where it happens. Perhaps I use many floats and array to store my measurements  

 

 

 

	volt_prev = volt_edge;//always give value to previous variable to implement edge detection
	volt_edge = afec_channel_get_value(AFEC0, AFEC_CHANNEL_5)* 3.3/4095;

 	output_Volt[0] =  volt_r*Scale[0];
	output_Volt[1] =  volt_r*Scale[1];
 	output_Volt[2] =  volt_r*Scale[2];
	output_Volt[3] =  volt_r*Scale[3];
 	output_Volt[4] =  volt_r*Scale[4];
	output_Volt[5]=   volt_r*Scale[5];
	output_Volt[6] =  volt_r*Scale[6];
	output_Volt[7] =  volt_r*Scale[7];
	output_Volt[8] =  volt_r*Scale[8];

I'm not sure if the above function is written properly because adding more output_Volt floats then actually the problem started...

 

I'll be vary thankful if you can give me some hints how to check my problem.    Using SAM4E-Ek

Last Edited: Wed. Mar 23, 2016 - 10:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metio wrote:
and it seems that I'm enabling some kind of interrupts

So diff your current code with the version from a couple of days ago and see what you changed.

Metio wrote:
Using SAM4E-Ek

In which case this is the wrong forum - I'll move the thread to a SAM forum...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you are in the dummy handler, check the callstack. It should normally point to which instruction lead to the fault that caused you to end up in the dummy handler. 

 

It could also help do define handlers for all those that defaults to dummy_handler (see in the ... system.c file). It should give an idea of which exception is being handled.

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.