/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / SPI CLK setup

Username:     
Password:     
             

Forum

# 1   2010-01-28 19:23:53 SPI CLK setup

pinstripe
New member
Registered: 2009-06-01
Posts: 4

SPI CLK setup

How do I configure the SPI master to generate CLK only during transfers? The timing diagrams in the data sheet shows it like this but with my present configuration it starts running as soon as I enable the SPI.

Thanks,
T

Offline

 

# 2   2010-01-29 07:13:25 SPI CLK setup

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: SPI CLK setup

Hi,

The clock is only generated when you send someting on MOSI, and only during the send frame.
What is your configuration ?

Offline

 

# 3   2010-01-29 18:18:49 SPI CLK setup

pinstripe
New member
Registered: 2009-06-01
Posts: 4

Re: SPI CLK setup

The configuration is:

  SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Rx;
  SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
  SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
  SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
  SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_CRCPolynomial = 7;
  SPI_Init(SPI1, &SPI_InitStructure);

  SPI_Cmd(SPI1, ENABLE);

The clock starts running as I run the last line.

Offline

 

# 4   2010-02-01 08:25:12 SPI CLK setup

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: SPI CLK setup

Hi,

Effectively, when you configure with "SPI_Direction_1Line_Rx" parameter (SPI configured as 1 line bidirectional Rx only) in master mode, the clock is always generated, because the SPI is permanently in reception mode.
The usual mode is "SPI_Direction_2Lines_FullDuplex", which allows to send data through MOSI pin, and to receive through MISO pin.

Yves

Offline

 

Board footer