cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in configuring Control register of SPI2 in STM32F103c8

Msing.4
Associate II

I tried to to use SPI2 of STM32F103c8 but unable to intialize . while debugging i got to know that even after intializiation nothing is being written on SPI2 control Registers.

6 REPLIES 6
Imen.D
ST Employee

Hello,

ST is providing an SPI example within STM32CubeF1 firmware package, that will help you to correctly configure your peripheral:

STM32Cube_FW_F1_V1.7.0\Projects\STM32F103RB-Nucleo\Examples\SPI.

Hope this helps you.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

If by any chance you're directly programming the MCU registers without using STM Cube, HAL, and/or LL, make sure you are setting the SPI2EN bit (bit 14) in the RCC->APB1ENR to enable SPI2. Otherwise writes to the SPI registers will have no effect.

If you are using Cube/HAL/LL this should already be done automatically and likely you (or Cube) haven't used the correct initialization functions. Check RCC->APB1ENR bit 14 in your debugger to see if it's been set.

I have tried this with HAL an d SPL driver both and then i tried with hard code directly confuring register and clock configured ,GPIO configured and checked in RCC->APB1ENR bit 14 SPI2EN is set but no effect on SPI register.

hamo
Senior

@Msing.4 

Have you succeeded to use SPI2 with STM32F103C8T6?

I am rying the same but i am using HAL.

@hamo ,

Start a new thread, describing your software, what is the expected and the observed behaviour.

JW

hamo
Senior

@waclawek.jan 

i have already done that here .

I have to keep seeking for possible solutions.