cancel
Showing results for 
Search instead for 
Did you mean: 

arm_fir_q15() Hard Fault

Helder Sales
Associate II

Hi,

I've a NUCLEO-F767ZI. I'm having problem getting the arm_fir_q15() to work, it gives me a hard fault. I'm defining the variables like this:

#define BLOCK_SIZE 1
#define NUM_TAPS   51
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 
/* USER CODE BEGIN PV */
uint32_t blockSize = BLOCK_SIZE;
arm_fir_instance_q15 S;
 
static q15_t firStateQ15[BLOCK_SIZE + NUM_TAPS - 1];
static q15_t firCoeffs[NUM_TAPS] =
{
		-93,    -88,    -77,    -60,    -34,      0,     44,     97,    161,
		235,    319,    412,    513,    620,    732,    847,    961,   1074,
		1181,   1281,   1370,   1447,   1509,   1555,   1583,   1592,   1583,
		1555,   1509,   1447,   1370,   1281,   1181,   1074,    961,    847,
		732,    620,    513,    412,    319,    235,    161,     97,     44,
		0,    -34,    -60,    -77,    -88,    -93
};
 
 
uint16_t g_AdcReading[8];
 

After calling arm_fir_init_q15(&S, NUM_TAPS, (q15_t *)firCoeffs, (q15_t *)firStateQ15, blockSize) and the rest of the HAL stuff in the main() function, it proceeds to the DMA interrupt where the data is processed:

void ADC_DMA_Callback(void)
{
	char AsciiData[16] = {0};
	float sin = 0;
	q15_t sinQ15 = 0;
	static float filtSin = 0;
	q15_t filtSinQ15 = 0;
 
	for(uint8_t i = 0; i < 8; i++)
		sin += g_AdcReading[i];
 
	sin /= 8;
 
	sin *= 8.05861e-4;
 
	arm_float_to_q15(&sin, &sinQ15, blockSize);
 
	arm_fir_q15(&S, &sinQ15, &filtSinQ15, blockSize);
 
	arm_q15_to_float(&filtSinQ15, &filtSin, blockSize);
 
	snprintf(AsciiData, sizeof AsciiData, "%.2f,%.2f\n", sin, filtSin);
 
	HAL_UART_Transmit(&huart3, (uint8_t *)AsciiData, strlen(AsciiData), 1);
}

The problem I'm having is that after the call to arm_fir_q15() the system goes to the hard fault loop, giving me this:

0690X00000AtJl1QAF.png

If I use arm_fir_f32() with the appropriate float variables, coefficients, etc., it does function normally. What might be causing this hard fault?

Regards,

Helder

0 REPLIES 0