cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative option for GPIO External Interrupt for fast signals

sreyas40
Senior

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?

24 REPLIES 24

This doesn't sound like a good solution, to be honest.
The internal ADCs will achieve a higher sample rate, even at full 16-bit resolution. You can sample arbitrarily large buffers via DMA without wasting any core cycles.
Interfacing such an external device with SPI and an additional "ready" input is not very efficient, the MCU will spend a lot of time (if not most) in interrupt handlers while sampling.
Not to mention, you will need about 25MHz as SPI clock frequency to achieve the required throughput.

@Ozone   

I cant use the internal ADC , as i need conversion error of less than 1mV. 

sreyas40_0-1762509152480.png

does setting timer 12 for the desired delay and  using dma synchronization automatically triggers SPI DMA mode without any interrupts. I dont know how this works

> I cant use the internal ADC , as i need conversion error of less than 1mV. 

Why do you think the internal ADC can't achieve that ?
Conversion errors are given in LSBs, not millivolts.

Nor do I think this situation gets automatically better with an external evice.
Almost every analog IC vendor calls his products "precision".

...does setting timer 12 for the desired delay and  using dma synchronization automatically triggers SPI DMA mode without any interrupts. I dont know how this works

I have no experience with H7 devices.
Try the Cube MCU package for an example of timer-triggered SPI per DMA.
I recently dissected a SPL example showing the exac t same thing (timer-triggered SPI transfer via DMA) for the F37x, and ported it to a F303.Some modifications are probably necessary, such links between timers, DMA channels and peripherals are system-specific.

@Ozone 

>Why do you think the internal ADC can't achieve that ?
Conversion errors are given in LSBs, not millivolts.   - before i got into external ADC , i tested the internal ADC and got error<= 30mV. 

this is the ADC

>Try the Cube MCU package for an example of timer-triggered SPI per DMA  -  I will look into it.

 

This is my first project using STM :) 

 

I interfaced ads8354 to H743, its doesn't have READY pin at all, and lower speed 0.7 MHz. But speed is not an obstacle, and I used 2 SPI in parallel, one is the master another is a slave with pins CS & SCLK jumped.