2021-05-05 02:08 AM
Hello, I'm using STM32F334C8T6 and trying to measure the duration of my calculation section
from MCMP1R (JEXT9) which triggers ADC1 till all TIMER's D CMP registers change.
1) I enabled Global Master Timer Interrupt and MCMP1 interrupt
NVIC_EnableIRQ(HRTIM1_Master_IRQn);
NVIC_SetPriority(HRTIM1_Master_IRQn,1);
HRTIM1->sMasterRegs.MDIER |= HRTIM_MDIER_MCMP1IE;
2) I made the Master Timer Settings in such way:
HRTIM1->sMasterRegs.MCR |= HRTIM_MCR_CK_PSC_0; // 128 MHz * 16
HRTIM1->sMasterRegs.MCR |= HRTIM_MCR_CONT;
HRTIM1->sMasterRegs.MPER = PERIOD; // 40 KHz PWM
HRTIM1->sMasterRegs.MCMP1R = 1024; // 0.5 microseconds
HRTIM1->sCommonRegs.ADC2R |= HRTIM_ADC2R_AD2MC1;
3) And finally the IRQ handler, which doesn't work
void HRTIM1_Master_IRQHandler(void)
{
if(HRTIM1->sMasterRegs.MISR & HRTIM_MISR_MCMP1)
{
HRTIM1->sMasterRegs.MICR |= HRTIM_MICR_MCMP1;
DWT->CYCCNT = 0; //Start of measuring
}
}
Please help, where the proglem is
2021-05-28 05:46 AM
Dear @AZaya.1
Welcome to the STM32 Community
Could you give more details to the STM32 Community about your setup -the material you use- ?
(HW and SW, CPU(s), tools and versions, board(s), motor(s) and so on)
And more especially did you use STM32 MC tools (such as MC_suite, STM32 MC Motor Profile, STM32 MC SDK, STM32 MC Workbench, and so on)?
Best regards
Laurent Ca...