title: Kiss FFT on TI MSP430FR6989
body: <p>I am trying to run Kiss FFT (<a href="https://github.com/mborgerding/kissfft" rel="nofollow noreferrer">Kiss FFT github</a>) on an MSP430FR6989 Launchpad. For now, I'm just trying to get the kiss_fftr test shown <a href="https://stackoverflow.com/questions/14536950/applying-kiss-fft-on-audio-samples-and-getting-nan-output">here</a> to work. I am running into an issue with kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem). My input is (16, 0, NULL, NULL). The function reaches this point in kiss_fftr.c and then returns NULL due to the !st if statement.</p>
  <pre><code>if (lenmem == NULL) {
      st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded);
  } else {
      if (*lenmem &gt;= memneeded)
          st = (kiss_fftr_cfg) mem;
      *lenmem = memneeded;
  }
  if (!st)
  {
      return NULL;
  }
  </code></pre>
  <p>Malloc sets st to NULL, so it failed to allocate the memory. I am sure that there is enough memory available in my MCU. My memory allocation in CCS is 35% RAM (736/2048), 3% FRAM1 (1896/48000) and 28% FRAM2 (23144/81912).</p>
  <p>Does anyone have advice on how to fix this, or what I should learn to fix this? I don't want to chase down the wrong rabbit hole if memory allocation is not the issue.</p>
  <p>What I've tried: When I try running the test code given in the stack overflow link and sending the output array over UART, I get no output. I checked to see if kiss_fft_alloc is working correctly by making an if statement (st == NULL) that would throw a KISS_FFT_ERROR. The error threw at the point mentioned above, but I cannot figure out how to &quot;fix&quot; malloc failing to allocate memory.</p>