7 years, 10 months ago.

Setting interrupt on MISO pin

I am using FRDM-KL46Z to send data to RFM22B rf module. The data to be sent is 480 bytes long, but FIFO mode of the RF module has max packet length of 255 bytes. So I am using Direct Mode where the RF22 sends clock pulses and the uC has to accept these pulses and send one data bit at every rising edge. But unfortunately I don't have any free pins except previously configured SPI pins to connect to the RFM22. So is there a way I can set up an interrupt on the MISO pin of the KL46Z, while also using it as SPI port in other parts of the program? Basically, the pin must be MISO if slave select is on and function as interrupt when SS is off

1 Answer

7 years, 10 months ago.

It depends on the MCU, but I would first check if it works if you simply define an InterruptIn on that pin first, and next define the SPI. Do take into account you need to disable the interrupt before you start your SPI if you do that!

Hi, tried defining interrupt before spi. SPI works fine, but MCU doesn't give an interrupt when interrupt is enabled. Whichever is defined later works! Is there a workaround for this?

posted by Mohamed Azad 31 May 2016

Then same as other one, use the pin_function function to switch between GPIO and SPI.

posted by Erik - 01 Jun 2016