Different SPI behaviour using Standard Peripheral Library.
Hello.
I've been using STM MCU's for quite a long time now and I'm fortunate to use a wide range of series which includes F0,F1 and F2. F2 is my personal favorite.
While using them I've come across some discrepancies while using the standard peripheral library's SPI source file.
Note: I was using the updated Peripheral library which was updated on the company's website.
I interfaced a slave device (EEPROM) with STM32F071 and the same slave with STM32F101VcT6.
The clock configurations and the SPI speed is same in both the codes.
In F0 I use the following code to send data to the Slave device.
SPI1 -> DR = Data;
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_BSG));Now by sending commands with the above code my slave device gives a proper response on the MCU's MISO line. However, the same code doesn't work for F1. If I use the same SPI send function which I've used above there is no response on the MISO line.
After few hours I modified the sending data function in F1 with this :
SPI1 -> DR = Data;
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_BSG));
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_RXNE) != SET);
return SPI1->DR;After this modification the slave is giving proper responses to the Commands which are sent to it.
Is this problem related to the SPI slave or the way in which I'm handling the SPI standard peripheral library?
I also changed the SPI slave (FLASH chip instead of EEPROM). Still the same output.
Please give me some insight in this.
Best Regards,
Nishit.