<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using cFFT library NRF_LOG stop with  Hardfault_Handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36294/using-cfft-library-nrf_log-stop-with-hardfault_handler</link><description>HI 
 SDK-15 - NRF52840 
 I&amp;#39;m using SAADC example of the SDK. 
 I read the ADC values and I make an matrix to calculate FFT using the CMSIS library.. 
 the problem is when I print the data after using DSP library (FFT), the program stuck, in dissasembly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 Jul 2018 13:45:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36294/using-cfft-library-nrf_log-stop-with-hardfault_handler" /><item><title>RE: Using cFFT library NRF_LOG stop with  Hardfault_Handler</title><link>https://devzone.nordicsemi.com/thread/139741?ContentTypeID=1</link><pubDate>Wed, 11 Jul 2018 13:45:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b15a05c0-a6cb-4644-80ba-4c8c045590d4</guid><dc:creator>ricardo vasquez rossi</dc:creator><description>&lt;p&gt;Dear Nordik&amp;nbsp;Team&lt;/p&gt;
&lt;p&gt;Finally, i have spent a lot of time trying to fidn a solution, I got it..&lt;br /&gt;The error was the position of INICIALITACION OF THE INSTANCE FFT...(&lt;strong&gt;arm_cfft_instance_q15&amp;nbsp; &amp;nbsp;RealFFT_Instance;&amp;nbsp;&lt;/strong&gt; &amp;nbsp;)&lt;/p&gt;
&lt;p&gt;Before initialization of the variable, it was located in the Saadc_callback function..&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
  ret_code_t err_code;
  int cycle=6;

  ******* HERE WAS THE INSTANCE FFT INICIALITATION ****** I moved to #defined zone of the program
  
  if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
  {
    
    memset(p_event-&amp;gt;data.done.p_buffer, 0, sizeof p_event-&amp;gt;data.done.p_buffer);
    err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After, I moved it to at the begining of the program&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;quot;arm_const_structs.h&amp;quot;
#include &amp;lt;arm_math.h&amp;gt;

#define SAMPLES_IN_BUFFER 1024//512

volatile uint8_t state = 1;

int e, value,  amp ;
float soundVolMax, soundVolAvg, soundVolRMS, soundVolRMSflt;
float soundVolMaxR, soundVolAvgR, soundVolRMSR, soundVolRMSfltR;
float dB;
int AmpMax = SAMPLES_IN_BUFFER;
int MicSamples = SAMPLES_IN_BUFFER;
float signalMin, signalMax, signalAvg;
float difA,difB,difC;

int16_t vibdata[SAMPLES_IN_BUFFER], Incomplex[SAMPLES_IN_BUFFER*2],fftvibout[SAMPLES_IN_BUFFER*2];  

// HERE position 2
arm_cfft_instance_q15   RealFFT_Instance;   // ***** HERE MOVED THE INICIALITATION  **** **



static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(0);
static nrf_saadc_value_t     m_buffer_pool[2][SAMPLES_IN_BUFFER];
static nrf_ppi_channel_t     m_ppi_channel;
static uint32_t              m_adc_evt_counter;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Another problem, I realized,&amp;nbsp; the result of the FFT function all time give me a different result, i saw it in the &amp;quot;Live watch&amp;quot; in the screen shot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But it corrected when the instance was moved to the beginning of the program.&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Ricardo&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>