cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and interrupts

ybitton
Associate II
Posted on February 01, 2012 at 12:44

Hi,

Is there any known problem/limitation on having interrupts during SPI comunication (between micro and external flash for example)?

Thanks.

#spi2-sck-open-drain-output
3 REPLIES 3
Posted on February 01, 2012 at 18:01

Well access to a device on the SPI bus is not going to be atomic, so you might want to consider using semaphore/mutex type controls to arbitrate access, or use a state machine to order access to device(s) on the SPI bus.

I'm not aware of any specific issue with the STM32 implementation of SPI and interrupts.

Perhaps you can be more specific about what you're doing, what happens in the interrupt routines, and issues you are experiencing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ybitton
Associate II
Posted on February 02, 2012 at 13:34

Thanks clive1 for you quick response.

I am using SPI to read from external flash.

Always on the background there is an interrupt (evey mili second) which prefome ADC on other ADC pins.

Somtimes the read from the external flash are incorrect.

If i dissable the interrupts while using SPI the readings are correct.

As i understand there is no limitation on interrupts while SPI is active, Am i correct?

samuel239955_st
Associate II
Posted on July 02, 2012 at 09:07

Hi All,

I am using STM32L SPI2 to communicate with a Analog IC (5V digital system), I expect the MCU output voltage can reach 5V. I configure SPI2 to open drain output and connect both pin to 5 Volt rail via 4.7K resistor, but MOSI can reach 3.8 Volt only, the SCK output 3 volt only.

 /* SPI2  SCK and MOSI pins configuration */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;//GPIO_OType_PP;

  GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

    

   

  GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_SPI2);

  GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_SPI2);

  GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_SPI2);

How to solve this problem?

Regards

Samuel