Hard Fault using trigonometric

cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Fault using trigonometric

253 Views
pietrodicastri
Senior Contributor I

Good morning

I need some trigonometric and I start to get hard fault.

The _CFSR is set to 0x80000, meaning trying to use the coprocessor.

I have the MK64F with floating point but no coprosessor.

If I start a new project from the scratch and I try to test the same sin and cos the work.

I am using the KDS.

I need a suggestion on the what is happening.

Thank You

Labels (1)
3 Replies

110 Views
BlackNight
NXP Employee
NXP Employee

Hi Petro,

is your FPU turned on? Try to call/use this from main() if it makes a difference:

void __attribute__ ((noinline)) vPortEnableVFP(void) {

  /* The FPU enable bits are in the CPACR. */
  __asm volatile (
    "  ldr.w r0, =0xE000ED88  \n" /* CAPCR, 0xE000ED88 */
    "  ldr r1, [r0]           \n" /* read CAPR */
    "  orr r1, r1, #(0xf<<20) \n" /* enable CP10 and CP11 coprocessors */
    "  str r1, [r0]           \n" /* store to new value back */
    : /* no output */
    : /* no input */
    : "r0","r1" /* clobber */
  );
}

Note: GNU ARM assembler syntax.

I hope this helps,

Erich

110 Views
pietrodicastri
Senior Contributor I

Thank You

Very much.. It works.....

110 Views
pietrodicastri
Senior Contributor I

Again I don t find the way to mention the correct answer. If I get some assistance for this subject..

Maybe I need to start in a different way other than discussion,...

Thank You 

0 Kudos