cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about single (standard) SPI and dual SPI

rubenles
Senior

Hi!

As i know, there are differents modes of spi: Single(or standard), dual and quad SPI. On stm32cubeIDE/CubeMX i can see there are different selections: SPI and Quad-SPI. But i was wondering how can i differenciate between standard and dual SPI. I have these code lines, which mode am i using and how to configure the other way?

  hspi3.Instance = SPI3;
  hspi3.Init.Mode = SPI_MODE_MASTER;
  hspi3.Init.Direction = SPI_DIRECTION_2LINES;
  hspi3.Init.DataSize = SPI_DATASIZE_4BIT;
  hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
  hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
  hspi3.Init.NSS = SPI_NSS_HARD_OUTPUT;
  hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
  hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
  hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
  hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
  hspi3.Init.CRCPolynomial = 0x0;
  hspi3.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
  hspi3.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
  hspi3.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
  hspi3.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
  hspi3.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
  hspi3.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
  hspi3.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
  hspi3.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
  hspi3.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
  hspi3.Init.IOSwap = SPI_IO_SWAP_DISABLE;
  if (HAL_SPI_Init(&hspi3) != HAL_OK)
  {
    Error_Handler();
  }

Thank you so much for your help!

Hope i explained it well!

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hello @rubenles ,

According to Reference manual, SPI supports many standards like as Motorola standard and TI mode standard. 

SPI Motorola mode is selected by default after a device reset. For more information about the SPI protocol, I recommend you take a look at Guidelines for enhanced SPI communication on STM32 MCUs and MPUs application note.

KDJEM1_0-1715952236853.png

Thank you. 

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
KDJEM.1
ST Employee

Hello @rubenles 

The SPI and the QUADSPI are two different interfaces:

  • The SPI interface can be used to communicate with external devices using the SPI protocol. The serial peripheral interface (SPI) protocol supports half-duplex, full-duplex and simplex synchronous, serial communication with external devices. The interface can be configured as master and in this case it provides the communication clock (SCK) to the external slave device. The interface is also capable of operating in multimaster configuration. The SPI supports a Master or slave operation.
  • The Quad-SPI is a serial interface that allows the communication on four data lines between a host (STM32) and an external Quad-SPI memory. The QUADSPI supports the traditional SPI (serial peripheral interface) as well as the Dual-SPI mode which allows to communicate on two lines. QUADSPI uses up to six lines in quad mode: one line for chip select, one line for clock and four lines for data in and data out. The QUADSPI interface works only as a master.

In this code you configure the SPI3 instance as master mode.

  hspi3.Instance = SPI3;
  hspi3.Init.Mode = SPI_MODE_MASTER;

The STM32CubeMX can help you to configure the other modes.

Also, I recommend you to take a look at the device reference manual and precisely SPI and QUADSPI sections and at AN4760 application note. 

KDJEM1_0-1715936715167.png

I hope this answer your request.

Thank you.

Kaouthar

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you for your response @KDJEM.1 . Everything understood with perfection but i have to clearify one more thing.

Using "SPI" protocol, without the QUAD, just "SPI" it is assumed that the protocol is "STANDARD SPI"? 

 

Thank you in advance.

KDJEM.1
ST Employee

Hello @rubenles ,

According to Reference manual, SPI supports many standards like as Motorola standard and TI mode standard. 

SPI Motorola mode is selected by default after a device reset. For more information about the SPI protocol, I recommend you take a look at Guidelines for enhanced SPI communication on STM32 MCUs and MPUs application note.

KDJEM1_0-1715952236853.png

Thank you. 

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

rubenles
Senior

Thank you @KDJEM.1 :)