cancel
Showing results for 
Search instead for 
Did you mean: 

SPI 1 does not work after migrating from stm32f1 to stm32f2

rutvij
Associate II
Posted on January 18, 2017 at 05:44

Hello folks,

I am working to migrate my firmware from stm32f103 to stm32f20f family, for that I have gone through the guide provide by st

http://www.st.com/content/ccc/resource/technical/document/application_note/27/7b/1b/45/e7/ac/4e/04/DM00033267.pdf/files/DM00033267.pdf/jcr:content/translations/en.DM00033267.pdf

.

Now my firmware includes spi (in master mode), GPIOs(in irq), Systick(configured in micros) all these are woking very well in stm32f1 and i am getting my desired output on tis MCU but when I migrated GPIOs(irq), SPI (tx irq), Systick works as expected but tough I am not getting my out put on spi slave device.

Here my slave device is 1.44 '' TFT LCD.

I am using Hal Library here.

For testing I did LED blinking it worked i also did uart but uart is also not working.

It seems like its something related to clocks.

I have configured my clocks on HSE 8 MHZ.

Requested to guide me here.

Also please let me know if i can provide any more details.

Thanks & Regards,

Rutvij trivedi

#stm32f1-to-stm32f2-spi
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on January 18, 2017 at 08:09

Hey,

Thank you for your quick response, really appreciate . 

I got my solution and SPI is now working what I missing was 

'GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;' in  spi init.

I thought  

'GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;' is enough filed to set the GPIO in alternate functionality. 

rest of the things were good to go, i just added the above mentioned filed and it worked !

Thanks & Regards,

Rutvij Trivedi

View solution in original post

2 REPLIES 2
S.Ma
Principal
Posted on January 18, 2017 at 06:40

The way to manage alternate functions for gpio may be different (from f103 to f437 in my case). Toggling a gpio may not show this. If having a debugger, check the gpio and peripheral registers. If a group of them is zero, it means the clock enable for a peripheral may be missing. Look at the register in debugger mode and even manually play with them to find out. Most problems boil down to something very simple to fix. Alsi compare the clock tree diagram from ref manual, some improvements for peripheral clock source are implemented in some STM32.

Posted on January 18, 2017 at 08:09

Hey,

Thank you for your quick response, really appreciate . 

I got my solution and SPI is now working what I missing was 

'GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;' in  spi init.

I thought  

'GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;' is enough filed to set the GPIO in alternate functionality. 

rest of the things were good to go, i just added the above mentioned filed and it worked !

Thanks & Regards,

Rutvij Trivedi