3 years, 11 months ago.  This question has been closed. Reason: Spam/Innapropriate

How to resolve conflict between Interrupt and DevSPI.h ?

I have developped a code that controls two stepper motors via two expansion boards X-NUCLEO-IHM01A1 (based on L6474 for STM32 Nucleo), and that reads the angular value of these motors via quadrature encoders. For information I use a NUCLEO-F401RE, and eveything works well.

Now I want to add an InterruptIn to detect the zero angle of my encoder. But InterruptIn does not work.

I think I have identify the problem, it seems it come from the stepper motors. Indeed, my code is based on this solution https://developer.mbed.org/teams/ST/code/HelloWorld_IHM01A1_2Motors/ and InterruptIn stop working after I declare DevSPI dev_spi(D11, D12, D13). In devspi.h (Generic mbed Extensions used by STM Expansion Board Firmware Packages) we can read :

" When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after. "

I tried myInterrupt.disable_irq() / myInterrupt.enable_irq() before and after the function but this does not work. I also tried myInterrupt.rise(NULL) / myInterrupt.rise(&flip), and no success. any idea ?