The FPU module is initialized when the system is powered on. You do not need to initialize it yourself. Hardware access layer and driver layer are not implemented because they are not required to work with this module.
To use this peripheral, simply use floating point instructions and functions.
Important: Remember that the floating point unit that is used in nRF52 supports only the float
type. The double
type is not supported by this architecture and can generate slow and inefficient code.
The FPU FFT Example provides sample code that uses the CMSIS DSP library. You can use this example to quickly get started with floating point unit in interrupt and polling modes with error handling.
CMSIS DSP is an efficient mathematical library designed for ARM Cortex cores that allows signal processing. CMSIS code is supported by ARM.
CMSIS DSP precompiled libraries support Keil, IAR, and GCC compilers.
To use the CMSIS DSP library:
arm_math.h
headerFirst, you must clear the exception flags in the Floating-point Status Control Register and clear the pending FPU interrupt. Otherwise, MCU cannot go to sleep mode. For example:
You must clear exception flags in the FPSCR register and clear the pending FPU interrupt. Otherwise, MCU cannot go to sleep mode.
When using FPU with interrupt handling, remember about the stacked FPU registers and the lazy stacking mechanism.