There's a total of 2 ICU channels, one using Timer 8(ch1), and the second one using Timer 15(ch1). The channel using Tim8 works as expected, but Tim15 ICU callback never fires. I checked for hardware pitfalls.
This is part of a ported design that also runs on F405 and works well there.
Current MCU is H735*
Code: Select all
static void icuperiodcb_in1(ICUDriver *icup) {
ICU1_ISR_Handler(0, icuGetPeriodX(icup));
}
/**
* CH1 (TIM8_CH1)
*/
static ICUConfig icu1cfg = {
.mode = ICU_INPUT_ACTIVE_LOW,
.frequency = FIFTY_MHZ,
.width_cb = nullptr,
.period_cb = icuperiodcb_in1,
.overflow_cb = nullptr,
.channel = ICU_CHANNEL_1,
.dier = 0U,
.arr = 0xFFFFFFFFU,
};
static void icuperiodcb_in2(ICUDriver *icup) {
ICU2_ISR_Handler(0, icuGetPeriodX(icup));
}
/**
* CH2 (TIM15_CH1)
*/
static ICUConfig icu2cfg = {
.mode = ICU_INPUT_ACTIVE_LOW,
.frequency = FIFTY_MHZ,
.width_cb = nullptr,
.period_cb = icuperiodcb_in2,
.overflow_cb = nullptr,
.channel = ICU_CHANNEL_1,
.dier = 0U,
.arr = 0xFFFFFFFFU,
};
palSetPadMode(GPIOJ, 8, PAL_MODE_ALTERNATE(3)); // tim8, ch1
palSetPadMode(GPIOE, 5, PAL_MODE_ALTERNATE(4)); // tim15, ch1
icuStart(&ICUD8, &icu1cfg);
icuStart(&ICUD15, &icu2cfg);
icuStartCapture(&ICUD8);
icuStartCapture(&ICUD15);
icuEnableNotifications(&ICUD8);
icuEnableNotifications(&ICUD15);
icuperiodcb_in2() never gets called