Skip to main content
Msing.4
Associate II
May 16, 2019
Question

Issue in configuring Control register of SPI2 in STM32F103c8

  • May 16, 2019
  • 4 replies
  • 2025 views

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.

4 replies

Technical Moderator
May 16, 2019

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
thanks4opensource
Associate III
May 16, 2019

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.

Msing.4
Msing.4Author
Associate II
May 17, 2019

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.

Associate III
February 11, 2024

@Msing.4 

Have you succeeded to use SPI2 with STM32F103C8T6?

I am rying the same but i am using HAL.

waclawek.jan
Super User
February 12, 2024

@hamo ,

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

JW

Associate III
February 12, 2024

@waclawek.jan 

i have already done that here .

I have to keep seeking for possible solutions.