FRDM-K66F - SDK 2.11.0 error in - arm_rfft_fast_init_f32()

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

FRDM-K66F - SDK 2.11.0 error in - arm_rfft_fast_init_f32()

Jump to solution
1,341 Views
aaronminner
Contributor III

I wrote a FFT program in SDK 2.8.0 and it worked fine. I couldn't update the project to SDK 2.11.0 because the upgrade process caused so many compile errors; it was easier to just create a new project and copy the relevant code from my original project to the new one. However, when I called arm_rfft_fast_init_f32() with an fftLen of 128, it failed, returning a code of ARM_MATH_ARGUMENT_ERROR. In the source for arm_rfft_fast_init_f32(), the "case 128U" is effectively blocked out by three undefined parameters. I had to manually #define those parameters before an fftLen of 128 would work. All of the other sizes worked; what's "special" about an fftLen of 128?

 

arm_status arm_rfft_fast_init_f32(
  arm_rfft_fast_instance_f32 * S,
  uint16_t fftLen)
{
  typedef arm_status(*fft_init_ptr)( arm_rfft_fast_instance_f32 *);
  fft_init_ptr fptr = 0x0;

  switch (fftLen)
  {
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_BITREVIDX_FLT_2048) && defined(ARM_TABLE_TWIDDLECOEF_F32_2048) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_4096))
  case 4096U:
    fptr = arm_rfft_4096_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_BITREVIDX_FLT_1024) && defined(ARM_TABLE_TWIDDLECOEF_F32_1024) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_2048))
  case 2048U:
    fptr = arm_rfft_2048_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_BITREVIDX_FLT_512) && defined(ARM_TABLE_TWIDDLECOEF_F32_512) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_1024))
  case 1024U:
    fptr = arm_rfft_1024_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_BITREVIDX_FLT_256) && defined(ARM_TABLE_TWIDDLECOEF_F32_256) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_512))
  case 512U:
    fptr = arm_rfft_512_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_BITREVIDX_FLT_128) && defined(ARM_TABLE_TWIDDLECOEF_F32_128) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_256))
  case 256U:
    fptr = arm_rfft_256_fast_init_f32;
    break;
#endif
    // afm
#define ARM_TABLE_TWIDDLECOEF_F32_64
#define ARM_TABLE_BITREVIDX_FLT_64
#define ARM_TABLE_TWIDDLECOEF_RFFT_F32_128
#if (defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_BITREVIDX_FLT_64) && defined(ARM_TABLE_TWIDDLECOEF_F32_64) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_128))
  case 128U:
    fptr = arm_rfft_128_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_BITREVIDX_FLT_32) && defined(ARM_TABLE_TWIDDLECOEF_F32_32) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_64))
  case 64U:
    fptr = arm_rfft_64_fast_init_f32;
    break;
#endif
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || (defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_BITREVIDX_FLT_16) && defined(ARM_TABLE_TWIDDLECOEF_F32_16) && defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_32))
  case 32U:
    fptr = arm_rfft_32_fast_init_f32;
    break;
#endif
  default:
    return ARM_MATH_ARGUMENT_ERROR;
  }

  if( ! fptr ) return ARM_MATH_ARGUMENT_ERROR;
  return fptr( S );

}

 

Labels (1)
0 Kudos
1 Solution
1,273 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @aaronminner 

 

Please accept my apologies for the delay, and thank you so much for your patience.

 

I was asking to my team about your question, and after double-checking, this part of the code (case 128U) is precisely done in our SDK in order to left the developer or programmer to declare those macros, because as it is not being used on any example of the programs developed in our SDK, those functions for fft are only declared there in order that user can create his/her own code if it is needed.

 

Hope my explanation is helpful, please let me know if you have more questions.

 

Thank you.
Sincerely,
Pablo Avalos.

View solution in original post

0 Kudos
4 Replies
1,315 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @aaronminner 

 

I would like to apologize for the delay. We are overloaded on the Kinetis requests these days. I really appreciate your patience.

 

Regarding your issue, I would like to know which example from our SDK you are using for? And my other question is, what do you refer to "special" on case 128U ? What are you trying to do with this one?

 

Hopefully you can answer me, I will stay tuned to attend you if you have more questions.

 

Best Regards
Pablo Avalos.

0 Kudos
1,307 Views
aaronminner
Contributor III

Hey, Pablo. It's not an SDK example:

arm_rfft_fast_instance_f32 S;
arm_status res = arm_rfft_fast_init_f32( &S, FFTBINCOUNT );
if ( ARM_MATH_ARGUMENT_ERROR == res ) {
while ( 1 ) { __DSB(); }  // something wonky with fast_init_f32
}

Where FFTBINCOUNT = 128.

I had to include the CMSIS_DSP_Library_Source SDK module and update the function arm_rfft_fast_init_f32() to add the following #defines:

#define ARM_TABLE_TWIDDLECOEF_F32_64
#define ARM_TABLE_BITREVIDX_FLT_64
#define ARM_TABLE_TWIDDLECOEF_RFFT_F32_128

And then it would compile.  It's a "special case" in that none of the other switch/case values needed additional #defines.  See the code block in my original post.  It's just kind of curious that, for whatever reason, 128 was unavailable by default.  I don't see anywhere in the project configuration - aside from the Properties --> Preprocessor setting - where the three above #defines would be set.

0 Kudos
1,274 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @aaronminner 

 

Please accept my apologies for the delay, and thank you so much for your patience.

 

I was asking to my team about your question, and after double-checking, this part of the code (case 128U) is precisely done in our SDK in order to left the developer or programmer to declare those macros, because as it is not being used on any example of the programs developed in our SDK, those functions for fft are only declared there in order that user can create his/her own code if it is needed.

 

Hope my explanation is helpful, please let me know if you have more questions.

 

Thank you.
Sincerely,
Pablo Avalos.

0 Kudos
1,271 Views
aaronminner
Contributor III

This makes sense, in a way, though it should be clearly documented and highlighted so developers are aware of this issue and don't have to spend time tracking it down.

0 Kudos