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.

compdcm_mpu9150 Project Questions

1. In the sample code tm4c123gxl sensorhub -> compdcm_mpu9150: the code use alot computation with FPU, but i dont see where the code enables the FPU Unit.

2. If i want to use FPU unit in Interrupt handler, what is the best way i should use!

3. FPU calculation takes a lot of time. do you know in tiva c. how long does it take to compute a fpu operation?

  • Hi Happy, 

    1. it doesn't seem it enables it, maybe in one of the includes of sensor lib or startup file? i searched some of the sensorlib files included and didn't find it. The Tiva does have the ability to do floating point operation like any other small 8-bit MCU (but faster of course) without using the FPU i belive.

    About the 2nd point, it depends, the fastest way is using FPULazyStackingEnable. This is faster, but there's a problem. In both FPUStackingEnable and FPULazyStackingEnable there's a space in stack reserved for the values of  floating-point state.

    FPULazyStackingEnable enables the use of FPU operations inside the interrupt handler, but if there was values needed in the stack, well, they are gone because that space reserved in stack the was used and not restored. This is the fastest way to use the FPU in a interrupt taking only 8 words operations with the compromise of losing the floating-point state on entry

    FPUStackingEnable does almost the same but when the interrupt ends and returns to the main code, it restores the  floating-point state space to the entry values. This will be slower, taking 26 words for stacking operation istead of 8 words

    I don't know calculation time and i'm not gona have a logic analizer for some time to give a rough estimate

    Edit:

    Found this in a TivaWorkshop doc, this bit of code 

    while(i32DataCount < SERIES_LENGTH)
    {
    gSeriesData[i32DataCount] = sinf(fRadians * i32DataCount);
    i32DataCount++;
    }

    "it took about 480 clock cycles to run each calculation

    and update the i32dataCount variable (plus the looping overhead)."

    So if you use a the Tiva at 80Mhz it takes about 6uS, that doing all that each cycle of the loop

  • Consider this project, if i want to update the Eulers angle at a faster rate than the default code. How can i do that?