cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L152 - EXTI and SPI interference

m schuh
Associate
Posted on May 28, 2018 at 16:32

I am having issues using extrenal interrupts together with the spi on my stm32l152re-nucleo board.

I am using theSTM32CubeL1 LL Drivers in the 1.8.0 Version.

I am working with an external device that should give me some interrupt on the PC7 pin. Furthermore I communicate with that device using spi. The SPI MOSI line is connected on the PA7 pin.

Now I have the following problem: Everytime I put data on the MOSI line my interrupt function will be invoced and I have no way to distinguish if it is a real interrupt or just data on my mosi line.

My interrupt initialization:

//enable active high interrupt on PC7
LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_7, LL_GPIO_MODE_INPUT);
LL_GPIO_SetPinPull(GPIOC, LL_GPIO_PIN_7, LL_GPIO_PULL_NO);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTC, LL_EXTI_LINE_7); 
LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_7);
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_7);
NVIC_EnableIRQ(EXTI9_5_IRQn);
NVIC_SetPriority(EXTI9_5_IRQn, 0);�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

I suspect that there is a bug in theLL_SYSCFG_SetEXTISource function. Maybe it also sets the Bit for the PA7(MOSI) line to be passed to the EXTI line? Otherwise I think I should notget interfered with the mosi signal on the interrupt line.

Can someone confirm this as a bug or does somebody know a way to distinguish between a rising edge on mosi(PA7) and the correct interrupt line(PC7)? #stm32l152 #interrupt #exti
1 REPLY 1
Posted on May 28, 2018 at 18:21

Read content of SYSCFG_EXTICR2 and check if it is set as expected. My guess is that it's not and that you either did not properly enabled SYSCFG's clock, or that it needs some delay between that clock being enabled and the SYSCFG register being written.

JW