This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FPU divide by 0 and High Current Consumption

I was trying to track down high, approx. 6mA, processor current consumption and I have found high current consumption if the FPU executes a divide by 0. If I comment out the line the current consumption goes down to tens of micro amps. If the line is executed then the current is high since the processor is constantly coming out of sleep.

How does the the SDK deal with a divide by 0 with the FPU? I thought this was a hard fault?

Thanks

Parents
  • Ok - that sounds more likely than a hardfault on write. The only thing which comes to mind there is as issue with stacking, or lazy stacking, of the FPU registers when the SVC call is executed or later in the Softdevice handling of them. I suppose that writing the FPCSR register will set the CONTROL.FPCA bit which means the next SVC call (or any interrupt) will stack (or lazy stack) the FP registers.

    That said I can't reproduce this, not in a trivial example anyway, I called an sd_ function inside the loop and it was fine, no hardfault.

Reply
  • Ok - that sounds more likely than a hardfault on write. The only thing which comes to mind there is as issue with stacking, or lazy stacking, of the FPU registers when the SVC call is executed or later in the Softdevice handling of them. I suppose that writing the FPCSR register will set the CONTROL.FPCA bit which means the next SVC call (or any interrupt) will stack (or lazy stack) the FP registers.

    That said I can't reproduce this, not in a trivial example anyway, I called an sd_ function inside the loop and it was fine, no hardfault.

Children
No Data
Related