cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeExpansion_LC_Sensor_L4_V1.0.0. stock hardfault

Miroslav Slavik
Associate
Posted on May 22, 2018 at 13:16

Hello,

I am trying to run project lc_sensor_metering from STM32CubeExpansion_LC_Sensor_L4_V1.0.0. I try running it with both system workbench and segger embedded studio but it always generates a hardfault in this function:

static void LC_Init_TIM6(void)

{

Htim6.Instance = TIM6;

Htim6.Init.Prescaler = 0;

Htim6.Init.CounterMode = TIM_COUNTERMODE_DOWN;

Htim6.Init.Period = 100;

HAL_TIM_Base_Init(&Htim6);

if (HAL_TIM_OnePulse_Init(&Htim6, TIM_OPMODE_SINGLE) != HAL_OK)

{

/* Initialization Error */

ErrorHandler();

}

/* Enable update interrupts to use them as events for sleep mode*/

TIM6->DIER |= TIM_IT_UPDATE;

TIM6->SR = ~(TIM_FLAG_UPDATE);

NVIC_ClearPendingIRQ(TIM6_DAC_IRQn);

}

What could possibly be wrong? The project is a example from st, I haven't changed anything, why the hardfault is generated?

Thank you

#tim6 #nucleo-l476rg #lc-sensor
0 REPLIES 0