How to use the FPU module of s32k148?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the FPU module of s32k148?

558 Views
Contributor I

Hi:

      

These days , we are using s32k148, and encountering some problems in FPU module.

The development environment is the MDK5.0 of Keil, debugger uses J-Link, and is configured to use 'Single Precision'.pastedImage_1.png

After the completion of the project initialization, the FPU module is not activated under the debugging environment:

S32_SCB->CPACR = 0

S32_SCB->FPCCR = 0

Program reset when using the defined float variable in the main program.

In addition, try the following test:

Instead of using the hardware debugger, use keil 'Use Simulator' for Debug:

pastedImage_2.png

In the debugging environment, the program runs normally, the floating point variable is normal, and the FPU module is activated

S32_SCB->CPACR = 0x00F00000

S32_SCB->FPCCR = 0x80000000

In view of the above floating-point operation, we hope to get the guidance of the experts as soon as possible

 

Tags (2)
0 Kudos
3 Replies

34 Views
Contributor IV

Hello

In the Keil S32K-148 tutorial, there is a DSP example that uses the FPU.

www.keil.com/appnotes/docs/apnt_305.asp     The example code is available at this page.

I am not sure this will work on the Keil simulator - I used a evaluation board.  This simulator does not include S32 peripherals.  It is an instruction set simulator.

This project has a setup for a J-Link.  See screen below.  ULINKplus is next to configure.

In this example ARM_MATH_CM4  __FPU_PRESENT is defined.  See the screen below in the C/C++ tab.

In DirtyFilter.c there is also::    #include "arm_math.h" 

Give this a try and let us know how you make out.

This program works slower with the FPU disabled.

The current version of MDK is 5.24a and 5.25 will be released soon.  5,25 adds ULINKplus support (Power measurement)   www.keil.com/ulinkplus.

Thanks

Bob Boys

San Jose, California

pastedImage_1.png

pastedImage_6.png

0 Kudos

34 Views
Contributor I
hello,
       I've tried the example of DPS. Debugger used J-Link,but,the program was not working properly.
      
       In addition, I did the following test:
       1. We built a new s32k144 project, including floating-point operation ran normally on the s32k144 chip.
 And then debugged the same project on s32k148, but not worked.  
       2. We built a new s32k148 project, including floating-point operation. And then debugged the project on the s32k144 chip,
the FPU control register could be written normally.(CPACR value from 0 to 0x00F00000, FPCCR value from 0xC0000000 to 0x80000000)
       
       In the debugged process, we found some problems:
       1. When debugging s32k148, the FPU control regisers (CPACR/FPCCR) could not be writen, and the value was always 0.
       2. When debugging s32k144, the FPU control regisers (CPACR/FPCCR) could be modified, and the FPCCR initial value was 0xC0000000 (Different from s32k148).
       3. Are the samples of s32k148 we got mass production chips ? Several identification information on the surface of chip are as follows:
          'PS32K148UAVLQ', 'ON20V', 'OFFSYSTEM 5'.
       
       I'm waiting for your reply, thanks.
0 Kudos

34 Views
Contributor IV

Hello

You didn't specify what problems you had with the example programs.

I tried the two DSP examples and when using a J-Link - something has changed.  It now gives me a Cannot Access Memory when attempting to enter Debug mode.

It still works fine with OpenSDA CMSIS-DAPmode (I didn't try P&E mode) and ULINK2.

The solution is to unselect Verify Code Download. This is easy to do.

pastedImage_1.png

When not in debug mode

  1. Select J-Link in the Target Selector box.
  2. Select Project/Options for Target (or Alt-F7 or pastedImage_1.png) (I call this the the Magic Wand)
  3. Select the Debug tab.
  4. J-Link should be visible as the debugger.
  5. Select the Settings:  box.
  6. Under Download Options, unselect Verify Code Download.
  7. Click OK twice to go back to the main uVision menu.

Ought to work now.

For some reason, the Logic Analyzer with J-Link is not preloaded with the four variables with J-Link.

When you run the program, the Watch window variables will update showing it is working.

I will update these example files Monday..

I don't think you have to setup specific FPU registers - CMSIS file such as core_cm4.h will do this.  This is what CMSIS is for - takes care of all these things for you.

Thanks

Bob

0 Kudos