global volatile variable changed when calling SPI_I2S_GetFlagStatus - STM32F105
Dear All,
I am having a problem that I can't seem to solve by myself.
In my main.c file I declare the following as a global variable:
volatile uint8_t Avar;
In the main file I call a function located in another file to read some bytes from an SPI Flash. When this function calls:
SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) then my variable Avar is changed. How can this happen?
To summarise:
The problem basically is that a global variable is changed in the stm lib file: stm32f10x_spi.c as soon as the function SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) is called.
Info about my setup.
Release 2.0.7.2010061501.7937
Using STM lib V3.3.0
Micro: STM32F105RTC6
Compiling in Debug mode with "USE_FULL_ASSERT"
Is there something I don't understand about declaring my variables correctly?
Hope someone can help me.
Best regards,
Jacob Lillie
-
Make sure that you've allocated enough stack - see http://rowley.zendesk.com/entries/46160-change-the-stack-size-of-my-application for more information on setting the stack size.
Best regards,
Jon Elliott
Please sign in to leave a comment.
Comments
2 comments