cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4: no clock on SPI

matthiaspfister9
Associate II
Posted on June 12, 2012 at 13:41

The original post was too long to process during our migration. Please click on the attachment to read the original post.
10 REPLIES 10
frankmeyer9
Associate II
Posted on June 12, 2012 at 14:01

Stupid question:

Do you call your initialization function init_SPI_Config() anywhere ?

I did not see any call...

matthiaspfister9
Associate II
Posted on June 12, 2012 at 14:06

Yes, I do. I forgot to copy this part of the code:

void Init_Init(void)

{

  init_RCC_Config();

  init_GPIO_Config();

  init_TIM_Config();

  init_SYSTICK_Config();

 

  init_DCMI_Config();

  init_SPI_Config();

}

Posted on June 12, 2012 at 15:40

I'm pretty sure you're going to need to send some sacrificial data to generate receive clocks, and make sure you clear RXNE before doing so.

SPI_I2S_ReceiveData() just reads a holding register, it does not generate clocks.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
John F.
Senior
Posted on June 12, 2012 at 15:52

Correct! Also see the SPI Flash example in the STM32F4 Library Examples to see how they do it.

emalund
Associate III
Posted on June 12, 2012 at 17:39

 I'm pretty sure you're going to need to send some sacrificial data to generate receive clocks,

 

I'm absolutely positive you're going to need to send some data to generate receive clocks. SPI does not have receive clocks only ''clocks generated by transmit''.

for some protocols, the transmit data is not ''sacrificial''

Erik
joerg23
Associate II
Posted on March 15, 2013 at 22:06

SCLK must be B10 and not B13

Posted on March 15, 2013 at 22:27

SCLK must be B10 and not B13

Under what circumstances? Care to elaborate?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GUIRAT.Youssef
Associate III
Posted on April 25, 2014 at 12:26

Hi everyone , 

i'm working on a wave player project using the SPI communication options.

So , I configure the SPI as given below:

RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);

/* SPI1 configuration */

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_Low;

SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;

SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;

SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; // 72000kHz/256=281kHz < 400kHz

SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;

SPI_InitStructure.SPI_CRCPolynomial = 7;

        SPI_Init(SPI2, &SPI_InitStructure);

SPI_NSSInternalSoftwareConfig(SPI2, SPI_NSSInternalSoft_Set);

SPI_CalculateCRC(SPI2, DISABLE);

SPI_Cmd(SPI2, ENABLE);

The pins connections are used in AF mode with gpioB 

But , when i wanna see the sck clock edge , i just have a constant signal value of 3v (position high) 

I am sure that i have missed something with the the configuration but i didn't know what exactly 

Can someone help me please :\ ??
glory_man
Associate II
Posted on April 25, 2014 at 14:21

1. Generally data transmittion via spi starts when master device drives CS(NSS) pin low.

2. The transmit sequence begins when a byte is written in the Tx Buffer. Did you put any data in to SPI_DR register?