Skip to main content
RShar.9
Associate III
Dec 25, 2019 9:50 AM UTC
Question

How to configure external interrupt on SPI_MISO pin in STM32H7

Hello ,

i am using LDC1101 proximity sensor and it data ready interrupt on SPI_MISO pin.

Can any one please tell to how to configure a pin both SPI_MISO and External interrupt.

thanks

This topic has been closed for replies.

7 replies

S.Ma
Principal
Dec 25, 2019 6:45 PM UTC

For STM32L4, you can have EXTI on alternate function like MOSI, MISO, SCK etc..

HAL was not providing this feature, so you need to hack it by controlling the registers directly.

CubeMX and HAL restrict what the HW can do.

We did post and answer this question in this forum, although searching the forum might be tricky.

RShar.9
RShar.9Author
Associate III
Dec 26, 2019 5:40 AM UTC

thanks for the reply, can we do that in stm32h7 also or not.

can you please tell me how to do that, i found nothing about it on forum.

gahelton1
Associate III
Nov 9, 2021 3:11 AM UTC

I know that this is an old thread, but I have an identical need - that is, have an external interrupt on the MISO line while the SPI is enabled.

Here are a few code snippets from what I have, but for some reason, I cannot get the external interrupt to trigger.

The processor is an STM32F407.

The interrupt is connected to the MISO line (PB4).

The interrupt is to be negative edge triggered.

 //**************************************************
 
 // Configure PB4 (EXTI4) for falling edge trigger
 
 // Enable EXTI4 interrupt in NVIC, but don't enable
 
 // the local ISR enable until we are ready.
 
 //**************************************************
 
 
 
 EXTI->FTSR |= EXTI_FTSR_TR4;
 
 NVIC_EnableIRQ(EXTI4_IRQn);

//*******************************************
// Enable global interrupts
//*******************************************
 
__enable_irq();

	//*******************************
	// Enable external ISR on PB4
	//*******************************
 
	EXTI->IMR |= EXTI_IMR_MR4;

Looking into the EXTI registers, I see that the interrupt is enabled, and falling edge triggered.

0693W00000GWsK8QAL.png 

Of course, I am not using HAL. I don't trust him - you know why.

What am I missing here ?

Thanks in advance.

waclawek.jan
Super User
Nov 9, 2021 6:33 AM UTC

You have to select the proper port in SYSCFG_EXTICR.

JW