2025-11-05 9:05 PM - edited 2025-11-07 1:32 AM
Hello,
I'm using Nucleo H723ZG.
In my project, i need to detect a rising edge to trigger a callback. What i have done is that i setup a GPIO as external interrupt, and i verified the code by manually connecting and releasing from 3v3 pin. The actual signal i want to trigger is high for approx 38ns , and the callback is not triggering.
What is the best solution for this?
System operating at - 480MHz
Peripheral clocks - 60MHz
Timer clocks - 120MHz
edit : Can i use Timer input capture for that, does using it in one pulse mode mean it detects a rising edge and then resets until next trigger (as a slave timer)
edit: I tried the timer input capture too, but still same effect, I used the HAL_TIM_IC_CaptureCallback , One pulse mode is enabled, it is in slave mode, I even applied a 1MHz signal still callback is not triggering, when i applied a 100KHz signal the callback triggers properly.
edit: upto 400KHz signal the below callback is properly triggering
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim){
if(htim == &htim4){
strcpy(uart_buf,"triggering - meh\n\r");
HAL_UART_Transmit_DMA(&huart3,(uint8_t*)uart_buf, sizeof(uart_buf));
}
}edit: It seem the Interrupts were triggering, but due to large number of interrupts, the MCU was not able to execute anything. What i want to achieve is that i want to initiate SPI in DMA mode after it overflows (update event), will enabling DMA for timer help?
2025-11-06 12:45 AM
Hello,
38ns high, and what about the low duration?
2025-11-06 1:16 AM
Check the datasheet / reference manual, but all GPIOs have configurable glitch filters implemented.
Here an example I had at hand, for another MCU :
GPIO speed and glitch filter settings are not neccessarily related to the core clock frequency.
2025-11-06 2:03 AM - edited 2025-11-06 3:34 AM
about 570ns low.
I even applied a 1MHz signal still not working, but for 100KHz it is working, but i need it to work for fast signals
2025-11-06 2:35 AM - edited 2025-11-06 3:34 AM
I could only find this in the datasheet
What about the timer input capture, is it same like GPIO EXT Interrupt.
I even applied a 1MHz signal still not working, but for 100KHz it is working, but i need it to work for fast signals.
2025-11-06 3:01 AM
Make sure your signal reaches the pin you intend to. The simplest method is to set that pin as GPIO Out and toggle and observe at the point where you connect your signal.
Make sure the signal has voltages for valid logic levels for your VDD.
Write a minimal but complete compilable program exhibiting the problem and test with that. By minimal I mean no RTOS, no fluff, just clock initialization, setup of the interrupt, and a means to observe the interrupt to occur (e.g. incrementing a volatila counter which is observed in debugger).
JW
2025-11-06 3:09 AM - edited 2025-11-06 3:33 AM
the signal is generated by another timer (PWM) , i verified the signal in a logic analyzer.
I again changed the signal to 100KHz and now the ic callback is triggering , but i need the ic for fast signal like i mentioned in the beginning
2025-11-06 3:41 AM
> edit: I tried the timer input capture too, but still same effect, I used the HAL_TIM_IC_CaptureCallback , ...
Don't you see the problem here ?
Are you not aware that "callbacks" are executed in interrupt context ?
2025-11-06 3:44 AM - edited 2025-11-06 3:45 AM
I don't get it , what is the problem ? i'm still learning :)
2025-11-06 4:20 AM
While you running in interrupt context, especially of the very same interrupt, other one's will be blocked.
Which can especially disastrous when when calling other time-consuming functions that in turn rely on interrupts.
I don't know this HAL UART functions work (I'm not a Cube/HAL user). But either interrupts or busy-wait until the transmission finished.
I don't know what you want to achieve here in your code example, probably only an indication that the EXTI interrupt was triggered.
Better set a flag or increment a counter, which you can access/evaluate from the main loop. That would suffice as a proof of concept. If it works once, it usually works always.
You always need to consider and check your MCU's time budget.