2022-01-05 01:39 AM
HAL_TIMEx_ConfigCommutEvent(&htim1, TIM_TS_ITR3, TIM_COMMUTATION_TRGI);
// HAL_TIM_IC_Start(&htim4, TIM_CHANNEL_2);
HAL_TIMEx_HallSensor_Start_IT(&htim4);
here is my config setting:
below is my capturecall back function.
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) // if the interrupt source is channel1
{
if (Is_First_Captured==0) // if the first value is not captured
{
IC_Val1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1); // read the first value
Is_First_Captured = 1; // set the first captured as true
MotorCommutation() // in this function i read hall sensor status
}
else // if the first is already captured
{
IC_Val2 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1); // read second value
MotorCommutation();
}
__HAL_TIM_CLEAR_FLAG(htim,TIM_FLAG_UPDATE);
}
}
Now i don't understand how i should read HALL sensor status using capturecallback function and trigger the desired channel.
Can some help me how I can read the status and trigger the pwm over the commutation event?
2022-01-05 04:05 AM
Dear @Tejashree ,
It seems that you do not use the x-cube-mcsdk available here.
This is the best help we can provide ! Using the MC_SDK, you will end-up with a fully functional project with hall sensors if you selected them. Up to you to analyze the code and understand how did we do.
Regards
Cedric
2022-07-11 08:27 AM
@Tejashree I am also working on the same thing. Did you find any solution?