Skip to main content
RShar.9
Associate III
December 25, 2019
Question

How to configure external interrupt on SPI_MISO pin in STM32H7

  • December 25, 2019
  • 3 replies
  • 2983 views

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.

3 replies

S.Ma
Principal
December 25, 2019

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
December 26, 2019

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
November 9, 2021

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
November 9, 2021

You have to select the proper port in SYSCFG_EXTICR.

JW