HardFault_Handler Error for arm_rfft_fast_f32 and Execution timing for the same is required

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HardFault_Handler Error for arm_rfft_fast_f32 and Execution timing for the same is required

5,407 Views
gauravmore
Contributor III

Hi,

I am new to DSP functionality with respect to LPC CMSIS library. I hae implemented the small code in order to do real FFt on the hard coded samples. I refered the sample codes avaiable with LPC expresso library reagrding the CFFT function.

I have used following  initialization sequence.

#include "arm/arm_math.h"
#include "math_helper.h"

float32_t RealFFT_Input[128] = {

102, 97, 88, 74, 59, 43, 27, 9, -11, -35, -54, -69, -83, -92, -98, -101, -100, -95, -86, -73, -58, -41, -22, -5, 14, 31, 55,
72, 85, 95, 100, 103, 102, 96, 87, 75, 60, 42, 28, 9, -11, -35, -54, -69,
-83, -92, -98, -101, -99, -95, -86, -73, -58, -40, -22, -5, 13, 31, 56, 72, 85, 94, 101,
104, 102, 97, 88, 75, 60, 43, 28, 8, -11, -35, -54, -69, -82, -92, -98, -101, -100, -95,
-85, -73, -58, -41, -22, -5, 14, 32, 55, 72, 85, 95, 101, 103, 102, 96, 87, 75, 60, 43, 27,
8, -12, -35, -54, -70, -82, -92, -98, -101, -100, -94, -86, -73, -58, -41, -22, -4, 14, 31, 56, 73, 85, 94,
101, 104
};

float32_t RealFFT_Output[512];

float32_t RMSValue;

main(void)

{

arm_rfft_fast_instance_f32 rfft_Fast_instance;

arm_status status;

fftlen  = 32

arm_rfft_fast_instance_f32 *rfft_Fast_instance_Ptr = &rfft_Fast_instance;

status = arm_rfft_fast_init_f32(rfft_Fast_instance_Ptr, fftlen );

if(status == ARM_MATH_SUCCESS)
{
   arm_rms_f32(RealFFT_Input, Length, &RMSValue);


   arm_rfft_fast_f32(&rfft_Fast_instance, RealFFT_Input, RealFFT_Output, 0);
}

}

My code is getting compiled properly but when i put it ina debug mode i and getting the RMS value which is 71.213 some thing for 32 point RFFT.

but when i debug this function arm_rfft_fast_f32(&rfft_Fast_instance, RealFFT_Input, RealFFT_Output, 0);

my program counter goes to 

void HardFault_Handler(void)
{

while(1) { }
}

please let me know the resaon for the same. also find my code attached for reference.

I am using LPCexpreso V8.2.2.650 and the latest DSP library of CMSIS. I am running this code in LPC11u68 controller,

Also one more thing I want to know is the execution time of the DSP library used in CMSIS since it running in C code.

Is there anyone who has checked for the timming with respect the the aboe mentioned code  for RMS and RFFT.

Please provide the solution since my application is very time critical and expected time is in uS. 

Labels (3)
0 Kudos
25 Replies

322 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav,

Thank you for your interest in NXP LPC Product, I would like to provide service for you.
About your arm_rfft_fast_f32 question, I find there has a similar question in our community:
https://community.nxp.com/message/759053?commentID=759053#comment-759053
It says, it's the CMSIS DSP library bug, need to change the code at line 57 of file arm_bitreversal2.S
from: #define CODESECT .section text
to: #define CODESECT .section .text
(add . before text)
So, please try it on your side at first.
If you want to know the execution time, you can use the systick timer to test it.
If you still have question about it, please kindly let me know.
Please also tell me where you get the CMSIS package.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

322 Views
gauravmore
Contributor III

Hello Kerry,

I have tried the above mentioned modification but still when i go for debugging it goes to Harddfault handler

__attribute__ ((section(".after_vectors")))
void HardFault_Handler(void)
{ while(1) { }
}

Please fins attached code for your reference, Reest you to modify and check since i check it on my side. but this code is with out change. request you to please verify the change and let me know.

0 Kudos

322 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

    Thanks for your updated information.

   I also test it on my side tody, yes, just modify that point can't solve your problem, maybe this method just useful to the LPC40XX.

    Because I also don't have any example about LPC11U68 DSP project on my side now, the arm_rfft_fast_f32 DSP lib to me also a "black box".

   I have checked your CMSIS_DSPLIB_SRC, I find you have chose the cortex M4 core,

pastedImage_1.png

and also use the LPC43xx chip, so I modify it to cortex M0, and LPC11U68, but code still enter the hard fault.

Now, could you tell me where you get this DSP lib? From the LPCXpresso IDE install path? \Examples\CMSIS_DSPLIB subdirectory (C:\nxp\LPCXpresso_8.2.2_650\lpcxpresso\Examples\CMSIS_DSPLIB\CMSIS_DSPLIB_Latest\CMSIS_DSPLIB_SRC)just like which is mentioned in this post:

CMSIS DSP Library Support 

Please tell me the DSP lib source, if it is really from the IDE install path, I will check it with our according department, just want to know, whether there has some else we need to note, or some bug need to fix.

Waiting for your confirmation.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

322 Views
gauravmore
Contributor III

Hi Kerry,

It is with the IDE installation itself. I downloaded it from LPC Expresso but later on I found that it is there in the LPC expresso installation itself so I deleted it. The path for the DSP library is as follow, Which is imported.

C:\nxp\LPCXpresso_8.2.2_650\lpcxpresso\Examples\CMSIS_DSPLIB\CMSIS_DSPLIB_Latest\CMSIS_DSPLIB_SRC

Alo provide the library for the the same and let us know whether to use LPC Expresso or MCU Expresso since no upgraded version of the LPC expresso is released yet after 

LPCXpresso_8.2.2_650. 

Also provide the latest libraries and the execution time which i have asked for the RFFT or all tranforms functions with respect to  the code. also chec with the reference doe whether the output generated is correct with respect to the DSP library and the timing for the same.

Execution time is very very critical for us in order to move forward considering LPC43xx and LPC11u68 controller. Your details reply will help me to expedite the development whihc is on hold

Thanks 

Gaurav More

0 Kudos

322 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Gaurav More,

   1. About the dsp LIB problem

     I already check it with our according department, and wait for the reply, please wait patiently.

  2. About the code execution time

     You need to test it by yourself, just as I have told you in your case(the same question as this post), you can use the systick to test the execution of the code.

Give you an test example:

    systick_init();    
    cal_systick_read_overhead();
    systick_disable();
    
    //Logic operation with normal C
    systick_init();    
    logic_op_demo_with_normalc();
    systick_disable();

void systick_init(void)
{
    SYST_CVR = 0x0;    //clear current timer value
    SYST_RVR = 0x00FFFFFF;
    SYST_CSR = SysTick_CSR_CLKSOURCE_MASK | SysTick_CSR_ENABLE_MASK;   
}

void systick_disable(void)
{
    SYST_CSR &= ~SysTick_CSR_ENABLE_MASK;
}

void cal_systick_read_overhead(void)
{
      uint32_t cnt_start_value;
    uint32_t cnt_end_value;
    
    cnt_start_value = SYST_CVR;
 
    cnt_end_value = SYST_CVR;
    
    overhead = cnt_start_value - cnt_end_value;
    
#ifdef DEBUG_PRINT
    printf("systick start value: 0x%x\n\r", cnt_start_value);
    printf("systick end value: 0x%x\n\r", cnt_end_value);
    printf("systick current value read overhead: 0x%x\n\r", overhead);
#endif

}

void logic_op_demo_with_normalc(void)
{
    uint32_t cnt_start_value;
    uint32_t cnt_end_value;
    
    uint32_t execution_cycle;    //actual execution cycle
 
    //configure PTA5 as GPIO
    PORTA_PCR5 = PORT_PCR_MUX(1);
 
    //configure PTA5 as output pin
    GPIOA_PDDR |= 0x20;
 
    cnt_start_value = SYST_CVR;
 
    GPIOA_PDOR ^= 0x20;
 
    cnt_end_value = SYST_CVR;
    
    execution_cycle = cnt_start_value - cnt_end_value - overhead;
    
#ifdef DEBUG_PRINT
    printf("systick start value: 0x%x\n\r", cnt_start_value);
    printf("systick end value: 0x%x\n\r", cnt_end_value);
    printf("actual execution cycle for logic operation with normal C code: 0x%x\n\r", execution_cycle);
#endif        
}

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos