This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: NOCP: Attempt to use co processor Instruction CSFR: FaultISR

Part Number: MSP432P401R

As shown in the picture my code jumps to FaultISR every time From one instruction and that instruction is

if (i < j)
{
     tx = ArrayA[i];             // and that line is this from which it evry time jumps to FaultISR.
     ArrayA[i] = ArrayA[j];
     ArrayA[j] = tx;
         	
}

 after shifting to FaultISR these bits are set as shown in figure... How to solve this problem.

  • Photograph given shows CP10 bit which is also set at FaultISR which shows 

    unprivileged access generates a
    NOCP UsageFault.

  • My first guess is that ArrayA is floating point, and the FPU isn't turned on. It's normally enabled in SystemInit (the source is in your project) as 0x00f00000, based on __FPU_USED. Check the project to see if -D__FPU_USED=1 is set. There's also a project setting (Build Settings->Compiler->Processor->Floating point) which may figure in here somewhere.

    I don't see CPACR in your screenshot. If it's really set to 0x00100000, that's rather unusual, since the reset value is 0 [Ref DUI0553A Table 4-49] and SystemInit doesn't set it to that either.

    In any case, there's nothing wrong with your main() enabling the FPU explicitly (copied from system_msp432p401r.c): 

    >SCB->CPACR |= ((3UL << 10 * 2) | (3UL << 11 * 2)); // Enable FPU

    If ArrayA isn't floating point, my next guess is that you've misspelled an ISR name.

    [Edit: Fixed reference]

  • Adding this line to clock routine just solved my problem.... thank you so much Bruce Mckenney47378   :)

    SCB->CPACR |= ((3UL << 10 * 2) | (3UL << 11 * 2)); // Enable FPU  

  • I'm glad it worked out. This is how we did it back in the Ancient Days. I think there's a mechanism that is supposed to do this auto-magically now, but I never had the patience to figure out how it worked.

**Attention** This is a public forum