# Sporadic hard faults, how to find reason

**URL:** <https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026>\
**Category:** Kernel\
**Created:** [January 30, 2016, 12:21am UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026 "2016-01-30T00:21:54Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 31, 2016, 8:56pm UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/21 "2016-01-31T20:56:50Z")

</div>

**[gerhardkreuzer](https://sourceforge.net/u/gerhardkreuzer/)** wrote on [Sunday, January 31, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#2d8e):

… oh, this include in trcConfig.h helps:

```auto
/* Silicon Labs includes. */
//#include "em_chip.h"

#include "arm_const_structs.h"

/ ******************************************************************************
 * SELECTED_PORT
 *

```

and there is a problem within trcHardwarePort.c, I need to hard code the processors clock frequency …

```auto
if (RecorderDataPtr->frequency == 0)
	{
		// RecorderDataPtr->frequency = TRACE_CPU_CLOCK_HZ / HWTC_DIVISOR;
		RecorderDataPtr->frequency = 100000000 / HWTC_DIVISOR;
	}

```

Doesn’t kow if it really works but it compiles now, this is a lot …

And now the big question:  
Hoe can I have a ‘TRACE’ configuration and a ‘NOTRACE’ configuration. like the ‘Degug’ and ‘Release’ configurations in Studio 6.2

Thanks a lot

With best regards

Gerhard

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 31, 2016, 9:14pm UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/22 "2016-01-31T21:14:07Z")

</div>

**[gerhardkreuzer](https://sourceforge.net/u/gerhardkreuzer/)** wrote on [Sunday, January 31, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#10c8):

… and what do I get after hours of fiddling around?

As soon as I call ‘uiTraceStart();’ I get an hard fault … really nice …

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [January 31, 2016, 9:31pm UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/23 "2016-01-31T21:31:36Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Sunday, January 31, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#2d8e/7170):

> And now the big question:  
> Hoe can I have a ‘TRACE’ configuration and a ‘NOTRACE’ configuration.  
> like the ‘Degug’ and ‘Release’ configurations in Studio 6.2

Either include the header file at the bottom of the FreeRTOSconfig.h  
file, or don’t. If you don’t include it, also don’t initialise or start  
the trace recorder.

> As soon as I call ‘uiTraceStart();’ I get an hard fault …  
> really nice …

Did you call vTraceInitTraceData() before calling vTraceStart()?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 31, 2016, 10:37pm UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/24 "2016-01-31T22:37:55Z")

</div>

**[gerhardkreuzer](https://sourceforge.net/u/gerhardkreuzer/)** wrote on [Sunday, January 31, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#68c9):

… ok, some step further.

The Atmel document is defenitely wrong, they try to tell me, I only have to invoke uiTraceStart();  
Correct is that I first have to invoke

```auto
vTraceInitTraceData();
uiTraceStart();

```

So, now I tried to setup the free version of the viewer. Ok, I found the infos in the map file, it looks different than described, but I am pretty shure I got it.

Now they tell me, that I have input this data in the ‘Settings --’ menue. But, this, and all others were disabled …  
And there is a menu point ‘Atmel Studio’, here I am able to click ‘Read’, but … Error.

Ok, and now?

With best regards

Gerhard

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 31, 2016, 10:54pm UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/25 "2016-01-31T22:54:34Z")

</div>

**[gerhardkreuzer](https://sourceforge.net/u/gerhardkreuzer/)** wrote on [Sunday, January 31, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#d8d5):

… ok, second attempt works, works?  
I see a red trace, named Startup, no of my tasks, semaphors, nothing … just useless.

Where can I find a document telling me how to connect this tool to my Atmel Studo or HW so I really get useful information …

With best regards

Gerhard

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [February 1, 2016, 6:31am UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/26 "2016-02-01T06:31:50Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, February 01, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#d8d5/aadf):

I think the stand-alone trace viewer/IDE has a help system, accessible  
by the help menu, that has quite a lot of useful documentation.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 2, 2016, 8:25am UTC](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026/27 "2016-02-02T08:25:21Z")

</div>

**[gerhardkreuzer](https://sourceforge.net/u/gerhardkreuzer/)** wrote on [Tuesday, February 02, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/53b486f2/#d8d5/f14f):

… works. Problem was installing the hooks …  
Case can be closed now.

[Previous page](https://forums.freertos.org/t/sporadic-hard-faults-how-to-find-reason/2026.md?page=1)
