cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 SPI (ovr flag not clearing)

nico2
Associate II
Posted on May 08, 2009 at 08:32

STM32 SPI (ovr flag not clearing)

1 REPLY 1
nico2
Associate II
Posted on May 17, 2011 at 13:11

Hi,

I am fairly new to the ST32 family and I have a strange problem occuring.

I have setup the STM32F101CB's SPI in KEIL (see below) and have everything running I can see the timing of all the lines SPI SSN, MOSI, MISO, SPI CLK and works very good. I can see the data on the receive line with a Logic analyzer and that it is valid data. I use the ULink2 debugger. The problem is I see the data is coming in on the logic analyzer but does not show up in the DR of the SPI and I have seen this happens due to the OVR flag being set by the uC.

Then I clear the OVR flag before transmitting my dummy byte and clear it before reading the register. The OVR gets cleared and I read data on the SPI->DR if I break at the point where the OVR is set and step through it in my routine. But run through this and it does not clear the flag and this causes me not to read the data, I have even suspected the debugger and tested this by printing out the data on the serial port and when stepping works and then I disconnect the SW and run it NOTHING??? Why would this happen help me please guys.

SPI_I2S_DeInit(SPI1);

SPI_InitStructure.SPI_Direction=SPI_Direction_2Lines_FullDuplex;

SPI_InitStructure.SPI_Mode=SPI_Mode_Master;

SPI_InitStructure.SPI_DataSize=SPI_DataSize_8b;

SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;

SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; SPI_InitStructure.SPI_NSS=SPI_NSS_Soft;

SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256;

SPI_InitStructure.SPI_FirstBit=SPI_FirstBit_LSB;

SPI_InitStructure.SPI_CRCPolynomial = 7;

SPI_Init(SPI1, &SPI_InitStructure);