This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

complete execute a function even when interrupt arise?

Is there any method to complete a function when a interrupt arise. In project, i'm using stm32f103vx.

  • You can disable interrupts around critical sections. But you should only do it for very short times since interrupts are normally intended to be serviced quickly.

    Any reason why you don't spend any time informing why you need to complete your function call even when an interrupt happens? Afraid that too much information supplied by you might result in a too good answer?

  • In project, at every 20ms reading adc value in timer4 interrupt module with a spi2 protocol. And spi2 is also used for the dac. But problem is when i'm updating dac, interrupt is generate from timer4 so dac functionality is not executing properly. so i need a solution other than disable interrupt.

  • Why not synchronzie the clock between ADC and DAC?

    The SPI either is fast enough, or not fast enough to run both ADC and DAC. If the SPI isn't fast enough, then you need to step up the baudrate. If that can't be done then your design doesn't work.

    If the SPI is fast enough, then start a ADC read using SPI when the timer ticks. When the SPI generates an interrupt that it is done - issue the DAC command. If ADC and DAC needs to run on different clocks, then you have no option but suffering the jitter of having to buffer and delay some commands. So if you get a timer tick but the SPI isn't ready then you ened to set a flag - the SPI end-transmit interrupt can then see the flag and issue the delayed ADC command. Or see that there is a delayed DAC command to perform.

    Obviously, the same SPI device should never be used for both ADC and DAC in case the two needs to run at different freqnecy and you can't accept jitter.