Hard Fault using trigonometric

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

Hard Fault using trigonometric

681 Views
pietrodicastri
Senior Contributor II

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

538 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

538 Views
pietrodicastri
Senior Contributor II

Thank You

Very much.. It works.....

538 Views
pietrodicastri
Senior Contributor II

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